diff --git a/class/adb/usbd_adb.c b/class/adb/usbd_adb.c index b193e35f..7629ea38 100644 --- a/class/adb/usbd_adb.c +++ b/class/adb/usbd_adb.c @@ -61,7 +61,7 @@ USB_NOCACHE_RAM_SECTION struct adb_packet rx_packet; static inline uint32_t adb_packet_checksum(struct adb_packet *packet) { uint32_t sum = 0; - int i; + uint32_t i; for (i = 0; i < packet->msg.data_length; ++i) { sum += (uint32_t)(packet->payload[i]); @@ -111,6 +111,8 @@ static void adb_send_close(struct adb_packet *packet, uint32_t localid, uint32_t void usbd_adb_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)ep; + if (adb_client.common_state == ADB_STATE_READ_MSG) { if (nbytes != sizeof(struct adb_msg)) { USB_LOG_ERR("invalid adb msg size:%d\r\n", nbytes); @@ -202,6 +204,9 @@ void usbd_adb_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) void usbd_adb_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)ep; + (void)nbytes; + if (adb_client.common_state == ADB_STATE_WRITE_MSG) { if (tx_packet.msg.data_length) { adb_client.common_state = ADB_STATE_WRITE_DATA; @@ -235,6 +240,8 @@ void usbd_adb_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) void adb_notify_handler(uint8_t busid, uint8_t event, void *arg) { + (void)arg; + switch (event) { case USBD_EVENT_INIT: break; @@ -255,6 +262,8 @@ void adb_notify_handler(uint8_t busid, uint8_t event, void *arg) struct usbd_interface *usbd_adb_init_intf(uint8_t busid, struct usbd_interface *intf, uint8_t in_ep, uint8_t out_ep) { + (void)busid; + intf->class_interface_handler = NULL; intf->class_endpoint_handler = NULL; intf->vendor_handler = NULL; diff --git a/class/audio/usbd_audio.c b/class/audio/usbd_audio.c index c78c8ed7..4ff3767a 100644 --- a/class/audio/usbd_audio.c +++ b/class/audio/usbd_audio.c @@ -62,7 +62,7 @@ static int audio_class_interface_request_handler(uint8_t busid, struct usb_setup setup->bRequest); uint8_t entity_id; - uint8_t ep; + uint8_t ep = 0; uint8_t subtype = 0x01; uint8_t control_selector; uint8_t ch; @@ -287,7 +287,7 @@ static void audio_notify_handler(uint8_t busid, uint8_t event, void *arg) } } -struct usbd_interface *usbd_audio_init_intf(uint8_t busid, +struct usbd_interface *usbd_audio_init_intf(uint8_t busid, struct usbd_interface *intf, uint16_t uac_version, struct audio_entity_info *table, @@ -314,31 +314,56 @@ struct usbd_interface *usbd_audio_init_intf(uint8_t busid, __WEAK void usbd_audio_set_volume(uint8_t busid, uint8_t ep, uint8_t ch, int volume) { + (void)busid; + (void)ep; + (void)ch; + (void)volume; } __WEAK int usbd_audio_get_volume(uint8_t busid, uint8_t ep, uint8_t ch) { + (void)busid; + (void)ep; + (void)ch; + return 0; } __WEAK void usbd_audio_set_mute(uint8_t busid, uint8_t ep, uint8_t ch, bool mute) { + (void)busid; + (void)ep; + (void)ch; + (void)mute; } __WEAK bool usbd_audio_get_mute(uint8_t busid, uint8_t ep, uint8_t ch) { + (void)busid; + (void)ep; + (void)ch; + return 0; } __WEAK void usbd_audio_set_sampling_freq(uint8_t busid, uint8_t ep, uint32_t sampling_freq) { + (void)busid; + (void)ep; + (void)sampling_freq; } __WEAK uint32_t usbd_audio_get_sampling_freq(uint8_t busid, uint8_t ep) { + (void)busid; + (void)ep; + return 0; } __WEAK void usbd_audio_get_sampling_freq_table(uint8_t busid, uint8_t ep, uint8_t **sampling_freq_table) { + (void)busid; + (void)ep; + (void)sampling_freq_table; } diff --git a/class/audio/usbh_audio.c b/class/audio/usbh_audio.c index 223c340b..2f067826 100644 --- a/class/audio/usbh_audio.c +++ b/class/audio/usbh_audio.c @@ -456,20 +456,26 @@ static int usbh_audio_ctrl_disconnect(struct usbh_hubport *hport, uint8_t intf) static int usbh_audio_data_connect(struct usbh_hubport *hport, uint8_t intf) { + (void)hport; + (void)intf; return 0; } static int usbh_audio_data_disconnect(struct usbh_hubport *hport, uint8_t intf) { + (void)hport; + (void)intf; return 0; } __WEAK void usbh_audio_run(struct usbh_audio *audio_class) { + (void)audio_class; } __WEAK void usbh_audio_stop(struct usbh_audio *audio_class) { + (void)audio_class; } const struct usbh_class_driver audio_ctrl_class_driver = { diff --git a/class/cdc/usbd_cdc_acm.c b/class/cdc/usbd_cdc_acm.c index 1ef83028..cf7c3c0d 100644 --- a/class/cdc/usbd_cdc_acm.c +++ b/class/cdc/usbd_cdc_acm.c @@ -85,6 +85,8 @@ static int cdc_acm_class_interface_request_handler(uint8_t busid, struct usb_set struct usbd_interface *usbd_cdc_acm_init_intf(uint8_t busid, struct usbd_interface *intf) { + (void)busid; + intf->class_interface_handler = cdc_acm_class_interface_request_handler; intf->class_endpoint_handler = NULL; intf->vendor_handler = NULL; @@ -95,10 +97,16 @@ struct usbd_interface *usbd_cdc_acm_init_intf(uint8_t busid, struct usbd_interfa __WEAK void usbd_cdc_acm_set_line_coding(uint8_t busid, uint8_t intf, struct cdc_line_coding *line_coding) { + (void)busid; + (void)intf; + (void)line_coding; } __WEAK void usbd_cdc_acm_get_line_coding(uint8_t busid, uint8_t intf, struct cdc_line_coding *line_coding) { + (void)busid; + (void)intf; + line_coding->dwDTERate = 2000000; line_coding->bDataBits = 8; line_coding->bParityType = 0; @@ -107,12 +115,20 @@ __WEAK void usbd_cdc_acm_get_line_coding(uint8_t busid, uint8_t intf, struct cdc __WEAK void usbd_cdc_acm_set_dtr(uint8_t busid, uint8_t intf, bool dtr) { + (void)busid; + (void)intf; + (void)dtr; } __WEAK void usbd_cdc_acm_set_rts(uint8_t busid, uint8_t intf, bool rts) { + (void)busid; + (void)intf; + (void)rts; } __WEAK void usbd_cdc_acm_send_break(uint8_t busid, uint8_t intf) { + (void)busid; + (void)intf; } diff --git a/class/cdc/usbd_cdc_ecm.c b/class/cdc/usbd_cdc_ecm.c index b0c1217d..29e82cee 100644 --- a/class/cdc/usbd_cdc_ecm.c +++ b/class/cdc/usbd_cdc_ecm.c @@ -79,6 +79,10 @@ static int cdc_ecm_class_interface_request_handler(uint8_t busid, struct usb_set "bRequest 0x%02x\r\n", setup->bRequest); + (void)busid; + (void)data; + (void)len; + g_cmd_intf = LO_BYTE(setup->wIndex); switch (setup->bRequest) { @@ -105,6 +109,9 @@ static int cdc_ecm_class_interface_request_handler(uint8_t busid, struct usb_set void cdc_ecm_notify_handler(uint8_t busid, uint8_t event, void *arg) { + (void)busid; + (void)arg; + switch (event) { case USBD_EVENT_RESET: g_current_net_status = 0; @@ -123,19 +130,23 @@ void cdc_ecm_notify_handler(uint8_t busid, uint8_t event, void *arg) void cdc_ecm_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)busid; + g_cdc_ecm_rx_data_length += nbytes; - if (nbytes < usbd_get_ep_mps(busid, ep)) { + if (nbytes < usbd_get_ep_mps(0, ep)) { g_cdc_ecm_rx_data_buffer = g_cdc_ecm_rx_buffer; usbd_cdc_ecm_data_recv_done(g_cdc_ecm_rx_buffer, g_cdc_ecm_rx_data_length); } else { - usbd_ep_start_read(0, ep, &g_cdc_ecm_rx_buffer[g_cdc_ecm_rx_data_length], usbd_get_ep_mps(busid, ep)); + usbd_ep_start_read(0, ep, &g_cdc_ecm_rx_buffer[g_cdc_ecm_rx_data_length], usbd_get_ep_mps(0, ep)); } } void cdc_ecm_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) { - if ((nbytes % usbd_get_ep_mps(busid, ep)) == 0 && nbytes) { + (void)busid; + + if ((nbytes % usbd_get_ep_mps(0, ep)) == 0 && nbytes) { /* send zlp */ usbd_ep_start_write(0, ep, NULL, 0); } else { @@ -145,6 +156,10 @@ void cdc_ecm_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) void cdc_ecm_int_in(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)busid; + (void)ep; + (void)nbytes; + if (g_current_net_status == 1) { g_current_net_status = 2; usbd_cdc_ecm_send_notify(CDC_ECM_NOTIFY_CODE_NETWORK_CONNECTION, CDC_ECM_NET_CONNECTED, g_connect_speed_table); @@ -242,4 +257,6 @@ void usbd_cdc_ecm_set_connect_speed(uint32_t speed[2]) __WEAK void usbd_cdc_ecm_data_recv_done(uint8_t *buf, uint32_t len) { + (void)buf; + (void)len; } diff --git a/class/cdc/usbh_cdc_acm.c b/class/cdc/usbh_cdc_acm.c index dc963d0c..957c6b2e 100644 --- a/class/cdc/usbh_cdc_acm.c +++ b/class/cdc/usbh_cdc_acm.c @@ -231,20 +231,26 @@ int usbh_cdc_acm_bulk_out_transfer(struct usbh_cdc_acm *cdc_acm_class, uint8_t * static int usbh_cdc_data_connect(struct usbh_hubport *hport, uint8_t intf) { + (void)hport; + (void)intf; return 0; } static int usbh_cdc_data_disconnect(struct usbh_hubport *hport, uint8_t intf) { + (void)hport; + (void)intf; return 0; } __WEAK void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class) { + (void)cdc_acm_class; } __WEAK void usbh_cdc_acm_stop(struct usbh_cdc_acm *cdc_acm_class) { + (void)cdc_acm_class; } const struct usbh_class_driver cdc_acm_class_driver = { diff --git a/class/cdc/usbh_cdc_ecm.c b/class/cdc/usbh_cdc_ecm.c index ad05d516..76cfb41a 100644 --- a/class/cdc/usbh_cdc_ecm.c +++ b/class/cdc/usbh_cdc_ecm.c @@ -236,6 +236,7 @@ void usbh_cdc_ecm_rx_thread(void *argument) uint32_t g_cdc_ecm_rx_length; int ret; + (void)argument; USB_LOG_INFO("Create cdc ecm rx thread\r\n"); // clang-format off find_class: @@ -306,10 +307,12 @@ int usbh_cdc_ecm_eth_output(uint32_t buflen) __WEAK void usbh_cdc_ecm_run(struct usbh_cdc_ecm *cdc_ecm_class) { + (void)cdc_ecm_class; } __WEAK void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class) { + (void)cdc_ecm_class; } const struct usbh_class_driver cdc_ecm_class_driver = { diff --git a/class/cdc/usbh_cdc_ncm.c b/class/cdc/usbh_cdc_ncm.c index e1300f73..2456fba5 100644 --- a/class/cdc/usbh_cdc_ncm.c +++ b/class/cdc/usbh_cdc_ncm.c @@ -259,6 +259,7 @@ void usbh_cdc_ncm_rx_thread(void *argument) uint32_t transfer_size = (16 * 1024); #endif + (void)argument; USB_LOG_INFO("Create cdc ncm rx thread\r\n"); // clang-format off find_class: @@ -386,10 +387,12 @@ int usbh_cdc_ncm_eth_output(uint32_t buflen) __WEAK void usbh_cdc_ncm_run(struct usbh_cdc_ncm *cdc_ncm_class) { + (void)cdc_ncm_class; } __WEAK void usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class) { + (void)cdc_ncm_class; } const struct usbh_class_driver cdc_ncm_class_driver = { diff --git a/class/hid/usbd_hid.c b/class/hid/usbd_hid.c index d98b82eb..fed749f2 100644 --- a/class/hid/usbd_hid.c +++ b/class/hid/usbd_hid.c @@ -50,6 +50,8 @@ static int hid_class_interface_request_handler(uint8_t busid, struct usb_setup_p struct usbd_interface *usbd_hid_init_intf(uint8_t busid, struct usbd_interface *intf, const uint8_t *desc, uint32_t desc_len) { + (void)busid; + intf->class_interface_handler = hid_class_interface_request_handler; intf->class_endpoint_handler = NULL; intf->vendor_handler = NULL; @@ -60,30 +62,65 @@ struct usbd_interface *usbd_hid_init_intf(uint8_t busid, struct usbd_interface * return intf; } +/* + * Appendix G: HID Request Support Requirements + * + * The following table enumerates the requests that need to be supported by various types of HID class devices. + * Device type GetReport SetReport GetIdle SetIdle GetProtocol SetProtocol + * ------------------------------------------------------------------------------------------ + * Boot Mouse Required Optional Optional Optional Required Required + * Non-Boot Mouse Required Optional Optional Optional Optional Optional + * Boot Keyboard Required Optional Required Required Required Required + * Non-Boot Keybrd Required Optional Required Required Optional Optional + * Other Device Required Optional Optional Optional Optional Optional + */ + __WEAK void usbd_hid_get_report(uint8_t busid, uint8_t intf, uint8_t report_id, uint8_t report_type, uint8_t **data, uint32_t *len) { + (void)busid; + (void)intf; + (void)report_id; + (void)report_type; (*data[0]) = 0; *len = 1; } __WEAK uint8_t usbd_hid_get_idle(uint8_t busid, uint8_t intf, uint8_t report_id) { + (void)busid; + (void)intf; + (void)report_id; return 0; } __WEAK uint8_t usbd_hid_get_protocol(uint8_t busid, uint8_t intf) { + (void)busid; + (void)intf; return 0; } __WEAK void usbd_hid_set_report(uint8_t busid, uint8_t intf, uint8_t report_id, uint8_t report_type, uint8_t *report, uint32_t report_len) { + (void)busid; + (void)intf; + (void)report_id; + (void)report_type; + (void)report; + (void)report_len; } __WEAK void usbd_hid_set_idle(uint8_t busid, uint8_t intf, uint8_t report_id, uint8_t duration) { + (void)busid; + (void)intf; + (void)report_id; + (void)duration; } __WEAK void usbd_hid_set_protocol(uint8_t busid, uint8_t intf, uint8_t protocol) { + (void)busid; + (void)intf; + (void)protocol; } \ No newline at end of file diff --git a/class/hid/usbh_hid.c b/class/hid/usbh_hid.c index a6129ef4..d2a25b30 100644 --- a/class/hid/usbh_hid.c +++ b/class/hid/usbh_hid.c @@ -297,10 +297,12 @@ int usbh_hid_disconnect(struct usbh_hubport *hport, uint8_t intf) __WEAK void usbh_hid_run(struct usbh_hid *hid_class) { + (void)hid_class; } __WEAK void usbh_hid_stop(struct usbh_hid *hid_class) { + (void)hid_class; } const struct usbh_class_driver hid_class_driver = { diff --git a/class/hub/usbh_hub.c b/class/hub/usbh_hub.c index d0974a02..a39a8d15 100644 --- a/class/hub/usbh_hub.c +++ b/class/hub/usbh_hub.c @@ -170,6 +170,8 @@ static int _usbh_hub_set_depth(struct usbh_hub *hub, uint16_t depth) #if CONFIG_USBHOST_MAX_EXTHUBS > 0 static int parse_hub_descriptor(struct usb_hub_descriptor *desc, uint16_t length) { + (void)length; + if (desc->bLength != USB_SIZEOF_HUB_DESC) { USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength); return -1; @@ -192,6 +194,8 @@ static int parse_hub_descriptor(struct usb_hub_descriptor *desc, uint16_t length static int parse_hub_ss_descriptor(struct usb_hub_ss_descriptor *desc, uint16_t length) { + (void)length; + if (desc->bLength < USB_SIZEOF_HUB_SS_DESC) { USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength); return -1; diff --git a/class/msc/usbd_msc.c b/class/msc/usbd_msc.c index 81f58dd9..b562f474 100644 --- a/class/msc/usbd_msc.c +++ b/class/msc/usbd_msc.c @@ -100,6 +100,8 @@ static int msc_storage_class_interface_request_handler(uint8_t busid, struct usb void msc_storage_notify_handler(uint8_t busid, uint8_t event, void *arg) { + (void)arg; + switch (event) { case USBD_EVENT_INIT: #if defined(CONFIG_USBDEV_MSC_THREAD) @@ -508,6 +510,9 @@ static bool SCSI_readCapacity10(uint8_t busid, uint8_t **data, uint32_t *len) static bool SCSI_read10(uint8_t busid, uint8_t **data, uint32_t *len) { + (void)data; + (void)len; + if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x80U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) { SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND); return false; @@ -542,6 +547,9 @@ static bool SCSI_read10(uint8_t busid, uint8_t **data, uint32_t *len) static bool SCSI_read12(uint8_t busid, uint8_t **data, uint32_t *len) { + (void)data; + (void)len; + if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x80U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) { SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND); return false; @@ -577,6 +585,10 @@ static bool SCSI_read12(uint8_t busid, uint8_t **data, uint32_t *len) static bool SCSI_write10(uint8_t busid, uint8_t **data, uint32_t *len) { uint32_t data_len = 0; + + (void)data; + (void)len; + if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x00U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) { SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND); return false; @@ -606,6 +618,10 @@ static bool SCSI_write10(uint8_t busid, uint8_t **data, uint32_t *len) static bool SCSI_write12(uint8_t busid, uint8_t **data, uint32_t *len) { uint32_t data_len = 0; + + (void)data; + (void)len; + if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x00U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) { SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND); return false; @@ -815,6 +831,8 @@ static bool SCSI_CBWDecode(uint8_t busid, uint32_t nbytes) void mass_storage_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)ep; + switch (g_usbd_msc[busid].stage) { case MSC_READ_CBW: if (SCSI_CBWDecode(busid, nbytes) == false) { @@ -850,6 +868,9 @@ void mass_storage_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) void mass_storage_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)ep; + (void)nbytes; + switch (g_usbd_msc[busid].stage) { case MSC_DATA_IN: switch (g_usbd_msc[busid].cbw.CB[0]) { diff --git a/class/msc/usbh_msc.c b/class/msc/usbh_msc.c index 8f420e75..773b0def 100644 --- a/class/msc/usbh_msc.c +++ b/class/msc/usbh_msc.c @@ -87,6 +87,8 @@ static void usbh_msc_cbw_dump(struct CBW *cbw) static void usbh_msc_csw_dump(struct CSW *csw) { + (void)csw; + USB_LOG_DBG("CSW:\r\n"); USB_LOG_DBG(" signature: 0x%08x\r\n", (unsigned int)csw->dSignature); USB_LOG_DBG(" tag: 0x%08x\r\n", (unsigned int)csw->dTag); @@ -421,10 +423,12 @@ void usbh_msc_modeswitch_enable(struct usbh_msc_modeswitch_config *config) __WEAK void usbh_msc_run(struct usbh_msc *msc_class) { + (void)msc_class; } __WEAK void usbh_msc_stop(struct usbh_msc *msc_class) { + (void)msc_class; } const struct usbh_class_driver msc_class_driver = { diff --git a/class/vendor/net/usbh_asix.c b/class/vendor/net/usbh_asix.c index 0b0f4ffc..cbc3c5d6 100644 --- a/class/vendor/net/usbh_asix.c +++ b/class/vendor/net/usbh_asix.c @@ -680,6 +680,7 @@ void usbh_asix_rx_thread(void *argument) uint32_t transfer_size = (16 * 1024); #endif + (void)argument; USB_LOG_INFO("Create asix rx thread\r\n"); // clang-format off find_class: @@ -791,10 +792,12 @@ int usbh_asix_eth_output(uint32_t buflen) __WEAK void usbh_asix_run(struct usbh_asix *asix_class) { + (void)asix_class; } __WEAK void usbh_asix_stop(struct usbh_asix *asix_class) { + (void)asix_class; } static const uint16_t asix_id_table[][2] = { diff --git a/class/vendor/net/usbh_rtl8152.c b/class/vendor/net/usbh_rtl8152.c index 905e226e..cbf7ea4f 100644 --- a/class/vendor/net/usbh_rtl8152.c +++ b/class/vendor/net/usbh_rtl8152.c @@ -2140,6 +2140,7 @@ void usbh_rtl8152_rx_thread(void *argument) uint32_t transfer_size = (16 * 1024); #endif + (void)argument; USB_LOG_INFO("Create rtl8152 rx thread\r\n"); // clang-format off find_class: @@ -2248,10 +2249,12 @@ int usbh_rtl8152_eth_output(uint32_t buflen) __WEAK void usbh_rtl8152_run(struct usbh_rtl8152 *rtl8152_class) { + (void)rtl8152_class; } __WEAK void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class) { + (void)rtl8152_class; } static const uint16_t rtl_id_table[][2] = { diff --git a/class/vendor/serial/usbh_ch34x.c b/class/vendor/serial/usbh_ch34x.c index 7c275e17..92cafde3 100644 --- a/class/vendor/serial/usbh_ch34x.c +++ b/class/vendor/serial/usbh_ch34x.c @@ -349,10 +349,12 @@ int usbh_ch34x_bulk_out_transfer(struct usbh_ch34x *ch34x_class, uint8_t *buffer __WEAK void usbh_ch34x_run(struct usbh_ch34x *ch34x_class) { + (void)ch34x_class; } __WEAK void usbh_ch34x_stop(struct usbh_ch34x *ch34x_class) { + (void)ch34x_class; } static const uint16_t ch34x_id_table[][2] = { diff --git a/class/vendor/serial/usbh_cp210x.c b/class/vendor/serial/usbh_cp210x.c index 4835f7ab..a82ee0f7 100644 --- a/class/vendor/serial/usbh_cp210x.c +++ b/class/vendor/serial/usbh_cp210x.c @@ -298,10 +298,12 @@ int usbh_cp210x_bulk_out_transfer(struct usbh_cp210x *cp210x_class, uint8_t *buf __WEAK void usbh_cp210x_run(struct usbh_cp210x *cp210x_class) { + (void)cp210x_class; } __WEAK void usbh_cp210x_stop(struct usbh_cp210x *cp210x_class) { + (void)cp210x_class; } static const uint16_t cp210x_id_table[][2] = { diff --git a/class/vendor/serial/usbh_ftdi.c b/class/vendor/serial/usbh_ftdi.c index 28c1c8ad..8b58138b 100644 --- a/class/vendor/serial/usbh_ftdi.c +++ b/class/vendor/serial/usbh_ftdi.c @@ -57,7 +57,7 @@ static void usbh_ftdi_caculate_baudrate(uint32_t *itdf_divisor, uint32_t actual_ } int divisor = FTDI_USB_CLK / baudrate; int frac_bits = 0; - for (int i = 0; i < sizeof(frac) / sizeof(frac[0]); i++) { + for (uint8_t i = 0; i < sizeof(frac) / sizeof(frac[0]); i++) { if ((divisor & 0xF) == frac[i]) { frac_bits = i; break; @@ -370,10 +370,12 @@ int usbh_ftdi_bulk_out_transfer(struct usbh_ftdi *ftdi_class, uint8_t *buffer, u __WEAK void usbh_ftdi_run(struct usbh_ftdi *ftdi_class) { + (void)ftdi_class; } __WEAK void usbh_ftdi_stop(struct usbh_ftdi *ftdi_class) { + (void)ftdi_class; } static const uint16_t ftdi_id_table[][2] = { diff --git a/class/vendor/serial/usbh_pl2303.c b/class/vendor/serial/usbh_pl2303.c index 98799427..5000b4d8 100644 --- a/class/vendor/serial/usbh_pl2303.c +++ b/class/vendor/serial/usbh_pl2303.c @@ -413,10 +413,12 @@ int usbh_pl2303_bulk_out_transfer(struct usbh_pl2303 *pl2303_class, uint8_t *buf __WEAK void usbh_pl2303_run(struct usbh_pl2303 *pl2303_class) { + (void)pl2303_class; } __WEAK void usbh_pl2303_stop(struct usbh_pl2303 *pl2303_class) { + (void)pl2303_class; } static const uint16_t pl2303_id_table[][2] = { diff --git a/class/vendor/wifi/usbh_bl616.c b/class/vendor/wifi/usbh_bl616.c index 6145a03d..34cbcf87 100644 --- a/class/vendor/wifi/usbh_bl616.c +++ b/class/vendor/wifi/usbh_bl616.c @@ -356,6 +356,7 @@ void usbh_bl616_rx_thread(void *argument) rnm_scan_ind_msg_t *scanmsg; uint8_t *data; + (void)argument; USB_LOG_INFO("Create bl616 wifi rx thread\r\n"); while (1) { @@ -473,15 +474,21 @@ int wifi_sta_connect(int argc, char **argv) int wifi_scan(int argc, char **argv) { + (void)argc; + (void)argv; + usbh_bl616_wifi_scan(); return 0; } + __WEAK void usbh_bl616_run(struct usbh_bl616 *bl616_class) { + (void)bl616_class; } __WEAK void usbh_bl616_stop(struct usbh_bl616 *bl616_class) { + (void)bl616_class; } static const uint16_t bl616_id_table[][2] = { diff --git a/class/video/usbd_video.c b/class/video/usbd_video.c index b11fa6ad..ee8ca5ee 100644 --- a/class/video/usbd_video.c +++ b/class/video/usbd_video.c @@ -24,6 +24,8 @@ static int usbd_video_control_request_handler(uint8_t busid, struct usb_setup_pa { uint8_t control_selector = (uint8_t)(setup->wValue >> 8); + (void)busid; + switch (control_selector) { case VIDEO_VC_VIDEO_POWER_MODE_CONTROL: switch (setup->bRequest) { diff --git a/class/video/usbh_video.c b/class/video/usbh_video.c index 0d3f79f7..c5458a40 100644 --- a/class/video/usbh_video.c +++ b/class/video/usbh_video.c @@ -495,20 +495,26 @@ static int usbh_video_ctrl_disconnect(struct usbh_hubport *hport, uint8_t intf) static int usbh_video_streaming_connect(struct usbh_hubport *hport, uint8_t intf) { + (void)hport; + (void)intf; return 0; } static int usbh_video_streaming_disconnect(struct usbh_hubport *hport, uint8_t intf) { + (void)hport; + (void)intf; return 0; } __WEAK void usbh_video_run(struct usbh_video *video_class) { + (void)video_class; } __WEAK void usbh_video_stop(struct usbh_video *video_class) { + (void)video_class; } const struct usbh_class_driver video_ctrl_class_driver = { diff --git a/class/wireless/usbd_rndis.c b/class/wireless/usbd_rndis.c index c357b25a..61bcd290 100644 --- a/class/wireless/usbd_rndis.c +++ b/class/wireless/usbd_rndis.c @@ -102,6 +102,8 @@ static void rndis_notify_rsp(void) static int rndis_class_interface_request_handler(uint8_t busid, struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) { + (void)busid; + switch (setup->bRequest) { case CDC_REQUEST_SEND_ENCAPSULATED_COMMAND: rndis_encapsulated_cmd_handler(*data, setup->wLength); @@ -152,6 +154,8 @@ static int rndis_init_cmd_handler(uint8_t *data, uint32_t len) rndis_initialize_msg_t *cmd = (rndis_initialize_msg_t *)data; rndis_initialize_cmplt_t *resp; + (void)len; + resp = ((rndis_initialize_cmplt_t *)rndis_encapsulated_resp_buffer); resp->RequestId = cmd->RequestId; resp->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT; @@ -177,6 +181,9 @@ static int rndis_halt_cmd_handler(uint8_t *data, uint32_t len) { rndis_halt_msg_t *resp; + (void)data; + (void)len; + resp = ((rndis_halt_msg_t *)rndis_encapsulated_resp_buffer); resp->MessageLength = 0; @@ -192,6 +199,8 @@ static int rndis_query_cmd_handler(uint8_t *data, uint32_t len) uint8_t *infomation_buffer; uint32_t infomation_len = 0; + (void)len; + resp = ((rndis_query_cmplt_t *)rndis_encapsulated_resp_buffer); resp->MessageType = REMOTE_NDIS_QUERY_CMPLT; resp->RequestId = cmd->RequestId; @@ -338,6 +347,8 @@ static int rndis_set_cmd_handler(uint8_t *data, uint32_t len) rndis_set_cmplt_t *resp; rndis_config_parameter_t *param; + (void)len; + resp = ((rndis_set_cmplt_t *)rndis_encapsulated_resp_buffer); resp->RequestId = cmd->RequestId; resp->MessageType = REMOTE_NDIS_SET_CMPLT; @@ -394,6 +405,9 @@ static int rndis_reset_cmd_handler(uint8_t *data, uint32_t len) // rndis_reset_msg_t *cmd = (rndis_reset_msg_t *)data; rndis_reset_cmplt_t *resp; + (void)data; + (void)len; + resp = ((rndis_reset_cmplt_t *)rndis_encapsulated_resp_buffer); resp->MessageType = REMOTE_NDIS_RESET_CMPLT; resp->MessageLength = sizeof(rndis_reset_cmplt_t); @@ -412,6 +426,8 @@ static int rndis_keepalive_cmd_handler(uint8_t *data, uint32_t len) rndis_keepalive_msg_t *cmd = (rndis_keepalive_msg_t *)data; rndis_keepalive_cmplt_t *resp; + (void)len; + resp = ((rndis_keepalive_cmplt_t *)rndis_encapsulated_resp_buffer); resp->RequestId = cmd->RequestId; resp->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT; @@ -425,6 +441,9 @@ static int rndis_keepalive_cmd_handler(uint8_t *data, uint32_t len) static void rndis_notify_handler(uint8_t busid, uint8_t event, void *arg) { + (void)busid; + (void)arg; + switch (event) { case USBD_EVENT_RESET: g_usbd_rndis.link_status = NDIS_MEDIA_STATE_DISCONNECTED; @@ -445,6 +464,9 @@ void rndis_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) { rndis_data_packet_t *hdr; + (void)busid; + (void)ep; + hdr = (rndis_data_packet_t *)g_rndis_rx_buffer; g_rndis_rx_data_buffer = g_rndis_rx_buffer; if ((hdr->MessageType != REMOTE_NDIS_PACKET_MSG) || (nbytes < hdr->MessageLength)) { @@ -461,7 +483,9 @@ void rndis_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) void rndis_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) { - if ((nbytes % usbd_get_ep_mps(busid, ep)) == 0 && nbytes) { + (void)busid; + + if ((nbytes % usbd_get_ep_mps(0, ep)) == 0 && nbytes) { /* send zlp */ usbd_ep_start_write(0, ep, NULL, 0); } else { @@ -471,6 +495,10 @@ void rndis_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) void rndis_int_in(uint8_t busid, uint8_t ep, uint32_t nbytes) { + (void)busid; + (void)ep; + (void)nbytes; + //USB_LOG_DBG("len:%d\r\n", nbytes); } diff --git a/class/wireless/usbh_bluetooth.c b/class/wireless/usbh_bluetooth.c index e73eeb03..9f78866a 100644 --- a/class/wireless/usbh_bluetooth.c +++ b/class/wireless/usbh_bluetooth.c @@ -365,14 +365,18 @@ delete : __WEAK void usbh_bluetooth_hci_read_callback(uint8_t *data, uint32_t len) { + (void)data; + (void)len; } __WEAK void usbh_bluetooth_run(struct usbh_bluetooth *bluetooth_class) { + (void)bluetooth_class; } __WEAK void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class) { + (void)bluetooth_class; } static const struct usbh_class_driver bluetooth_class_driver = { diff --git a/class/wireless/usbh_rndis.c b/class/wireless/usbh_rndis.c index 5e5b85fb..2b45fb1a 100644 --- a/class/wireless/usbh_rndis.c +++ b/class/wireless/usbh_rndis.c @@ -26,6 +26,7 @@ static struct usbh_rndis g_rndis_class; static int usbh_rndis_get_notification(struct usbh_rndis *rndis_class) { + (void)rndis_class; // int ret; // struct usbh_urb *urb = &rndis_class->intin_urb; @@ -460,6 +461,8 @@ void usbh_rndis_rx_thread(void *argument) uint32_t transfer_size = (16 * 1024); #endif + (void)argument; + USB_LOG_INFO("Create rndis rx thread\r\n"); // clang-format off find_class: @@ -581,10 +584,12 @@ int usbh_rndis_eth_output(uint32_t buflen) __WEAK void usbh_rndis_run(struct usbh_rndis *rndis_class) { + (void)rndis_class; } __WEAK void usbh_rndis_stop(struct usbh_rndis *rndis_class) { + (void)rndis_class; } static const struct usbh_class_driver rndis_class_driver = { diff --git a/common/usb_log.h b/common/usb_log.h index 9a0146de..9074ed97 100644 --- a/common/usb_log.h +++ b/common/usb_log.h @@ -86,7 +86,7 @@ void usb_assert(const char *filename, int linenum); static inline void usb_hexdump(const void *ptr, uint32_t buflen) { unsigned char *buf = (unsigned char *)ptr; - int i, j; + uint32_t i, j; for (i = 0; i < buflen; i += 16) { CONFIG_USB_PRINTF("%08X:", i); diff --git a/core/usbd_core.c b/core/usbd_core.c index 318e0267..8eda36f4 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -1186,6 +1186,8 @@ void usbd_event_ep0_in_complete_handler(uint8_t busid, uint8_t ep, uint32_t nbyt { struct usb_setup_packet *setup = &g_usbd_core[busid].setup; + (void)ep; + g_usbd_core[busid].ep0_data_buf += nbytes; g_usbd_core[busid].ep0_data_buf_residue -= nbytes; @@ -1225,6 +1227,8 @@ void usbd_event_ep0_out_complete_handler(uint8_t busid, uint8_t ep, uint32_t nby { struct usb_setup_packet *setup = &g_usbd_core[busid].setup; + (void)ep; + if (nbytes > 0) { g_usbd_core[busid].ep0_data_buf += nbytes; g_usbd_core[busid].ep0_data_buf_residue -= nbytes; diff --git a/core/usbd_core.h b/core/usbd_core.h index ab7be7f1..f50432a7 100644 --- a/core/usbd_core.h +++ b/core/usbd_core.h @@ -72,7 +72,7 @@ struct usb_descriptor { const char *(*string_descriptor_callback)(uint8_t speed, uint8_t index); const struct usb_msosv1_descriptor *msosv1_descriptor; const struct usb_msosv2_descriptor *msosv2_descriptor; - const struct usb_webusb_url_ex_descriptor *webusb_url_descriptor; + const struct usb_webusb_descriptor *webusb_url_descriptor; const struct usb_bos_descriptor *bos_descriptor; }; diff --git a/demo/usb_host.c b/demo/usb_host.c index 8c8ac22a..71984188 100644 --- a/demo/usb_host.c +++ b/demo/usb_host.c @@ -120,7 +120,7 @@ void usbh_hid_callback(void *arg, int nbytes) struct usbh_hid *hid_class = (struct usbh_hid *)arg; if (nbytes > 0) { - for (size_t i = 0; i < nbytes; i++) { + for (int i = 0; i < nbytes; i++) { USB_LOG_RAW("0x%02x ", hid_buffer[i]); } USB_LOG_RAW("nbytes:%d\r\n", nbytes); diff --git a/osal/idf/usb_osal_idf.c b/osal/idf/usb_osal_idf.c index f85aba2e..73cd306a 100644 --- a/osal/idf/usb_osal_idf.c +++ b/osal/idf/usb_osal_idf.c @@ -128,6 +128,7 @@ static void __usb_timeout(TimerHandle_t *handle) struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_ms, usb_timer_handler_t handler, void *argument, bool is_period) { struct usb_osal_timer *timer; + (void)name; timer = pvPortMalloc(sizeof(struct usb_osal_timer)); diff --git a/osal/usb_osal_freertos.c b/osal/usb_osal_freertos.c index 7f1aafad..490366a3 100644 --- a/osal/usb_osal_freertos.c +++ b/osal/usb_osal_freertos.c @@ -126,6 +126,7 @@ static void __usb_timeout(TimerHandle_t *handle) struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_ms, usb_timer_handler_t handler, void *argument, bool is_period) { struct usb_osal_timer *timer; + (void)name; timer = pvPortMalloc(sizeof(struct usb_osal_timer)); diff --git a/osal/usb_osal_nuttx.c b/osal/usb_osal_nuttx.c index 51018cd5..c62c7389 100644 --- a/osal/usb_osal_nuttx.c +++ b/osal/usb_osal_nuttx.c @@ -310,6 +310,9 @@ static void os_timer_callback(wdparm_t arg) struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_ms, usb_timer_handler_t handler, void *argument, bool is_period) { struct timer_adpt *timer = kmm_malloc(sizeof(struct timer_adpt)); + + (void)name; + if (!timer) { return NULL; } diff --git a/osal/usb_osal_rtthread.c b/osal/usb_osal_rtthread.c index 5b06fbf2..e8cbce3a 100644 --- a/osal/usb_osal_rtthread.c +++ b/osal/usb_osal_rtthread.c @@ -129,7 +129,7 @@ struct usb_osal_timer *usb_osal_timer_create(const char *name, uint32_t timeout_ timer = rt_malloc(sizeof(struct usb_osal_timer)); memset(timer, 0, sizeof(struct usb_osal_timer)); - timer->timer = (void *)rt_timer_create("usb_tim", handler, argument, timeout_ms, is_period ? (RT_TIMER_FLAG_PERIODIC | RT_TIMER_FLAG_SOFT_TIMER) : (RT_TIMER_FLAG_ONE_SHOT | RT_TIMER_FLAG_SOFT_TIMER)); + timer->timer = (void *)rt_timer_create(name, handler, argument, timeout_ms, is_period ? (RT_TIMER_FLAG_PERIODIC | RT_TIMER_FLAG_SOFT_TIMER) : (RT_TIMER_FLAG_ONE_SHOT | RT_TIMER_FLAG_SOFT_TIMER)); if (timer->timer == NULL) { return NULL; } diff --git a/platform/none/usbh_lwip.c b/platform/none/usbh_lwip.c index ea26f747..9dd18822 100644 --- a/platform/none/usbh_lwip.c +++ b/platform/none/usbh_lwip.c @@ -114,6 +114,7 @@ struct netif g_cdc_ecm_netif; static err_t usbh_cdc_ecm_linkoutput(struct netif *netif, struct pbuf *p) { int ret; + (void)netif; usbh_lwip_eth_output_common(p, usbh_cdc_ecm_get_eth_txbuf()); ret = usbh_cdc_ecm_eth_output(p->tot_len); @@ -176,6 +177,8 @@ void usbh_cdc_ecm_run(struct usbh_cdc_ecm *cdc_ecm_class) void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class) { struct netif *netif = &g_cdc_ecm_netif; + (void)cdc_ecm_class; + #if LWIP_DHCP dhcp_stop(netif); dhcp_cleanup(netif); @@ -216,6 +219,7 @@ struct netif g_rndis_netif; static err_t usbh_rndis_linkoutput(struct netif *netif, struct pbuf *p) { int ret; + (void)netif; usbh_lwip_eth_output_common(p, usbh_rndis_get_eth_txbuf()); ret = usbh_rndis_eth_output(p->tot_len); @@ -281,6 +285,8 @@ void usbh_rndis_run(struct usbh_rndis *rndis_class) void usbh_rndis_stop(struct usbh_rndis *rndis_class) { struct netif *netif = &g_rndis_netif; + (void)rndis_class; + #if LWIP_DHCP dhcp_stop(netif); dhcp_cleanup(netif); @@ -302,6 +308,7 @@ struct netif g_cdc_ncm_netif; static err_t usbh_cdc_ncm_linkoutput(struct netif *netif, struct pbuf *p) { int ret; + (void)netif; usbh_lwip_eth_output_common(p, usbh_cdc_ncm_get_eth_txbuf()); ret = usbh_cdc_ncm_eth_output(p->tot_len); @@ -364,6 +371,8 @@ void usbh_cdc_ncm_run(struct usbh_cdc_ncm *cdc_ncm_class) void usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class) { struct netif *netif = &g_cdc_ncm_netif; + (void)cdc_ncm_class; + #if LWIP_DHCP dhcp_stop(netif); dhcp_cleanup(netif); @@ -383,6 +392,7 @@ struct netif g_asix_netif; static err_t usbh_asix_linkoutput(struct netif *netif, struct pbuf *p) { int ret; + (void)netif; usbh_lwip_eth_output_common(p, usbh_asix_get_eth_txbuf()); ret = usbh_asix_eth_output(p->tot_len); @@ -445,6 +455,8 @@ void usbh_asix_run(struct usbh_asix *asix_class) void usbh_asix_stop(struct usbh_asix *asix_class) { struct netif *netif = &g_asix_netif; + (void)asix_class; + #if LWIP_DHCP dhcp_stop(netif); dhcp_cleanup(netif); @@ -464,6 +476,7 @@ struct netif g_rtl8152_netif; static err_t usbh_rtl8152_linkoutput(struct netif *netif, struct pbuf *p) { int ret; + (void)netif; usbh_lwip_eth_output_common(p, usbh_rtl8152_get_eth_txbuf()); ret = usbh_rtl8152_eth_output(p->tot_len); @@ -526,6 +539,8 @@ void usbh_rtl8152_run(struct usbh_rtl8152 *rtl8152_class) void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class) { struct netif *netif = &g_rtl8152_netif; + (void)rtl8152_class; + #if LWIP_DHCP dhcp_stop(netif); dhcp_cleanup(netif); @@ -544,6 +559,7 @@ struct netif g_bl616_netif; static err_t usbh_bl616_linkoutput(struct netif *netif, struct pbuf *p) { int ret; + (void)netif; usbh_lwip_eth_output_common(p, usbh_bl616_get_eth_txbuf()); ret = usbh_bl616_eth_output(p->tot_len); @@ -583,6 +599,7 @@ void usbh_bl616_sta_disconnect_callback(void) netif_set_down(netif); } + void usbh_bl616_sta_update_ip(uint8_t ip4_addr[4], uint8_t ip4_mask[4], uint8_t ip4_gw[4]) { struct netif *netif = &g_bl616_netif; @@ -593,6 +610,7 @@ void usbh_bl616_sta_update_ip(uint8_t ip4_addr[4], uint8_t ip4_mask[4], uint8_t netif_set_up(netif); } + void usbh_bl616_run(struct usbh_bl616 *bl616_class) { struct netif *netif = &g_bl616_netif; @@ -623,6 +641,8 @@ void usbh_bl616_stop(struct usbh_bl616 *bl616_class) { struct netif *netif = &g_bl616_netif; + (void)bl616_class; + netif_set_down(netif); netif_remove(netif); } diff --git a/platform/rtthread/usbh_lwip.c b/platform/rtthread/usbh_lwip.c index 360a8489..074010af 100644 --- a/platform/rtthread/usbh_lwip.c +++ b/platform/rtthread/usbh_lwip.c @@ -118,6 +118,7 @@ static rt_err_t rt_usbh_cdc_ecm_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_usbh_cdc_ecm_eth_tx(rt_device_t dev, struct pbuf *p) { int ret; + (void)dev; usbh_lwip_eth_output_common(p, usbh_cdc_ecm_get_eth_txbuf()); ret = usbh_cdc_ecm_eth_output(p->tot_len); @@ -150,6 +151,8 @@ void usbh_cdc_ecm_run(struct usbh_cdc_ecm *cdc_ecm_class) void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class) { + (void)cdc_ecm_class; + eth_device_deinit(&g_cdc_ecm_dev); } #endif @@ -204,6 +207,7 @@ static rt_err_t rt_usbh_rndis_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_usbh_rndis_eth_tx(rt_device_t dev, struct pbuf *p) { int ret; + (void)dev; usbh_lwip_eth_output_common(p, usbh_rndis_get_eth_txbuf()); ret = usbh_rndis_eth_output(p->tot_len); @@ -237,6 +241,8 @@ void usbh_rndis_run(struct usbh_rndis *rndis_class) void usbh_rndis_stop(struct usbh_rndis *rndis_class) { + (void)rndis_class; + eth_device_deinit(&g_rndis_dev); // rt_timer_stop(keep_timer); // rt_timer_delete(keep_timer); @@ -273,6 +279,7 @@ static rt_err_t rt_usbh_cdc_ncm_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_usbh_cdc_ncm_eth_tx(rt_device_t dev, struct pbuf *p) { int ret; + (void)dev; usbh_lwip_eth_output_common(p, usbh_cdc_ncm_get_eth_txbuf()); ret = usbh_cdc_ncm_eth_output(p->tot_len); @@ -305,6 +312,8 @@ void usbh_cdc_ncm_run(struct usbh_cdc_ncm *cdc_ncm_class) void usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class) { + (void)cdc_ncm_class; + eth_device_deinit(&g_cdc_ncm_dev); } #endif @@ -339,6 +348,7 @@ static rt_err_t rt_usbh_asix_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_usbh_asix_eth_tx(rt_device_t dev, struct pbuf *p) { int ret; + (void)dev; usbh_lwip_eth_output_common(p, usbh_asix_get_eth_txbuf()); ret = usbh_asix_eth_output(p->tot_len); @@ -371,6 +381,8 @@ void usbh_asix_run(struct usbh_asix *asix_class) void usbh_asix_stop(struct usbh_asix *asix_class) { + (void)asix_class; + eth_device_deinit(&g_asix_dev); } #endif @@ -405,6 +417,7 @@ static rt_err_t rt_usbh_rtl8152_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_usbh_rtl8152_eth_tx(rt_device_t dev, struct pbuf *p) { int ret; + (void)dev; usbh_lwip_eth_output_common(p, usbh_rtl8152_get_eth_txbuf()); ret = usbh_rtl8152_eth_output(p->tot_len); @@ -437,6 +450,8 @@ void usbh_rtl8152_run(struct usbh_rtl8152 *rtl8152_class) void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class) { + (void)rtl8152_class; + eth_device_deinit(&g_rtl8152_dev); } #endif diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index d9c42261..3171f60e 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -442,10 +442,12 @@ static void dwc2_iso_urb_init(struct usbh_bus *bus, uint8_t chidx, struct usbh_u __WEAK void usb_hc_low_level_init(struct usbh_bus *bus) { + (void)bus; } __WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus) { + (void)bus; } int usb_hc_init(struct usbh_bus *bus) diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c index cade2dde..2e75fae6 100644 --- a/port/ehci/usb_hc_ehci.c +++ b/port/ehci/usb_hc_ehci.c @@ -167,6 +167,7 @@ static void ehci_qh_fill(struct ehci_qh_hw *qh, switch (speed) { case USB_SPEED_LOW: epchar |= QH_EPCHAR_EPS_LOW; + __attribute__((fallthrough)); case USB_SPEED_FULL: if (ep_type == USB_ENDPOINT_TYPE_CONTROL) { epchar |= QH_EPCHAR_C; /* for TT */ @@ -379,7 +380,7 @@ static struct ehci_qh_hw *ehci_bulk_urb_init(struct usbh_bus *bus, struct usbh_u urb->hport->parent->hub_addr, urb->hport->port); - while (buflen >= 0) { + while (1) { qtd = &qh->qtd_pool[qtd_num]; if (buflen > 0x4000) { @@ -480,7 +481,7 @@ static struct ehci_qh_hw *ehci_intr_urb_init(struct usbh_bus *bus, struct usbh_u urb->hport->parent->hub_addr, urb->hport->port); - while (buflen >= 0) { + while (1) { qtd = &qh->qtd_pool[qtd_num]; if (buflen > 0x4000) { @@ -583,6 +584,8 @@ static void ehci_qh_scan_qtds(struct usbh_bus *bus, struct ehci_qh_hw *qhead, st { struct ehci_qtd_hw *qtd; + (void)bus; + ehci_qh_remove(qhead, qh); qtd = EHCI_ADDR2QTD(qh->first_qtd); @@ -655,6 +658,8 @@ static void ehci_kill_qh(struct usbh_bus *bus, struct ehci_qh_hw *qhead, struct { struct ehci_qtd_hw *qtd; + (void)bus; + ehci_qh_remove(qhead, qh); qtd = EHCI_ADDR2QTD(qh->first_qtd); @@ -697,14 +702,17 @@ static int usbh_reset_port(struct usbh_bus *bus, const uint8_t port) __WEAK void usb_hc_low_level_init(struct usbh_bus *bus) { + (void)bus; } __WEAK void usb_hc_low_level2_init(struct usbh_bus *bus) { + (void)bus; } __WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus) { + (void)bus; } int usb_hc_init(struct usbh_bus *bus) diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index 131dbb52..39c787f8 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -475,10 +475,12 @@ static void musb_pipe_free(struct musb_pipe *pipe) __WEAK void usb_hc_low_level_init(struct usbh_bus *bus) { + (void)bus; } __WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus) { + (void)bus; } int usb_hc_init(struct usbh_bus *bus)