mirror of
https://github.com/hathach/tinyusb.git
synced 2026-04-25 08:04:11 +00:00
Merge pull request #3569 from hathach/revert-3565-driver-init
Revert "Make driver init() function optional"
This commit is contained in:
@ -189,13 +189,13 @@ Class Driver Interface
|
||||
See ``usbd.c``.
|
||||
|
||||
**Required Functions**:
|
||||
- ``init()``: Initialize class driver
|
||||
- ``reset()``: Reset class state
|
||||
- ``open()``: Configure class endpoints
|
||||
- ``control_xfer_cb()``: Handle control requests
|
||||
- ``xfer_cb()``: Handle data transfer completion
|
||||
|
||||
**Optional Functions**:
|
||||
- ``init()``: Initialize class driver
|
||||
- ``close()``: Clean up class resources
|
||||
- ``deinit()``: Deinitialize class driver
|
||||
- ``sof()``: Start-of-frame processing
|
||||
|
||||
@ -572,10 +572,9 @@ bool tud_rhport_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
|
||||
// Init class drivers
|
||||
for (uint8_t i = 0; i < TOTAL_DRIVER_COUNT; i++) {
|
||||
usbd_class_driver_t const* driver = get_driver(i);
|
||||
if (driver && driver->init) {
|
||||
TU_LOG_USBD("%s init\r\n", driver->name);
|
||||
driver->init();
|
||||
}
|
||||
TU_ASSERT(driver && driver->init);
|
||||
TU_LOG_USBD("%s init\r\n", driver->name);
|
||||
driver->init();
|
||||
}
|
||||
|
||||
_usbd_rhport = rhport;
|
||||
|
||||
@ -544,7 +544,7 @@ bool tuh_rhport_init(uint8_t rhport, const tusb_rhport_init_t* rh_init) {
|
||||
// Class drivers
|
||||
for (uint8_t drv_id = 0; drv_id < TOTAL_DRIVER_COUNT; drv_id++) {
|
||||
usbh_class_driver_t const* driver = get_driver(drv_id);
|
||||
if (driver && driver->init) {
|
||||
if (driver != NULL) {
|
||||
TU_LOG_USBH("%s init\r\n", driver->name);
|
||||
driver->init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user