From 5f7d7a34f576dabd94c10fad05fe5fa85d4ef1e0 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 6 Dec 2018 00:38:00 +0700 Subject: able to complete enumeration with os none blocking --- src/class/cdc/cdc_host.c | 4 ++-- src/osal/osal_none.h | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index 0a3661878..27ef502e0 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -144,7 +144,7 @@ void cdch_init(void) tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) { - OSAL_SUBTASK_BEGIN + //OSAL_SUBTASK_BEGIN // TODO change following assert to subtask_assert if ( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL != p_interface_desc->bInterfaceSubClass) return TUSB_ERROR_CDC_UNSUPPORTED_SUBCLASS; @@ -218,7 +218,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ tuh_cdc_mounted_cb(dev_addr); } - OSAL_SUBTASK_END + //OSAL_SUBTASK_END } void cdch_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes) diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h index 042c7a6e8..61ed0d45e 100644 --- a/src/osal/osal_none.h +++ b/src/osal/osal_none.h @@ -96,15 +96,14 @@ static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl) sem_hdl->count = 0; } -static inline tusb_error_t osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec) { +static inline tusb_error_t osal_semaphore_wait(osal_semaphore_t sem_hdl, uint32_t msec) +{ (void) msec; - while (true) { - while (sem_hdl->count == 0) { } - if (sem_hdl->count == 0) { - sem_hdl->count--; - break; - } - } + + // TODO blocking for now + while (sem_hdl->count == 0) { } + sem_hdl->count--; + return TUSB_ERROR_NONE; } -- cgit v1.3.1