diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 775febc3..ee7c2fdd 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -202,7 +202,7 @@ static inline void osal_semaphore_reset(osal_semaphore_handle_t sem_hdl) timeout = osal_tick_get();\ state = __LINE__; case __LINE__:\ if( *(sem_hdl) == 0 ) {\ - if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && (timeout + osal_tick_from_msec(msec) < osal_tick_get()) ) /* time out */ \ + if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && (timeout + osal_tick_from_msec(msec) <= osal_tick_get()) ) /* time out */ \ *(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\ else\ return TUSB_ERROR_OSAL_WAITING;\ @@ -315,8 +315,8 @@ static inline void osal_queue_flush(osal_queue_handle_t const queue_hdl) do {\ timeout = osal_tick_get();\ state = __LINE__; case __LINE__:\ - if( queue_hdl-> count == 0 ) {\ - if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && ( timeout + osal_tick_from_msec(msec) < osal_tick_get() )) /* time out */ \ + if( queue_hdl->count == 0 ) {\ + if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && ( timeout + osal_tick_from_msec(msec) <= osal_tick_get() )) /* time out */ \ *(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\ else\ return TUSB_ERROR_OSAL_WAITING;\