diff options
| author | hathach <[email protected]> | 2013-06-27 16:19:22 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-06-27 16:19:22 +0700 |
| commit | 3bca56665cb802e6e599fb4a1a2be5dd6e64b70b (patch) | |
| tree | ee67c6bac3050face4e8747b38317dfa2aba4927 /tinyusb/osal/osal.h | |
| parent | c81c4bb817925f385b45c46857b3f0630edb99ed (diff) | |
add mutex support for osal
add test for mutex in test_osal_none.c
implement usbh_control_xfer using mutex to get access to queue xfer on control pipe
(while semaphore is used to sync with hcd DMA)
failed to issue control xfer: set idle & get report descriptor in hidh_open_subtask (more to work on)
Diffstat (limited to 'tinyusb/osal/osal.h')
| -rw-r--r-- | tinyusb/osal/osal.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index c28bc4790..f40900919 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -133,12 +133,28 @@ typedef osal_semaphore_t * osal_semaphore_handle_t; #define OSAL_SEM_REF(name)\ &name -osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * const sem); -void osal_semaphore_wait(osal_semaphore_handle_t const sem_hdl, uint32_t msec, tusb_error_t *p_error); -tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl); -void osal_semaphore_reset(osal_semaphore_handle_t const sem_hdl); +osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * p_sem); +void osal_semaphore_wait(osal_semaphore_handle_t sem_hdl, uint32_t msec, tusb_error_t *p_error); +tusb_error_t osal_semaphore_post(osal_semaphore_handle_t sem_hdl); +void osal_semaphore_reset(osal_semaphore_handle_t sem_hdl); //--------------------------------------------------------------------+ +// MUTEX API (priority inheritance) +//--------------------------------------------------------------------+ +#define OSAL_MUTEX_DEF(name)\ + osal_mutex_t name + +#define OSAL_MUTEX_REF(name)\ + &name + +typedef osal_semaphore_t osal_mutex_t; +typedef osal_semaphore_handle_t osal_mutex_handle_t; + +osal_mutex_handle_t osal_mutex_create(osal_mutex_t * p_mutex); +void osal_mutex_wait(osal_mutex_handle_t mutex_hdl, uint32_t msec, tusb_error_t *p_error); +tusb_error_t osal_mutex_release(osal_mutex_handle_t mutex_hdl); +void osal_mutex_reset(osal_mutex_handle_t mutex_hdl); +//--------------------------------------------------------------------+ // QUEUE API //--------------------------------------------------------------------+ typedef struct{ |
