当前位置: 首页>>代码示例>>C++>>正文


C++ OSSemPost函数代码示例

本文整理汇总了C++中OSSemPost函数的典型用法代码示例。如果您正苦于以下问题:C++ OSSemPost函数的具体用法?C++ OSSemPost怎么用?C++ OSSemPost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OSSemPost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Tmr_A_isr

// Interrupt routine
nodebug root interrupt void Tmr_A_isr()
{
    char TMRA_status;                    // This will hold the interrupt flags
    TMRA_status = RdPortI(TACSR);        // Read interrupt flags and store to TMRA_status
    // Timer A demultiplexing
    if (TMRA_status & TMA7_MASK) {       // if Timer A7 has trigered
        count_TMRA7++;
        if (count_TMRA7 == MAX_COUNT) {  // if Timer A7 has interrupted the CPU 100 times
            display_count[2]++;          // increment corresponding display counter
            count_TMRA7 = 0;             // clear Timer A7 counter
            OSSemPost(TimerSem[2]);      // Post a semaphore for Timer A7 counter
        }
    }
    if (TMRA_status & TMA6_MASK) {       // if Timer A6 has trigered
        count_TMRA6++;                   // increment Timer A6 counter
        if (count_TMRA6 == MAX_COUNT) {  // if Timer A6 has interrupted the CPU 100 times
            display_count[1]++;          // increment coressponding display counter
            count_TMRA6 = 0;             // clear Timer A6 counter
            OSSemPost(TimerSem[1]);      // Post a semaphore for Timer A6 Counter
        }
    }
    if (TMRA_status & TMA5_MASK) {       // if Timer A5 has trigered
        count_TMRA5++;                   // increment Timer A5 counter
        if (count_TMRA5 == MAX_COUNT) {  // if Timer A5 has interrupted the CPU 100 times
            display_count[0]++;          // increment corresponding display counter
            count_TMRA5 = 0;             // clear the Timer A5 counter
            OSSemPost(TimerSem[0]);      // Post a semaphore for Timer A5 Counter
        }
    }
    OSIntExit();
}
开发者ID:xTeox,项目名称:ECE-4460---Lab-2,代码行数:32,代码来源:LAB2B.C

示例2: void

/*
 * timerTempSeconds - Get a temporary timer from the free list and set
 * it in seconds.  Note that you don't get a handle on the timer record.
 * The record will be automatically returned to the free list when either
 * it expires or it is cancelled.
 *  RETURNS: Zero if OK, otherwise an error code.
 */
INT timerTempSeconds
(
	ULONG timerDelay,				/* The delay value in seconds. */
	void (* timerHandler)(void *),	/* The timer handler function. */
	void *timerArg					/* Arg passed to handler. */
)
{
	INT st;
#ifdef OS_DEPENDENT
    UBYTE err;
	OSSemPend(mutex, 0, &err);
#endif
	if (timerFree == NULL) {
#ifdef OS_DEPENDENT
		OSSemPost(mutex);
#endif
		TIMERDEBUG((LOG_ERR, "timerTempSeconds: No free timer"));
		st = -1;					/* XXX An allocation error code? */
	}
	else {
		Timer *curTimer = timerFree;
		
		timerFree = timerFree->timerNext;
#ifdef OS_DEPENDENT
		OSSemPost(mutex);
#endif
		
		st = timerJiffys(curTimer, timerDelay * TICKSPERSEC, timerHandler, timerArg);
	}
	return st;
}
开发者ID:lubing521,项目名称:protocols,代码行数:38,代码来源:NETTIMER.C

示例3: i2c0RegWHandler

static void i2c0RegWHandler(void)
{
	i2c0ErrorCode = LPC_I2C0->I2STAT & 0xF8;
	if (i2c0ErrorCode == 0x08) {
		i2c0StartClr();
		LPC_I2C0->I2DAT = i2c0Address << 1;
	} else if (i2c0ErrorCode == 0x10) {
		i2c0StartClr();
		LPC_I2C0->I2DAT = i2c0Address << 1;
	} else if (i2c0ErrorCode == 0x18) {
		LPC_I2C0->I2DAT = i2c0Reg;
	} else if (i2c0ErrorCode == 0x20) {
		i2c0Stop();
		OSSemPost(i2c0Ready);
	} else if (i2c0ErrorCode == 0x28) {
		if (i2c0TxCnt < i2c0TxSize) {
			LPC_I2C0->I2DAT = *(i2c0TxPtr + i2c0TxCnt);
			i2c0TxCnt++;
		} else {
			i2c0Stop();
			OSSemPost(i2c0Ready);
		}
	} else if (i2c0ErrorCode == 0x30) {
		i2c0Stop();
		OSSemPost(i2c0Ready);
	} else if (i2c0ErrorCode == 0x38) {
		OSSemPost(i2c0Ready);
	}
	i2c0IntFlagClr();
}
开发者ID:sonodasong,项目名称:Indoor_Positioning_System,代码行数:30,代码来源:i2c0.c

示例4: dine

void dine(philosopher *thePhilosopher)
{
	INT8U return_code;
	// Try to get lock with really short timeout
	OSSemPend(thePhilosopher->left, 1, &return_code);
	if (return_code != OS_TIMEOUT) {
		// We got the fork!!
		OSSemPend(thePhilosopher->right, 1, &return_code);
		if (return_code != OS_TIMEOUT) { // Success
			thePhilosopher->count++;
			printf("%c I'm eating. I've eaten %d times.\n", thePhilosopher->name, thePhilosopher->count);
			OSTimeDlyHMSM(0,0,5,0); // Sleep 5s
			printf("%c I'm done eating.\n", thePhilosopher->name);
			OSSemPost(thePhilosopher->right);
			OSSemPost(thePhilosopher->left);
		} else { // Failure
			OSSemPost(thePhilosopher->left);
			printf("%c Couldn't get second fork, swapping forks.\n", thePhilosopher->name);
			OS_EVENT *temp;
			temp = thePhilosopher->left;
			thePhilosopher->left = thePhilosopher->right;
			thePhilosopher->right = temp;
		}
	}
}
开发者ID:tdickman,项目名称:uc-embedded-systems,代码行数:25,代码来源:main.c

示例5: MCI_DataEndProcess

/*******************************************************************************************************************
** 函数名称: MCI_DataEndProcess()				
**
** 功能描述: MCI 数据结束处理函数
********************************************************************************************************************/
void MCI_DataEndProcess(void)
{
#if LPC23xx_MCI_DMA_EN
    if (lpc_mci->CurTran == MCI_CUR_SEND)
    {
        while ( !(DMACRawIntTCStatus & 0x01) );
	    DMACIntTCClear |= 0x01;
		lpc_mci->RxTxFlag = SD_NO_ERR;                       /* DMA 接收块数据成功 */
    }
    else
    {
        while ( !(DMACRawIntTCStatus & 0x02) );
		DMACIntTCClear |= 0x02;
		lpc_mci->RxTxFlag = SD_NO_ERR;                       /* DMA 发送块数据成功 */
    }
    
    #if SD_UCOSII_EN
	    OSSemPost(lpc_mci->psds->pSemSdmmcRW);               /* 使等待函数就绪 */
    #endif	

#else
   
    MCIClear |= MCI_DATA_BLK_END;
    if ((lpc_mci->SendCnt >= SD_BLOCKSIZE) || 
        (lpc_mci->RecCnt >= SD_BLOCKSIZE))	   
	{                                                       /* 块数据已收/发成功 */
	    lpc_mci->RxTxFlag = SD_NO_ERR;
	    #if SD_UCOSII_EN
	    	OSSemPost(lpc_mci->psds->pSemSdmmcRW);
		#endif
	} 

#endif	    
	MCIDataCtrl = 0;			                            /* 数据控制寄存器清0  */
}
开发者ID:nodreamnolove,项目名称:sx,代码行数:40,代码来源:sdhal.c

示例6: Check_UDP_Paket

////////////////////////////////////////////////////////////////////
//	函数名称:
//	函数功能:
//	入口参数:
//
//
//	出口参数:无
////////////////////////////////////////////////////////////////////
uint8 Check_UDP_Paket(void *pdata, uint16 lg)
{
    uint8 *p;
    struct COMM_XCOM *pxcom;
    struct tagIC2CMD_Header cmd;
    struct BASE_MSG *pmsg;
    p = (uint8 *)pdata;
    pxcom = (struct COMM_XCOM *)Get_XCOM_Port(DEV_XCOM_UDP);
    Mem_Copy((uint8 *)&cmd, p, sizeof( struct tagIC2CMD_Header));
    if (cmd.dwSyncHead != CMD_ABLE_ICII) return 0;
    if ((cmd.byteProtocolType & CMD_SENDER_ACK) == CMD_SENDER_ACK)
    {
        if ((pxcom->Rflag & XCOM_READ_FLAG_WAIT_ACK) && (pxcom->flag != NULL))
            OSSemPost(pxcom->flag);
    }
    else
    {
        if ((pxcom->Rflag & XCOM_READ_FLAG_WAIT_DATA) != XCOM_READ_FLAG_WAIT_DATA) return 0;
        if (pxcom->flag == NULL) return 0;
        pmsg = (struct BASE_MSG *)((uint8 *)pdata + sizeof(struct XCOM_REV_TYPE) + sizeof(struct tagIC2CMD_Header));
        if (pmsg->option != pxcom->RCMDNo) return 0;
        pxcom->Rdata_lg = lg - sizeof(struct tagIC2CMD_Header);
        Mem_Copy(pxcom->pbuf, p + sizeof(struct tagIC2CMD_Header), pxcom->Rdata_lg);
        OSSemPost(pxcom->flag);
        UDP_Send_ACK(pdata);
        return TRUE;
    }
    return FALSE;
}
开发者ID:wcf873455992,项目名称:ZK,代码行数:37,代码来源:User_udp.c

示例7: UartRcv_Task

void UartRcv_Task (void) 
{
		INT8U err;
	
		uart1SendInfo.clearFreCount = 0;
		uart1SendInfo.outPut = 0x00;
		uart1SendInfo.SEL = 0;
	
		while(1)
		{
				
				printf("In function Uart: ret = %u\n", uart1SendInfo.outPut );
				OSSemPend( UartSendTaskSem, 1000, &err );
				Uart1_Send_Struct(&uart1SendInfo);
				OSSemPost( UartSendTaskSem );
				
				OSTimeDly(1000);
				if ( uart1RcvOK == 1 )
				{			
						OSSemPend(UartRcvTaskSem, 1000, &err );
						uart1RcvInfo = Uart1_Get_Struct();
						OSSemPost(UartRcvTaskSem);
						Uart1LostCnt = 0;
				}
				else 
				{
						Uart1LostCnt++;
				}
		}
		return;
}
开发者ID:Liu1992,项目名称:GasSub_LPC1788,代码行数:31,代码来源:task_UartRcv.c

示例8: updateTimeTsk

void updateTimeTsk(void)
{

struct watchTime
{
int hms;
int secs;
int mins;
};

watchTime ETime;

int msCntr = 0;

ETime.hms = 0;
ETime.secs = 0;
ETime.mins =0;

OSSemPend(UART_sem, 0, &err);
uHALr_printf("  Task%c Called.\n\n", *(char *)Id);
OSSemPost(UART_sem);


while(1)
{
	OSTimeDly(1);
	if(TimeMode == 1)
	{
		msCntr++;
		if(msCntr == 100)
		{
			msCntr = 0;
			ETime.hms++;
			if(ETime.hms == 10)
			{
				ETime.secs++;
				ETime.hms = 0;
				if(ETime.secs == 60)
				{
					ETime.mins++;
					ETime.secs = 0;
					if(ETime.mins == 999)
					{
						ETime.mins =0;
					}
				}
			}
			
			
			OSSemPend(UART_sem, 0, &err);
          	Uart_Printf(" %03x:%02x:%02x\r",ETime.mins,ETime.secs,ETime.hms);
          	OSSemPost(UART_sem);
			
		}
				
	}
}

}
开发者ID:wynro,项目名称:proyecto-hardware,代码行数:59,代码来源:stopwatch.c

示例9: TaskSensores

void TaskSensores(void *pdata)
{    
#if OS_CRITICAL_METHOD == 3 
    OS_CPU_SR  cpu_sr;
#endif
    struct AdcMsg *m;
    INT16U value = 0;
    INT16U ValorTeclado = 0;
	INT8U err;
	for(;;)
	{
        
        m = (struct AdcMsg *) OSMemGet(dMemory,&err);
        if(err == OS_NO_ERR){
            OSSemPend(STeclado,0,&err);
            ValorTeclado = NumeroSensores;
            OSSemPost(STeclado);       
            m->adc0 = 0;
            m->adc1 = 0;
            m->adc2 = 0;
            switch(ValorTeclado){
                case 3:
                    Delay10TCYx(100);
                    SetChanADC(ADC_CH2);
                    ConvertADC();
                    while( BusyADC() );
                    value = ReadADC();
                    m->adc2 = Temp(value);
                case 2:
                    Delay10TCYx(100);
                    SetChanADC(ADC_CH1);
                    ConvertADC();
                    while( BusyADC() );
                    value = ReadADC();
                    m->adc1 = Temp(value);                    
                case 1:
                    Delay10TCYx(100);
                    SetChanADC(ADC_CH0);
                    ConvertADC();
                    while( BusyADC() );
                    value = ReadADC();
                    m->adc0 = Temp(value);
                default:
                    break;
            }

            err = OSQPost(QueueADC0,m);
            if(err == OS_Q_FULL){
                OSMemPut(dMemory,m);
                OSSemPost(STaskTxSerial);
            }
        }else{
            OSSemPost(STaskTxSerial);
        }
		//OSSemPost(STask2);
		OSTimeDly(1);
	}
}
开发者ID:gianafrancisco,项目名称:ArquitecturasEmbebidasTPFinal,代码行数:58,代码来源:TEST.c

示例10: safeBufferGet

void safeBufferGet(message_t * const msg) {
  uint8_t osStatus;
  
  OSSemPend(fullSlot, 0, &osStatus);
  OSSemPend(bufMutex, 0, &osStatus);
  getBuffer(msg);
  osStatus = OSSemPost(bufMutex);
  osStatus = OSSemPost(freeSlot);
}
开发者ID:DavidKendall,项目名称:iot,代码行数:9,代码来源:buffer.cpp

示例11: USART0IntHandler

unsigned long USART0IntHandler(void *pvCBData,
        unsigned long ulEvent,
        unsigned long ulMsgParam,
        void *pvMsgData)
{
	char receive_byte;

	if (Contiki_Sem != NULL){
		if ((ulEvent & UART_EVENT_RX) == UART_EVENT_RX)
		{
			receive_byte = xHWREGB(UART0_BASE + UART_012_D);

			if (slip_input_byte(receive_byte) == 1) OSSemPost(Contiki_Sem);

			buffer_rcvd[buffer_rcvd_i++]=receive_byte;

	#if 0
			if (OSQueuePost(Serial0, receive_byte) == BUFFER_UNDERRUN)
			{
				// Problema: Estouro de buffer
				OSQueueClean(Serial0);
			}
	#endif
		}

		if ((ulEvent & UART_EVENT_TC) == UART_EVENT_TC)
		{
			if ((xHWREGB(UART0_BASE + UART_012_C2) & UART_EVENT_TC) == UART_EVENT_TC)
			{
				UARTIntDisable(UART0_BASE, UART_INT_TC);
				(void)OSSemPost(SerialTX0);
			}
		}

		// ************************
		// Interrupt Exit
		// ************************
		OS_INT_EXIT_EXT();
		// ************************
	}else{
		if ((ulEvent & UART_EVENT_RX) == UART_EVENT_RX)
		{
			receive_byte = xHWREGB(UART0_BASE + UART_012_D);
		}

		if ((ulEvent & UART_EVENT_TC) == UART_EVENT_TC)
		{
			if ((xHWREGB(UART0_BASE + UART_012_C2) & UART_EVENT_TC) == UART_EVENT_TC)
			{
				UARTIntDisable(UART0_BASE, UART_INT_TC);
			}
		}
	}
}
开发者ID:thiagohd,项目名称:BRTOSicslowpan,代码行数:54,代码来源:UART.c

示例12: EXTI0_IRQHandler

/* 按键中断0 */
void EXTI0_IRQHandler(void)
{
    if(EXTI_GetITStatus(EXTI_Line0) != RESET) //确保是否产生了EXTI Line中断
    {
        OSIntEnter();
        OSSemPost(key_SEM); // 发送信号量,这个函数并不会引起系统调度,所以中断服务函数一定要简洁。
        OSSemPost(keyDis_SEM);
        EXTI_ClearITPendingBit(EXTI_Line0); // 清除标志位
        OSIntExit();
    }
}
开发者ID:vcheung,项目名称:transSysPro,代码行数:12,代码来源:stm32f10x_it.c

示例13: network_gm_init

void network_gm_init(void)
{
	INT8S	res = 0;
	INT8U 		err;
	gd_msg_t 	*send_msg = NULL;
	
	OSSemPend(gd_system.gm_operate_sem, GD_SEM_TIMEOUT, &err);
	if(err != OS_NO_ERR)	
		res = -1;
	else 
		res = gprsmodule_init();
	gd_msg_malloc(&send_msg);
	send_msg->data =  (void*)NULL;				
	if(res == 0)
	{

		res = gm_sms_init("13500250500");
		if(res == 0)
		{
			res = gm_phone_init();
			if(res == 0)
			{
 	OSSemPost(gd_system.gm_operate_sem);

				fail_tick = 0;				
				send_msg->type = GD_MSG_TCP_INIT;
				OSQPost(gd_system.network_task.q_network, (void*)send_msg);		
				return;
			}
		}
		
	}
//	else
	{
 	OSSemPost(gd_system.gm_operate_sem);
		fail_tick++;
		if(fail_tick >= NETWORK_FAIL_COUNT)
		{
			fail_tick = 0;	
			//OSQFlush(gd_system.network_task.q_network);					
			send_msg->type = GD_MSG_GM_RESET;
		}
		else
		{
			send_msg->type = GD_MSG_GM_INIT;
		}			
		OSQPost(gd_system.network_task.q_network, (void*)send_msg);	
	}


}
开发者ID:tomyqg,项目名称:stm32fxdtu,代码行数:51,代码来源:gd_network.c

示例14: OCOIsr

//interupt waits for a read from the port
ISR OCOIsr(void)
{
    OS_ISR_ENTER();
    ReceiveVar = sci_read();
    OSSemPost(ReceiveFlag);
    OSIntExit();  
}
开发者ID:mdmoerdyk,项目名称:etec454,代码行数:8,代码来源:MultiTap.c

示例15: UserIRQ_Eint4567

void UserIRQ_Eint4567(void)
{
    OSSemPend(UART_sem, 0, 0);
    Uart_Printf(" SB2 or SB3 had pressed...\r");
    OSSemPost(UART_sem);
	Eint4567Isr();
}
开发者ID:wynro,项目名称:proyecto-hardware,代码行数:7,代码来源:Os_cpu_c.c


注:本文中的OSSemPost函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。