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)
This commit is contained in:
hathach
2013-06-27 16:19:22 +07:00
parent c81c4bb817
commit 3bca56665c
11 changed files with 270 additions and 29 deletions

View File

@@ -133,11 +133,27 @@ 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
//--------------------------------------------------------------------+