mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
fix osal_none timeout, instant return with OSAL_TIMEOUT_NOTIMEOUT
This commit is contained in:
parent
eb39d88360
commit
0d9e1163df
@ -202,7 +202,7 @@ static inline void osal_semaphore_reset(osal_semaphore_handle_t sem_hdl)
|
|||||||
timeout = osal_tick_get();\
|
timeout = osal_tick_get();\
|
||||||
state = __LINE__; case __LINE__:\
|
state = __LINE__; case __LINE__:\
|
||||||
if( *(sem_hdl) == 0 ) {\
|
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;\
|
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
|
||||||
else\
|
else\
|
||||||
return TUSB_ERROR_OSAL_WAITING;\
|
return TUSB_ERROR_OSAL_WAITING;\
|
||||||
@ -315,8 +315,8 @@ static inline void osal_queue_flush(osal_queue_handle_t const queue_hdl)
|
|||||||
do {\
|
do {\
|
||||||
timeout = osal_tick_get();\
|
timeout = osal_tick_get();\
|
||||||
state = __LINE__; case __LINE__:\
|
state = __LINE__; case __LINE__:\
|
||||||
if( queue_hdl-> count == 0 ) {\
|
if( queue_hdl->count == 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;\
|
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
|
||||||
else\
|
else\
|
||||||
return TUSB_ERROR_OSAL_WAITING;\
|
return TUSB_ERROR_OSAL_WAITING;\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user