diff options
| author | hathach <[email protected]> | 2023-09-07 12:38:18 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-09-07 12:38:18 +0700 |
| commit | 21ab40bab2e2fee28fa595f648a17944696c3d65 (patch) | |
| tree | b91f251872cb3e4cd928fba4e586d821f3aa7718 /src/host/usbh.c | |
| parent | 1b9108ea0dc237835e801d26cc7eef052acad987 (diff) | |
- wrap up hcd max3421, work well with nrf52840
- also add usbh_defer_func()
Diffstat (limited to 'src/host/usbh.c')
| -rw-r--r-- | src/host/usbh.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index e60e680c2..e332f35cc 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -753,29 +753,33 @@ bool tuh_edpt_abort_xfer(uint8_t daddr, uint8_t ep_addr) { // USBH API For Class Driver //--------------------------------------------------------------------+ -uint8_t usbh_get_rhport(uint8_t dev_addr) -{ - usbh_device_t* dev = get_device(dev_addr); +uint8_t usbh_get_rhport(uint8_t dev_addr) { + usbh_device_t *dev = get_device(dev_addr); return dev ? dev->rhport : _dev0.rhport; } -uint8_t* usbh_get_enum_buf(void) -{ +uint8_t *usbh_get_enum_buf(void) { return _usbh_ctrl_buf; } -void usbh_int_set(bool enabled) -{ +void usbh_int_set(bool enabled) { // TODO all host controller if multiple are used since they shared the same event queue - if (enabled) - { + if (enabled) { hcd_int_enable(_usbh_controller); - }else - { + } else { hcd_int_disable(_usbh_controller); } } +void usbh_defer_func(osal_task_func_t func, void *param, bool in_isr) { + hcd_event_t event = { 0 }; + event.event_id = USBH_EVENT_FUNC_CALL; + event.func_call.func = func; + event.func_call.param = param; + + osal_queue_send(_usbh_q, &event, in_isr); +} + //--------------------------------------------------------------------+ // Endpoint API //--------------------------------------------------------------------+ |
