clean up osal semaphore/queue/mutex
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
|
||||
#define _TINY_USB_SOURCE_FILE_
|
||||
|
||||
#ifndef TUSB_CFG_OS_TASK_PRIO
|
||||
#define TUSB_CFG_OS_TASK_PRIO 0
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -153,10 +157,10 @@ tusb_error_t usbh_init(void)
|
||||
{
|
||||
usbh_device_info_t * const p_device = &usbh_devices[i];
|
||||
|
||||
p_device->control.sem_hdl = osal_semaphore_create( OSAL_SEM_REF(p_device->control.semaphore) );
|
||||
p_device->control.sem_hdl = osal_semaphore_create(1, 0);
|
||||
ASSERT_PTR(p_device->control.sem_hdl, TUSB_ERROR_OSAL_SEMAPHORE_FAILED);
|
||||
|
||||
p_device->control.mutex_hdl = osal_mutex_create ( OSAL_MUTEX_REF(p_device->control.mutex) );
|
||||
p_device->control.mutex_hdl = osal_mutex_create();
|
||||
ASSERT_PTR(p_device->control.mutex_hdl, TUSB_ERROR_OSAL_MUTEX_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ ATTR_WEAK void tuh_device_mount_failed_cb(tusb_error_t error, tusb_descriptor
|
||||
#ifdef _TINY_USB_SOURCE_FILE_
|
||||
|
||||
|
||||
OSAL_TASK_FUNCTION (usbh_enumeration_task, p_task_para);
|
||||
void usbh_enumeration_task(void* param);
|
||||
tusb_error_t usbh_init(void);
|
||||
|
||||
tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
|
||||
|
||||
@@ -91,11 +91,8 @@ typedef struct {
|
||||
// uint8_t xferred_bytes; TODO not yet necessary
|
||||
tusb_control_request_t request;
|
||||
|
||||
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
|
||||
osal_semaphore_t sem_hdl; // used to synchronize with HCD when control xfer complete
|
||||
osal_mutex_t mutex_hdl; // used to exclusively occupy control pipe
|
||||
} control;
|
||||
} usbh_device_info_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user