diff options
| author | Ha Thach <[email protected]> | 2025-09-27 20:38:03 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-27 20:38:03 +0700 |
| commit | 152d25ed621393a991561b7de61c2f01bbadeb71 (patch) | |
| tree | 7a75a0a3da032421907e26616f67f7f1d55b2d09 /src/device/usbd.c | |
| parent | 1f9c41566165b23ff573bf1b9bfd077cfbe9067f (diff) | |
| parent | 0655f98359de7e9299d8047d94a1087bdd3618ac (diff) | |
Merge pull request #3256 from hathach/weak_cb
Migrate weak function override to new syntax, update delay api usage
Diffstat (limited to 'src/device/usbd.c')
| -rw-r--r-- | src/device/usbd.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index b09d02fbd..b1aef0b38 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -393,6 +393,18 @@ void usbd_control_set_request(tusb_control_request_t const *request); void usbd_control_set_complete_callback( usbd_control_xfer_cb_t fp ); bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); +//--------------------------------------------------------------------+ +// Weak stubs: invoked if no strong implementation is available +//--------------------------------------------------------------------+ +TU_ATTR_WEAK usbd_class_driver_t const* usbd_app_driver_get_cb(uint8_t* driver_count) { + *driver_count = 0; + return NULL; +} + +TU_ATTR_WEAK bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) { + (void) rhport; (void) ep_addr; (void) ff; (void) total_bytes; + return false; +} //--------------------------------------------------------------------+ // Debug @@ -516,10 +528,8 @@ bool tud_rhport_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) { TU_ASSERT(_usbd_q); // Get application driver if available - if (usbd_app_driver_get_cb) { - _app_driver = usbd_app_driver_get_cb(&_app_driver_count); - TU_ASSERT(_app_driver_count + BUILTIN_DRIVER_COUNT <= UINT8_MAX); - } + _app_driver = usbd_app_driver_get_cb(&_app_driver_count); + TU_ASSERT(_app_driver_count + BUILTIN_DRIVER_COUNT <= UINT8_MAX); // Init class drivers for (uint8_t i = 0; i < TOTAL_DRIVER_COUNT; i++) { |
