diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 2df7d49c..fb968b3c 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -523,7 +523,7 @@ void dcd_bus_event(uint8_t rhport, usbd_bus_event_type_t bus_event) .rhport = rhport, .event_id = USBD_EVENTID_SOF, }; - osal_queue_send(_usbd_q, &task_event); + osal_queue_send_isr(_usbd_q, &task_event); } break; @@ -549,7 +549,7 @@ void dcd_setup_received(uint8_t rhport, uint8_t const* p_request) }; memcpy(&task_event.setup_received, p_request, sizeof(tusb_control_request_t)); - osal_queue_send(_usbd_q, &task_event); + osal_queue_send_isr(_usbd_q, &task_event); } void dcd_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, bool succeeded) @@ -561,7 +561,7 @@ void dcd_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, (void) succeeded; // only signal data stage, skip status (zero byte) - if (xferred_bytes) osal_semaphore_post( _usbd_ctrl_sem ); + if (xferred_bytes) osal_semaphore_post_isr( _usbd_ctrl_sem ); }else { usbd_task_event_t task_event = @@ -574,7 +574,7 @@ void dcd_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, task_event.xfer_done.ep_addr = ep_addr; task_event.xfer_done.xferred_byte = xferred_bytes; - osal_queue_send(_usbd_q, &task_event); + osal_queue_send_isr(_usbd_q, &task_event); } TU_ASSERT(succeeded, ); diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index b7981613..bea90093 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -146,7 +146,7 @@ static inline osal_queue_t osal_queue_create(uint32_t depth, uint32_t item_size) } -static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * data) +static inline bool osal_queue_send_isr(osal_queue_t const queue_hdl, void const * data) { return fifo_write( (fifo_t*) queue_hdl, data); } @@ -197,6 +197,8 @@ static inline osal_semaphore_t osal_semaphore_create(uint32_t max_count, uint32_ return sem_data; } +#define osal_semaphore_post_isr osal_semaphore_post + static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl) { if (sem_hdl->count < sem_hdl->max_count ) sem_hdl->count++;