diff options
| author | hathach <[email protected]> | 2020-09-07 15:19:20 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-09-07 15:19:20 +0700 |
| commit | 66a10ec9c8042a48053b4af67a932f3cfe9470c2 (patch) | |
| tree | a3f70a3ad963af7cedc9e533180a123265096811 /src/host/usbh.h | |
| parent | b3e81673c0582a07a764981604a560ee3d310ef9 (diff) | |
rework usbh control transfer
use series of complete callback instead of blocking semaphore, which is
more noOS friendly. still working with hid host
Diffstat (limited to 'src/host/usbh.h')
| -rw-r--r-- | src/host/usbh.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/host/usbh.h b/src/host/usbh.h index 91afb90a3..814770722 100644 --- a/src/host/usbh.h +++ b/src/host/usbh.h @@ -63,6 +63,8 @@ typedef struct { bool (* const xfer_cb) (uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes); void (* const close) (uint8_t); } usbh_class_driver_t; + +typedef bool (*tuh_control_complete_cb_t)(uint8_t dev_addr, tusb_control_request_t const * request, xfer_result_t result); //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ @@ -87,10 +89,12 @@ static inline bool tuh_device_is_configured(uint8_t dev_addr) return tuh_device_get_state(dev_addr) == TUSB_DEVICE_STATE_CONFIGURED; } +bool tuh_control_xfer (uint8_t dev_addr, tusb_control_request_t const* request, void* buffer, tuh_control_complete_cb_t complete_cb); + //--------------------------------------------------------------------+ // APPLICATION CALLBACK //--------------------------------------------------------------------+ -TU_ATTR_WEAK uint8_t tuh_attach_cb (tusb_desc_device_t const *desc_device); +//TU_ATTR_WEAK uint8_t tuh_attach_cb (tusb_desc_device_t const *desc_device); /** Callback invoked when device is mounted (configured) */ TU_ATTR_WEAK void tuh_mount_cb (uint8_t dev_addr); @@ -107,9 +111,6 @@ bool usbh_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes); - -bool tuh_control_xfer (uint8_t dev_addr, tusb_control_request_t const* request, uint8_t* buffer, uint16_t buflen); - #ifdef __cplusplus } #endif |
