diff options
| author | Zhihong Chen <[email protected]> | 2023-10-12 10:23:51 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2023-10-12 14:38:13 +0800 |
| commit | d4ba2eef5779c9f1259668ff4f51430419c3ad2d (patch) | |
| tree | a0347dfe2dd2a1cafb5403d46b3ebb6413e8151b /osal/usb_osal_rtthread.c | |
| parent | 3d96f64f940ed6123a73433e7ce333de0f10d5bb (diff) | |
osal: add USB_OSAL_WAITING_FOREVER for Semaphore and Queue use
- add USB_OSAL_WAITING_FOREVER for Semaphore and Queue use
Signed-off-by: Zhihong Chen <[email protected]>
Diffstat (limited to 'osal/usb_osal_rtthread.c')
| -rw-r--r-- | osal/usb_osal_rtthread.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/osal/usb_osal_rtthread.c b/osal/usb_osal_rtthread.c index a0f7563c..964c1a7f 100644 --- a/osal/usb_osal_rtthread.c +++ b/osal/usb_osal_rtthread.c @@ -40,7 +40,11 @@ int usb_osal_sem_take(usb_osal_sem_t sem, uint32_t timeout) int ret = 0; rt_err_t result = RT_EOK; - result = rt_sem_take((rt_sem_t)sem, rt_tick_from_millisecond(timeout)); + if (timeout == USB_OSAL_WAITING_FOREVER) { + result = rt_sem_take((rt_sem_t)sem, RT_WAITING_FOREVER); + } else { + result = rt_sem_take((rt_sem_t)sem, rt_tick_from_millisecond(timeout)); + } if (result == -RT_ETIMEOUT) { ret = -ETIMEDOUT; } else if (result == -RT_ERROR) { @@ -92,7 +96,11 @@ int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout) int ret = 0; rt_err_t result = RT_EOK; - result = rt_mq_recv((rt_mq_t)mq, addr, sizeof(uintptr_t), rt_tick_from_millisecond(timeout)); + if (timeout == USB_OSAL_WAITING_FOREVER) { + result = rt_mq_recv((rt_mq_t)mq, addr, sizeof(uintptr_t), RT_WAITING_FOREVER); + } else { + result = rt_mq_recv((rt_mq_t)mq, addr, sizeof(uintptr_t), rt_tick_from_millisecond(timeout)); + } if (result == -RT_ETIMEOUT) { ret = -ETIMEDOUT; } else if (result == -RT_ERROR) { |
