diff options
| author | IngHK <[email protected]> | 2023-12-08 16:44:58 +0100 |
|---|---|---|
| committer | IngHK <[email protected]> | 2023-12-08 16:44:58 +0100 |
| commit | 4d88f146e3a79ca4e7c7bbba2cdd6b8f3b07537a (patch) | |
| tree | d3e7eed808967619fd880e4425256f8e1cc6de6e /src/host/usbh.c | |
| parent | b8881a3a141530a1d383d8869881e773b8a07d80 (diff) | |
| parent | 338ff2daba63fc60835934efc374c818f7c5980c (diff) | |
Merge remote-tracking branch 'remotes/hathach/master' into HostLogsFixes
Diffstat (limited to 'src/host/usbh.c')
| -rw-r--r-- | src/host/usbh.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index 78c8abfbd..4d30d9f81 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -247,9 +247,7 @@ CFG_TUH_MEM_SECTION struct //------------- Helper Function -------------// -TU_ATTR_ALWAYS_INLINE -static inline usbh_device_t* get_device(uint8_t dev_addr) -{ +TU_ATTR_ALWAYS_INLINE static inline usbh_device_t* get_device(uint8_t dev_addr) { TU_VERIFY(dev_addr > 0 && dev_addr <= TOTAL_DEVICES, NULL); return &_usbh_devices[dev_addr-1]; } @@ -268,6 +266,12 @@ TU_ATTR_WEAK void osal_task_delay(uint32_t msec) { } #endif +TU_ATTR_ALWAYS_INLINE static inline bool queue_event(hcd_event_t const * event, bool in_isr) { + bool ret = osal_queue_send(_usbh_q, event, in_isr); + if (tuh_event_hook_cb) tuh_event_hook_cb(event->rhport, event->event_id, in_isr); + return ret; +} + //--------------------------------------------------------------------+ // Device API //--------------------------------------------------------------------+ @@ -433,7 +437,7 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr) { TU_LOG_USBH("[%u:] USBH Defer Attach until current enumeration complete\r\n", event.rhport); bool is_empty = osal_queue_empty(_usbh_q); - osal_queue_send(_usbh_q, &event, in_isr); + queue_event(&event, in_isr); if (is_empty) { // Exit if this is the only event in the queue, otherwise we may loop forever @@ -779,7 +783,7 @@ void usbh_defer_func(osal_task_func_t func, void *param, bool in_isr) { event.func_call.func = func; event.func_call.param = param; - osal_queue_send(_usbh_q, &event, in_isr); + queue_event(&event, in_isr); } //--------------------------------------------------------------------+ @@ -935,7 +939,7 @@ TU_ATTR_FAST_FUNC void hcd_event_handler(hcd_event_t const* event, bool in_isr) default: break; } - osal_queue_send(_usbh_q, event, in_isr); + queue_event(event, in_isr); } //--------------------------------------------------------------------+ |
