From 10bf41f718ea867a3621e11b4c49e72605bbcc89 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 14 Nov 2018 16:31:28 +0700 Subject: change osal_queue_receive() signature - fix build issue with freertos --- src/device/dcd.h | 2 -- src/device/usbd.c | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'src/device') diff --git a/src/device/dcd.h b/src/device/dcd.h index 0c976edec..ff836f405 100644 --- a/src/device/dcd.h +++ b/src/device/dcd.h @@ -125,8 +125,6 @@ void dcd_event_xfer_complete (uint8_t rhport, uint8_t ep_addr, uint32_t xferred_ /*------------------------------------------------------------------*/ /* Endpoint API *------------------------------------------------------------------*/ - -//------------- Non-control Endpoints -------------// bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc); bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes); bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr); diff --git a/src/device/usbd.c b/src/device/usbd.c index c9d5e5642..4a9b13a25 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -245,24 +245,25 @@ void usbd_task( void* param) { (void) param; - OSAL_TASK_BEGIN +#if CFG_TUSB_OS != OPT_OS_NONE + while (1) { +#endif + usbd_main_st(); - OSAL_TASK_END + +#if CFG_TUSB_OS != OPT_OS_NONE + } +#endif } static tusb_error_t usbd_main_st(void) { dcd_event_t event; - tusb_error_t err = TUSB_ERROR_NONE; + // Loop until there is no more events in the queue - while (_usbd_q->count > 0) + while (1) { - tu_memclr(&event, sizeof(dcd_event_t)); - - err = osal_queue_receive(_usbd_q, &event); - if (err != TUSB_ERROR_NONE) { - break; - } + if ( !osal_queue_receive(_usbd_q, &event) ) return TUSB_ERROR_NONE; if ( DCD_EVENT_SETUP_RECEIVED == event.event_id ) { @@ -312,7 +313,7 @@ static tusb_error_t usbd_main_st(void) } } - return err; + return TUSB_ERROR_NONE; } void tud_control_interface_control_complete_cb(uint8_t rhport, uint8_t interface, tusb_control_request_t const * const p_request) { -- cgit v1.3.1