bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout) { bool_t ret; //Wait until the semaphore is available or the timeout interval elapses if(timeout == 0) { //Non-blocking call ret = OS_CSemaRequest(semaphore); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period OS_WaitCSema(semaphore); ret = TRUE; } else { //Wait until the specified semaphore becomes available ret = OS_WaitCSemaTimed(semaphore, OS_MS_TO_SYSTICKS(timeout)); } //The return value specifies whether the semaphore is available return ret; }
bool_t osWaitForEvent(OsEvent *event, systime_t timeout) { OS_ERR err; //Wait until the specified event is in the signaled //state or the timeout interval elapses if(timeout == 0) { //Non-blocking call OSFlagPend(event, 1, 0, OS_OPT_PEND_FLAG_SET_ANY | OS_OPT_PEND_FLAG_CONSUME | OS_OPT_PEND_NON_BLOCKING, NULL, &err); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period OSFlagPend(event, 1, 0, OS_OPT_PEND_FLAG_SET_ANY | OS_OPT_PEND_FLAG_CONSUME | OS_OPT_PEND_BLOCKING, NULL, &err); } else { //Wait until the specified event becomes set OSFlagPend(event, 1, OS_MS_TO_SYSTICKS(timeout), OS_OPT_PEND_FLAG_SET_ANY | OS_OPT_PEND_FLAG_CONSUME | OS_OPT_PEND_BLOCKING, NULL, &err); } //Check whether the specified event is set if(err == OS_ERR_NONE) return TRUE; else return FALSE; }
bool_t osWaitForEvent(OsEvent *event, systime_t timeout) { bool_t ret; //Wait until the specified event is in the signaled //state or the timeout interval elapses if(timeout == 0) { //Non-blocking call ret = OS_EVENT_Get(event); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period OS_EVENT_Wait(event); ret = TRUE; } else { //Wait until the specified event becomes set ret = !OS_EVENT_WaitTimed(event, OS_MS_TO_SYSTICKS(timeout)); } //The return value specifies whether the event is set return ret; }
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout) { OS_ERR err; //Wait until the semaphore is available or the timeout interval elapses if(timeout == 0) { //Non-blocking call OSSemPend(semaphore, 0, OS_OPT_PEND_NON_BLOCKING, NULL, &err); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period OSSemPend(semaphore, 0, OS_OPT_PEND_BLOCKING, NULL, &err); } else { //Wait until the specified semaphore becomes available OSSemPend(semaphore, OS_MS_TO_SYSTICKS(timeout), OS_OPT_PEND_BLOCKING, NULL, &err); } //Check whether the specified semaphore is available if(err == OS_ERR_NONE) return TRUE; else return FALSE; }
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout) { msg_t msg; //Wait until the semaphore is available or the timeout interval elapses if(timeout == 0) { //Non-blocking call msg = chSemWaitTimeout(semaphore, TIME_IMMEDIATE); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period msg = chSemWaitTimeout(semaphore, TIME_INFINITE); } else { //Wait until the specified semaphore becomes available msg = chSemWaitTimeout(semaphore, OS_MS_TO_SYSTICKS(timeout)); } //Check whether the specified semaphore is available if(msg == RDY_OK) return TRUE; else return FALSE; }
void osDelayTask(systime_t delay) { OS_ERR err; //Delay the task for the specified duration OSTimeDly(OS_MS_TO_SYSTICKS(delay), OS_OPT_TIME_DLY, &err); }
bool_t osWaitForEvent(OsEvent *event, systime_t timeout) { msg_t msg; //Wait until the specified event is in the signaled //state or the timeout interval elapses if(timeout == 0) { //Non-blocking call msg = chBSemWaitTimeout(event, TIME_IMMEDIATE); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period msg = chBSemWaitTimeout(event, TIME_INFINITE); } else { //Wait until the specified event becomes set msg = chBSemWaitTimeout(event, OS_MS_TO_SYSTICKS(timeout)); } //Check whether the specified event is set if(msg == RDY_OK) return TRUE; else return FALSE; }
bool_t osWaitForEvent(OsEvent *event, systime_t timeout) { Bool ret; //Wait until the specified event is in the signaled state if(timeout == 0) { //Non-blocking call ret = Event_pend(event->handle, Event_Id_00, Event_Id_NONE, BIOS_NO_WAIT); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period ret = Event_pend(event->handle, Event_Id_00, Event_Id_NONE, BIOS_WAIT_FOREVER); } else { //Wait for the specified time interval ret = Event_pend(event->handle, Event_Id_00, Event_Id_NONE, OS_MS_TO_SYSTICKS(timeout)); } //The return value tells whether the event is set return ret; }
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout) { portBASE_TYPE ret; //Wait until the specified semaphore becomes available if(timeout == INFINITE_DELAY) { //Infinite timeout period ret = xSemaphoreTake(semaphore->handle, portMAX_DELAY); } else { //Wait for the specified time interval ret = xSemaphoreTake(semaphore->handle, OS_MS_TO_SYSTICKS(timeout)); } //The return value tells whether the semaphore is available return ret; }
bool_t osWaitForEvent(OsEvent *event, systime_t timeout) { portBASE_TYPE ret; //Wait until the specified event is in the signaled state if(timeout == INFINITE_DELAY) { //Infinite timeout period ret = xSemaphoreTake(event->handle, portMAX_DELAY); } else { //Wait for the specified time interval ret = xSemaphoreTake(event->handle, OS_MS_TO_SYSTICKS(timeout)); } //The return value tells whether the event is set return ret; }
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout) { Bool ret; //Wait until the specified semaphore becomes available if(timeout == 0) { //Non-blocking call ret = Semaphore_pend(semaphore->handle, BIOS_NO_WAIT); } else if(timeout == INFINITE_DELAY) { //Infinite timeout period ret = Semaphore_pend(semaphore->handle, BIOS_WAIT_FOREVER); } else { //Wait for the specified time interval ret = Semaphore_pend(semaphore->handle, OS_MS_TO_SYSTICKS(timeout)); } //The return value tells whether the semaphore is available return ret; }
void osDelayTask(systime_t delay) { //Delay the task for the specified duration OS_Delay(OS_MS_TO_SYSTICKS(delay)); }