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

@@ -92,15 +92,19 @@ typedef struct { // TODO internal structure, re-order members
uint8_t interface_count; // bNumInterfaces alias
//------------- device -------------//
volatile uint8_t state; // device state, value from enum tusbh_device_state_t
uint32_t flag_supported_class; // a bitmap of supported class
volatile uint8_t state; // device state, value from enum tusbh_device_state_t
uint32_t flag_supported_class; // a bitmap of supported class
//------------- control pipe -------------//
struct {
volatile uint8_t pipe_status;
tusb_std_request_t request;
OSAL_SEM_DEF(semaphore); // TODO move to semaphore pool
osal_semaphore_handle_t sem_hdl;
OSAL_SEM_DEF(semaphore); // TODO move to semaphore pool ?
osal_semaphore_handle_t sem_hdl; // used to synchronize with HCD when control xfer complete
OSAL_MUTEX_DEF(mutex); // TODO move to mutex pool ?
osal_mutex_handle_t mutex_hdl; // used to exclusively occupy control pipe
} control;
} usbh_device_info_t;