From a789fad4b7b23b8324e07ee4b9d08a145f5df0f9 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 1 Mar 2018 11:17:11 +0700 Subject: clean up osal semaphore/queue/mutex --- tinyusb/host/usbh.c | 8 ++++++-- tinyusb/host/usbh.h | 2 +- tinyusb/host/usbh_hcd.h | 7 ++----- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'tinyusb/host') diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 8d19f5f15..3e242d82b 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -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); } diff --git a/tinyusb/host/usbh.h b/tinyusb/host/usbh.h index 33e4e5a50..d7610888e 100644 --- a/tinyusb/host/usbh.h +++ b/tinyusb/host/usbh.h @@ -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, diff --git a/tinyusb/host/usbh_hcd.h b/tinyusb/host/usbh_hcd.h index 7e03e8764..0f96d4ddc 100644 --- a/tinyusb/host/usbh_hcd.h +++ b/tinyusb/host/usbh_hcd.h @@ -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; -- cgit v1.3.1