add semphore reset & queue flush API
modify test to check control pipe semaphore created with usbh_init
This commit is contained in:
@@ -150,6 +150,7 @@ static inline uint32_t osal_tick_get(void)
|
||||
#define SUBTASK_ASSERT_STATUS_WITH_HANDLER(...) TASK_ASSERT_STATUS_WITH_HANDLER(__VA_ARGS__)
|
||||
#define SUBTASK_ASSERT(...) TASK_ASSERT(__VA_ARGS__)
|
||||
#define SUBTASK_ASSERT_WITH_HANDLER(...) TASK_ASSERT_WITH_HANDLER(__VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Semaphore API
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -177,6 +178,12 @@ static inline tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const se
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
static inline void osal_sempahore_reset(osal_semaphore_handle_t const sem_hdl) ATTR_ALWAYS_INLINE;
|
||||
static inline void osal_sempahore_reset(osal_semaphore_handle_t const sem_hdl)
|
||||
{
|
||||
(*sem_hdl) = 0;
|
||||
}
|
||||
|
||||
#define osal_semaphore_wait(sem_hdl, msec, p_error) \
|
||||
do {\
|
||||
timeout = osal_tick_get();\
|
||||
@@ -242,6 +249,12 @@ static inline tusb_error_t osal_queue_send(osal_queue_handle_t const queue_hdl,
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
static inline void osal_queue_flush(osal_queue_handle_t const queue_hdl) ATTR_ALWAYS_INLINE;
|
||||
static inline void osal_queue_flush(osal_queue_handle_t const queue_hdl)
|
||||
{
|
||||
queue_hdl->count = queue_hdl->rd_idx = queue_hdl->wr_idx = 0;
|
||||
}
|
||||
|
||||
#define osal_queue_receive(queue_hdl, p_data, msec, p_error) \
|
||||
do {\
|
||||
timeout = osal_tick_get();\
|
||||
|
||||
Reference in New Issue
Block a user