mirror of
https://github.com/sakumisu/CherryUSB.git
synced 2025-05-09 00:21:44 +08:00
fix: fix -Wunused-parameter warning with -Wextra cflag
This commit is contained in:
parent
43dc854b4d
commit
35da8d6747
@ -61,7 +61,7 @@ USB_NOCACHE_RAM_SECTION struct adb_packet rx_packet;
|
|||||||
static inline uint32_t adb_packet_checksum(struct adb_packet *packet)
|
static inline uint32_t adb_packet_checksum(struct adb_packet *packet)
|
||||||
{
|
{
|
||||||
uint32_t sum = 0;
|
uint32_t sum = 0;
|
||||||
int i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < packet->msg.data_length; ++i) {
|
for (i = 0; i < packet->msg.data_length; ++i) {
|
||||||
sum += (uint32_t)(packet->payload[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 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 (adb_client.common_state == ADB_STATE_READ_MSG) {
|
||||||
if (nbytes != sizeof(struct adb_msg)) {
|
if (nbytes != sizeof(struct adb_msg)) {
|
||||||
USB_LOG_ERR("invalid adb msg size:%d\r\n", nbytes);
|
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 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 (adb_client.common_state == ADB_STATE_WRITE_MSG) {
|
||||||
if (tx_packet.msg.data_length) {
|
if (tx_packet.msg.data_length) {
|
||||||
adb_client.common_state = ADB_STATE_WRITE_DATA;
|
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 adb_notify_handler(uint8_t busid, uint8_t event, void *arg)
|
||||||
{
|
{
|
||||||
|
(void)arg;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case USBD_EVENT_INIT:
|
case USBD_EVENT_INIT:
|
||||||
break;
|
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)
|
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_interface_handler = NULL;
|
||||||
intf->class_endpoint_handler = NULL;
|
intf->class_endpoint_handler = NULL;
|
||||||
intf->vendor_handler = NULL;
|
intf->vendor_handler = NULL;
|
||||||
|
@ -62,7 +62,7 @@ static int audio_class_interface_request_handler(uint8_t busid, struct usb_setup
|
|||||||
setup->bRequest);
|
setup->bRequest);
|
||||||
|
|
||||||
uint8_t entity_id;
|
uint8_t entity_id;
|
||||||
uint8_t ep;
|
uint8_t ep = 0;
|
||||||
uint8_t subtype = 0x01;
|
uint8_t subtype = 0x01;
|
||||||
uint8_t control_selector;
|
uint8_t control_selector;
|
||||||
uint8_t ch;
|
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,
|
struct usbd_interface *intf,
|
||||||
uint16_t uac_version,
|
uint16_t uac_version,
|
||||||
struct audio_entity_info *table,
|
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)
|
__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)
|
__WEAK int usbd_audio_get_volume(uint8_t busid, uint8_t ep, uint8_t ch)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)ep;
|
||||||
|
(void)ch;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbd_audio_set_mute(uint8_t busid, uint8_t ep, uint8_t ch, bool mute)
|
__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)
|
__WEAK bool usbd_audio_get_mute(uint8_t busid, uint8_t ep, uint8_t ch)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)ep;
|
||||||
|
(void)ch;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbd_audio_set_sampling_freq(uint8_t busid, uint8_t ep, uint32_t sampling_freq)
|
__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)
|
__WEAK uint32_t usbd_audio_get_sampling_freq(uint8_t busid, uint8_t ep)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)ep;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbd_audio_get_sampling_freq_table(uint8_t busid, uint8_t ep, uint8_t **sampling_freq_table)
|
__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;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
static int usbh_audio_data_connect(struct usbh_hubport *hport, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)hport;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbh_audio_data_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
static int usbh_audio_data_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)hport;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_audio_run(struct usbh_audio *audio_class)
|
__WEAK void usbh_audio_run(struct usbh_audio *audio_class)
|
||||||
{
|
{
|
||||||
|
(void)audio_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_audio_stop(struct usbh_audio *audio_class)
|
__WEAK void usbh_audio_stop(struct usbh_audio *audio_class)
|
||||||
{
|
{
|
||||||
|
(void)audio_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct usbh_class_driver audio_ctrl_class_driver = {
|
const struct usbh_class_driver audio_ctrl_class_driver = {
|
||||||
|
@ -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)
|
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_interface_handler = cdc_acm_class_interface_request_handler;
|
||||||
intf->class_endpoint_handler = NULL;
|
intf->class_endpoint_handler = NULL;
|
||||||
intf->vendor_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)
|
__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)
|
__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->dwDTERate = 2000000;
|
||||||
line_coding->bDataBits = 8;
|
line_coding->bDataBits = 8;
|
||||||
line_coding->bParityType = 0;
|
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)
|
__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)
|
__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)
|
__WEAK void usbd_cdc_acm_send_break(uint8_t busid, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)intf;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,10 @@ static int cdc_ecm_class_interface_request_handler(uint8_t busid, struct usb_set
|
|||||||
"bRequest 0x%02x\r\n",
|
"bRequest 0x%02x\r\n",
|
||||||
setup->bRequest);
|
setup->bRequest);
|
||||||
|
|
||||||
|
(void)busid;
|
||||||
|
(void)data;
|
||||||
|
(void)len;
|
||||||
|
|
||||||
g_cmd_intf = LO_BYTE(setup->wIndex);
|
g_cmd_intf = LO_BYTE(setup->wIndex);
|
||||||
|
|
||||||
switch (setup->bRequest) {
|
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 cdc_ecm_notify_handler(uint8_t busid, uint8_t event, void *arg)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)arg;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case USBD_EVENT_RESET:
|
case USBD_EVENT_RESET:
|
||||||
g_current_net_status = 0;
|
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 cdc_ecm_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
|
||||||
g_cdc_ecm_rx_data_length += nbytes;
|
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;
|
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);
|
usbd_cdc_ecm_data_recv_done(g_cdc_ecm_rx_buffer, g_cdc_ecm_rx_data_length);
|
||||||
} else {
|
} 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)
|
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 */
|
/* send zlp */
|
||||||
usbd_ep_start_write(0, ep, NULL, 0);
|
usbd_ep_start_write(0, ep, NULL, 0);
|
||||||
} else {
|
} 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 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) {
|
if (g_current_net_status == 1) {
|
||||||
g_current_net_status = 2;
|
g_current_net_status = 2;
|
||||||
usbd_cdc_ecm_send_notify(CDC_ECM_NOTIFY_CODE_NETWORK_CONNECTION, CDC_ECM_NET_CONNECTED, g_connect_speed_table);
|
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)
|
__WEAK void usbd_cdc_ecm_data_recv_done(uint8_t *buf, uint32_t len)
|
||||||
{
|
{
|
||||||
|
(void)buf;
|
||||||
|
(void)len;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
static int usbh_cdc_data_connect(struct usbh_hubport *hport, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)hport;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbh_cdc_data_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
static int usbh_cdc_data_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)hport;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class)
|
__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)
|
__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 = {
|
const struct usbh_class_driver cdc_acm_class_driver = {
|
||||||
|
@ -236,6 +236,7 @@ void usbh_cdc_ecm_rx_thread(void *argument)
|
|||||||
uint32_t g_cdc_ecm_rx_length;
|
uint32_t g_cdc_ecm_rx_length;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
(void)argument;
|
||||||
USB_LOG_INFO("Create cdc ecm rx thread\r\n");
|
USB_LOG_INFO("Create cdc ecm rx thread\r\n");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
find_class:
|
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)
|
__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)
|
__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 = {
|
const struct usbh_class_driver cdc_ecm_class_driver = {
|
||||||
|
@ -259,6 +259,7 @@ void usbh_cdc_ncm_rx_thread(void *argument)
|
|||||||
uint32_t transfer_size = (16 * 1024);
|
uint32_t transfer_size = (16 * 1024);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)argument;
|
||||||
USB_LOG_INFO("Create cdc ncm rx thread\r\n");
|
USB_LOG_INFO("Create cdc ncm rx thread\r\n");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
find_class:
|
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)
|
__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)
|
__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 = {
|
const struct usbh_class_driver cdc_ncm_class_driver = {
|
||||||
|
@ -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)
|
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_interface_handler = hid_class_interface_request_handler;
|
||||||
intf->class_endpoint_handler = NULL;
|
intf->class_endpoint_handler = NULL;
|
||||||
intf->vendor_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;
|
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)
|
__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;
|
(*data[0]) = 0;
|
||||||
*len = 1;
|
*len = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK uint8_t usbd_hid_get_idle(uint8_t busid, uint8_t intf, uint8_t report_id)
|
__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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK uint8_t usbd_hid_get_protocol(uint8_t busid, uint8_t intf)
|
__WEAK uint8_t usbd_hid_get_protocol(uint8_t busid, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
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)
|
__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)
|
__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)
|
__WEAK void usbd_hid_set_protocol(uint8_t busid, uint8_t intf, uint8_t protocol)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)intf;
|
||||||
|
(void)protocol;
|
||||||
}
|
}
|
@ -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)
|
__WEAK void usbh_hid_run(struct usbh_hid *hid_class)
|
||||||
{
|
{
|
||||||
|
(void)hid_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_hid_stop(struct usbh_hid *hid_class)
|
__WEAK void usbh_hid_stop(struct usbh_hid *hid_class)
|
||||||
{
|
{
|
||||||
|
(void)hid_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct usbh_class_driver hid_class_driver = {
|
const struct usbh_class_driver hid_class_driver = {
|
||||||
|
@ -170,6 +170,8 @@ static int _usbh_hub_set_depth(struct usbh_hub *hub, uint16_t depth)
|
|||||||
#if CONFIG_USBHOST_MAX_EXTHUBS > 0
|
#if CONFIG_USBHOST_MAX_EXTHUBS > 0
|
||||||
static int parse_hub_descriptor(struct usb_hub_descriptor *desc, uint16_t length)
|
static int parse_hub_descriptor(struct usb_hub_descriptor *desc, uint16_t length)
|
||||||
{
|
{
|
||||||
|
(void)length;
|
||||||
|
|
||||||
if (desc->bLength != USB_SIZEOF_HUB_DESC) {
|
if (desc->bLength != USB_SIZEOF_HUB_DESC) {
|
||||||
USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength);
|
USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength);
|
||||||
return -1;
|
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)
|
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) {
|
if (desc->bLength < USB_SIZEOF_HUB_SS_DESC) {
|
||||||
USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength);
|
USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -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 msc_storage_notify_handler(uint8_t busid, uint8_t event, void *arg)
|
||||||
{
|
{
|
||||||
|
(void)arg;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case USBD_EVENT_INIT:
|
case USBD_EVENT_INIT:
|
||||||
#if defined(CONFIG_USBDEV_MSC_THREAD)
|
#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)
|
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)) {
|
if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x80U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) {
|
||||||
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
||||||
return false;
|
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)
|
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)) {
|
if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x80U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) {
|
||||||
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
||||||
return false;
|
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)
|
static bool SCSI_write10(uint8_t busid, uint8_t **data, uint32_t *len)
|
||||||
{
|
{
|
||||||
uint32_t data_len = 0;
|
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)) {
|
if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x00U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) {
|
||||||
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
||||||
return false;
|
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)
|
static bool SCSI_write12(uint8_t busid, uint8_t **data, uint32_t *len)
|
||||||
{
|
{
|
||||||
uint32_t data_len = 0;
|
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)) {
|
if (((g_usbd_msc[busid].cbw.bmFlags & 0x80U) != 0x00U) || (g_usbd_msc[busid].cbw.dDataLength == 0U)) {
|
||||||
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
SCSI_SetSenseData(busid, SCSI_KCQIR_INVALIDCOMMAND);
|
||||||
return false;
|
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 mass_storage_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes)
|
||||||
{
|
{
|
||||||
|
(void)ep;
|
||||||
|
|
||||||
switch (g_usbd_msc[busid].stage) {
|
switch (g_usbd_msc[busid].stage) {
|
||||||
case MSC_READ_CBW:
|
case MSC_READ_CBW:
|
||||||
if (SCSI_CBWDecode(busid, nbytes) == false) {
|
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 mass_storage_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes)
|
||||||
{
|
{
|
||||||
|
(void)ep;
|
||||||
|
(void)nbytes;
|
||||||
|
|
||||||
switch (g_usbd_msc[busid].stage) {
|
switch (g_usbd_msc[busid].stage) {
|
||||||
case MSC_DATA_IN:
|
case MSC_DATA_IN:
|
||||||
switch (g_usbd_msc[busid].cbw.CB[0]) {
|
switch (g_usbd_msc[busid].cbw.CB[0]) {
|
||||||
|
@ -87,6 +87,8 @@ static void usbh_msc_cbw_dump(struct CBW *cbw)
|
|||||||
|
|
||||||
static void usbh_msc_csw_dump(struct CSW *csw)
|
static void usbh_msc_csw_dump(struct CSW *csw)
|
||||||
{
|
{
|
||||||
|
(void)csw;
|
||||||
|
|
||||||
USB_LOG_DBG("CSW:\r\n");
|
USB_LOG_DBG("CSW:\r\n");
|
||||||
USB_LOG_DBG(" signature: 0x%08x\r\n", (unsigned int)csw->dSignature);
|
USB_LOG_DBG(" signature: 0x%08x\r\n", (unsigned int)csw->dSignature);
|
||||||
USB_LOG_DBG(" tag: 0x%08x\r\n", (unsigned int)csw->dTag);
|
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)
|
__WEAK void usbh_msc_run(struct usbh_msc *msc_class)
|
||||||
{
|
{
|
||||||
|
(void)msc_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_msc_stop(struct usbh_msc *msc_class)
|
__WEAK void usbh_msc_stop(struct usbh_msc *msc_class)
|
||||||
{
|
{
|
||||||
|
(void)msc_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct usbh_class_driver msc_class_driver = {
|
const struct usbh_class_driver msc_class_driver = {
|
||||||
|
3
class/vendor/net/usbh_asix.c
vendored
3
class/vendor/net/usbh_asix.c
vendored
@ -680,6 +680,7 @@ void usbh_asix_rx_thread(void *argument)
|
|||||||
uint32_t transfer_size = (16 * 1024);
|
uint32_t transfer_size = (16 * 1024);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)argument;
|
||||||
USB_LOG_INFO("Create asix rx thread\r\n");
|
USB_LOG_INFO("Create asix rx thread\r\n");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
find_class:
|
find_class:
|
||||||
@ -791,10 +792,12 @@ int usbh_asix_eth_output(uint32_t buflen)
|
|||||||
|
|
||||||
__WEAK void usbh_asix_run(struct usbh_asix *asix_class)
|
__WEAK void usbh_asix_run(struct usbh_asix *asix_class)
|
||||||
{
|
{
|
||||||
|
(void)asix_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_asix_stop(struct usbh_asix *asix_class)
|
__WEAK void usbh_asix_stop(struct usbh_asix *asix_class)
|
||||||
{
|
{
|
||||||
|
(void)asix_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t asix_id_table[][2] = {
|
static const uint16_t asix_id_table[][2] = {
|
||||||
|
3
class/vendor/net/usbh_rtl8152.c
vendored
3
class/vendor/net/usbh_rtl8152.c
vendored
@ -2140,6 +2140,7 @@ void usbh_rtl8152_rx_thread(void *argument)
|
|||||||
uint32_t transfer_size = (16 * 1024);
|
uint32_t transfer_size = (16 * 1024);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)argument;
|
||||||
USB_LOG_INFO("Create rtl8152 rx thread\r\n");
|
USB_LOG_INFO("Create rtl8152 rx thread\r\n");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
find_class:
|
find_class:
|
||||||
@ -2248,10 +2249,12 @@ int usbh_rtl8152_eth_output(uint32_t buflen)
|
|||||||
|
|
||||||
__WEAK void usbh_rtl8152_run(struct usbh_rtl8152 *rtl8152_class)
|
__WEAK void usbh_rtl8152_run(struct usbh_rtl8152 *rtl8152_class)
|
||||||
{
|
{
|
||||||
|
(void)rtl8152_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class)
|
__WEAK void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class)
|
||||||
{
|
{
|
||||||
|
(void)rtl8152_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t rtl_id_table[][2] = {
|
static const uint16_t rtl_id_table[][2] = {
|
||||||
|
2
class/vendor/serial/usbh_ch34x.c
vendored
2
class/vendor/serial/usbh_ch34x.c
vendored
@ -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)
|
__WEAK void usbh_ch34x_run(struct usbh_ch34x *ch34x_class)
|
||||||
{
|
{
|
||||||
|
(void)ch34x_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_ch34x_stop(struct usbh_ch34x *ch34x_class)
|
__WEAK void usbh_ch34x_stop(struct usbh_ch34x *ch34x_class)
|
||||||
{
|
{
|
||||||
|
(void)ch34x_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t ch34x_id_table[][2] = {
|
static const uint16_t ch34x_id_table[][2] = {
|
||||||
|
2
class/vendor/serial/usbh_cp210x.c
vendored
2
class/vendor/serial/usbh_cp210x.c
vendored
@ -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)
|
__WEAK void usbh_cp210x_run(struct usbh_cp210x *cp210x_class)
|
||||||
{
|
{
|
||||||
|
(void)cp210x_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_cp210x_stop(struct usbh_cp210x *cp210x_class)
|
__WEAK void usbh_cp210x_stop(struct usbh_cp210x *cp210x_class)
|
||||||
{
|
{
|
||||||
|
(void)cp210x_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t cp210x_id_table[][2] = {
|
static const uint16_t cp210x_id_table[][2] = {
|
||||||
|
4
class/vendor/serial/usbh_ftdi.c
vendored
4
class/vendor/serial/usbh_ftdi.c
vendored
@ -57,7 +57,7 @@ static void usbh_ftdi_caculate_baudrate(uint32_t *itdf_divisor, uint32_t actual_
|
|||||||
}
|
}
|
||||||
int divisor = FTDI_USB_CLK / baudrate;
|
int divisor = FTDI_USB_CLK / baudrate;
|
||||||
int frac_bits = 0;
|
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]) {
|
if ((divisor & 0xF) == frac[i]) {
|
||||||
frac_bits = i;
|
frac_bits = i;
|
||||||
break;
|
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)
|
__WEAK void usbh_ftdi_run(struct usbh_ftdi *ftdi_class)
|
||||||
{
|
{
|
||||||
|
(void)ftdi_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_ftdi_stop(struct usbh_ftdi *ftdi_class)
|
__WEAK void usbh_ftdi_stop(struct usbh_ftdi *ftdi_class)
|
||||||
{
|
{
|
||||||
|
(void)ftdi_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t ftdi_id_table[][2] = {
|
static const uint16_t ftdi_id_table[][2] = {
|
||||||
|
2
class/vendor/serial/usbh_pl2303.c
vendored
2
class/vendor/serial/usbh_pl2303.c
vendored
@ -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)
|
__WEAK void usbh_pl2303_run(struct usbh_pl2303 *pl2303_class)
|
||||||
{
|
{
|
||||||
|
(void)pl2303_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_pl2303_stop(struct usbh_pl2303 *pl2303_class)
|
__WEAK void usbh_pl2303_stop(struct usbh_pl2303 *pl2303_class)
|
||||||
{
|
{
|
||||||
|
(void)pl2303_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t pl2303_id_table[][2] = {
|
static const uint16_t pl2303_id_table[][2] = {
|
||||||
|
7
class/vendor/wifi/usbh_bl616.c
vendored
7
class/vendor/wifi/usbh_bl616.c
vendored
@ -356,6 +356,7 @@ void usbh_bl616_rx_thread(void *argument)
|
|||||||
rnm_scan_ind_msg_t *scanmsg;
|
rnm_scan_ind_msg_t *scanmsg;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
|
||||||
|
(void)argument;
|
||||||
USB_LOG_INFO("Create bl616 wifi rx thread\r\n");
|
USB_LOG_INFO("Create bl616 wifi rx thread\r\n");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -473,15 +474,21 @@ int wifi_sta_connect(int argc, char **argv)
|
|||||||
|
|
||||||
int wifi_scan(int argc, char **argv)
|
int wifi_scan(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
|
||||||
usbh_bl616_wifi_scan();
|
usbh_bl616_wifi_scan();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_bl616_run(struct usbh_bl616 *bl616_class)
|
__WEAK void usbh_bl616_run(struct usbh_bl616 *bl616_class)
|
||||||
{
|
{
|
||||||
|
(void)bl616_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_bl616_stop(struct usbh_bl616 *bl616_class)
|
__WEAK void usbh_bl616_stop(struct usbh_bl616 *bl616_class)
|
||||||
{
|
{
|
||||||
|
(void)bl616_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint16_t bl616_id_table[][2] = {
|
static const uint16_t bl616_id_table[][2] = {
|
||||||
|
@ -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);
|
uint8_t control_selector = (uint8_t)(setup->wValue >> 8);
|
||||||
|
|
||||||
|
(void)busid;
|
||||||
|
|
||||||
switch (control_selector) {
|
switch (control_selector) {
|
||||||
case VIDEO_VC_VIDEO_POWER_MODE_CONTROL:
|
case VIDEO_VC_VIDEO_POWER_MODE_CONTROL:
|
||||||
switch (setup->bRequest) {
|
switch (setup->bRequest) {
|
||||||
|
@ -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)
|
static int usbh_video_streaming_connect(struct usbh_hubport *hport, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)hport;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbh_video_streaming_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
static int usbh_video_streaming_disconnect(struct usbh_hubport *hport, uint8_t intf)
|
||||||
{
|
{
|
||||||
|
(void)hport;
|
||||||
|
(void)intf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_video_run(struct usbh_video *video_class)
|
__WEAK void usbh_video_run(struct usbh_video *video_class)
|
||||||
{
|
{
|
||||||
|
(void)video_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_video_stop(struct usbh_video *video_class)
|
__WEAK void usbh_video_stop(struct usbh_video *video_class)
|
||||||
{
|
{
|
||||||
|
(void)video_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct usbh_class_driver video_ctrl_class_driver = {
|
const struct usbh_class_driver video_ctrl_class_driver = {
|
||||||
|
@ -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)
|
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) {
|
switch (setup->bRequest) {
|
||||||
case CDC_REQUEST_SEND_ENCAPSULATED_COMMAND:
|
case CDC_REQUEST_SEND_ENCAPSULATED_COMMAND:
|
||||||
rndis_encapsulated_cmd_handler(*data, setup->wLength);
|
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_msg_t *cmd = (rndis_initialize_msg_t *)data;
|
||||||
rndis_initialize_cmplt_t *resp;
|
rndis_initialize_cmplt_t *resp;
|
||||||
|
|
||||||
|
(void)len;
|
||||||
|
|
||||||
resp = ((rndis_initialize_cmplt_t *)rndis_encapsulated_resp_buffer);
|
resp = ((rndis_initialize_cmplt_t *)rndis_encapsulated_resp_buffer);
|
||||||
resp->RequestId = cmd->RequestId;
|
resp->RequestId = cmd->RequestId;
|
||||||
resp->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
|
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;
|
rndis_halt_msg_t *resp;
|
||||||
|
|
||||||
|
(void)data;
|
||||||
|
(void)len;
|
||||||
|
|
||||||
resp = ((rndis_halt_msg_t *)rndis_encapsulated_resp_buffer);
|
resp = ((rndis_halt_msg_t *)rndis_encapsulated_resp_buffer);
|
||||||
resp->MessageLength = 0;
|
resp->MessageLength = 0;
|
||||||
|
|
||||||
@ -192,6 +199,8 @@ static int rndis_query_cmd_handler(uint8_t *data, uint32_t len)
|
|||||||
uint8_t *infomation_buffer;
|
uint8_t *infomation_buffer;
|
||||||
uint32_t infomation_len = 0;
|
uint32_t infomation_len = 0;
|
||||||
|
|
||||||
|
(void)len;
|
||||||
|
|
||||||
resp = ((rndis_query_cmplt_t *)rndis_encapsulated_resp_buffer);
|
resp = ((rndis_query_cmplt_t *)rndis_encapsulated_resp_buffer);
|
||||||
resp->MessageType = REMOTE_NDIS_QUERY_CMPLT;
|
resp->MessageType = REMOTE_NDIS_QUERY_CMPLT;
|
||||||
resp->RequestId = cmd->RequestId;
|
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_set_cmplt_t *resp;
|
||||||
rndis_config_parameter_t *param;
|
rndis_config_parameter_t *param;
|
||||||
|
|
||||||
|
(void)len;
|
||||||
|
|
||||||
resp = ((rndis_set_cmplt_t *)rndis_encapsulated_resp_buffer);
|
resp = ((rndis_set_cmplt_t *)rndis_encapsulated_resp_buffer);
|
||||||
resp->RequestId = cmd->RequestId;
|
resp->RequestId = cmd->RequestId;
|
||||||
resp->MessageType = REMOTE_NDIS_SET_CMPLT;
|
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_msg_t *cmd = (rndis_reset_msg_t *)data;
|
||||||
rndis_reset_cmplt_t *resp;
|
rndis_reset_cmplt_t *resp;
|
||||||
|
|
||||||
|
(void)data;
|
||||||
|
(void)len;
|
||||||
|
|
||||||
resp = ((rndis_reset_cmplt_t *)rndis_encapsulated_resp_buffer);
|
resp = ((rndis_reset_cmplt_t *)rndis_encapsulated_resp_buffer);
|
||||||
resp->MessageType = REMOTE_NDIS_RESET_CMPLT;
|
resp->MessageType = REMOTE_NDIS_RESET_CMPLT;
|
||||||
resp->MessageLength = sizeof(rndis_reset_cmplt_t);
|
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_msg_t *cmd = (rndis_keepalive_msg_t *)data;
|
||||||
rndis_keepalive_cmplt_t *resp;
|
rndis_keepalive_cmplt_t *resp;
|
||||||
|
|
||||||
|
(void)len;
|
||||||
|
|
||||||
resp = ((rndis_keepalive_cmplt_t *)rndis_encapsulated_resp_buffer);
|
resp = ((rndis_keepalive_cmplt_t *)rndis_encapsulated_resp_buffer);
|
||||||
resp->RequestId = cmd->RequestId;
|
resp->RequestId = cmd->RequestId;
|
||||||
resp->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT;
|
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)
|
static void rndis_notify_handler(uint8_t busid, uint8_t event, void *arg)
|
||||||
{
|
{
|
||||||
|
(void)busid;
|
||||||
|
(void)arg;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case USBD_EVENT_RESET:
|
case USBD_EVENT_RESET:
|
||||||
g_usbd_rndis.link_status = NDIS_MEDIA_STATE_DISCONNECTED;
|
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;
|
rndis_data_packet_t *hdr;
|
||||||
|
|
||||||
|
(void)busid;
|
||||||
|
(void)ep;
|
||||||
|
|
||||||
hdr = (rndis_data_packet_t *)g_rndis_rx_buffer;
|
hdr = (rndis_data_packet_t *)g_rndis_rx_buffer;
|
||||||
g_rndis_rx_data_buffer = g_rndis_rx_buffer;
|
g_rndis_rx_data_buffer = g_rndis_rx_buffer;
|
||||||
if ((hdr->MessageType != REMOTE_NDIS_PACKET_MSG) || (nbytes < hdr->MessageLength)) {
|
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)
|
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 */
|
/* send zlp */
|
||||||
usbd_ep_start_write(0, ep, NULL, 0);
|
usbd_ep_start_write(0, ep, NULL, 0);
|
||||||
} else {
|
} 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 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);
|
//USB_LOG_DBG("len:%d\r\n", nbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,14 +365,18 @@ delete :
|
|||||||
|
|
||||||
__WEAK void usbh_bluetooth_hci_read_callback(uint8_t *data, uint32_t len)
|
__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)
|
__WEAK void usbh_bluetooth_run(struct usbh_bluetooth *bluetooth_class)
|
||||||
{
|
{
|
||||||
|
(void)bluetooth_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class)
|
__WEAK void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class)
|
||||||
{
|
{
|
||||||
|
(void)bluetooth_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct usbh_class_driver bluetooth_class_driver = {
|
static const struct usbh_class_driver bluetooth_class_driver = {
|
||||||
|
@ -26,6 +26,7 @@ static struct usbh_rndis g_rndis_class;
|
|||||||
|
|
||||||
static int usbh_rndis_get_notification(struct usbh_rndis *rndis_class)
|
static int usbh_rndis_get_notification(struct usbh_rndis *rndis_class)
|
||||||
{
|
{
|
||||||
|
(void)rndis_class;
|
||||||
// int ret;
|
// int ret;
|
||||||
// struct usbh_urb *urb = &rndis_class->intin_urb;
|
// 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);
|
uint32_t transfer_size = (16 * 1024);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)argument;
|
||||||
|
|
||||||
USB_LOG_INFO("Create rndis rx thread\r\n");
|
USB_LOG_INFO("Create rndis rx thread\r\n");
|
||||||
// clang-format off
|
// clang-format off
|
||||||
find_class:
|
find_class:
|
||||||
@ -581,10 +584,12 @@ int usbh_rndis_eth_output(uint32_t buflen)
|
|||||||
|
|
||||||
__WEAK void usbh_rndis_run(struct usbh_rndis *rndis_class)
|
__WEAK void usbh_rndis_run(struct usbh_rndis *rndis_class)
|
||||||
{
|
{
|
||||||
|
(void)rndis_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usbh_rndis_stop(struct usbh_rndis *rndis_class)
|
__WEAK void usbh_rndis_stop(struct usbh_rndis *rndis_class)
|
||||||
{
|
{
|
||||||
|
(void)rndis_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct usbh_class_driver rndis_class_driver = {
|
static const struct usbh_class_driver rndis_class_driver = {
|
||||||
|
@ -86,7 +86,7 @@ void usb_assert(const char *filename, int linenum);
|
|||||||
static inline void usb_hexdump(const void *ptr, uint32_t buflen)
|
static inline void usb_hexdump(const void *ptr, uint32_t buflen)
|
||||||
{
|
{
|
||||||
unsigned char *buf = (unsigned char *)ptr;
|
unsigned char *buf = (unsigned char *)ptr;
|
||||||
int i, j;
|
uint32_t i, j;
|
||||||
|
|
||||||
for (i = 0; i < buflen; i += 16) {
|
for (i = 0; i < buflen; i += 16) {
|
||||||
CONFIG_USB_PRINTF("%08X:", i);
|
CONFIG_USB_PRINTF("%08X:", i);
|
||||||
|
@ -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;
|
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 += nbytes;
|
||||||
g_usbd_core[busid].ep0_data_buf_residue -= 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;
|
struct usb_setup_packet *setup = &g_usbd_core[busid].setup;
|
||||||
|
|
||||||
|
(void)ep;
|
||||||
|
|
||||||
if (nbytes > 0) {
|
if (nbytes > 0) {
|
||||||
g_usbd_core[busid].ep0_data_buf += nbytes;
|
g_usbd_core[busid].ep0_data_buf += nbytes;
|
||||||
g_usbd_core[busid].ep0_data_buf_residue -= nbytes;
|
g_usbd_core[busid].ep0_data_buf_residue -= nbytes;
|
||||||
|
@ -72,7 +72,7 @@ struct usb_descriptor {
|
|||||||
const char *(*string_descriptor_callback)(uint8_t speed, uint8_t index);
|
const char *(*string_descriptor_callback)(uint8_t speed, uint8_t index);
|
||||||
const struct usb_msosv1_descriptor *msosv1_descriptor;
|
const struct usb_msosv1_descriptor *msosv1_descriptor;
|
||||||
const struct usb_msosv2_descriptor *msosv2_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;
|
const struct usb_bos_descriptor *bos_descriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void usbh_hid_callback(void *arg, int nbytes)
|
|||||||
struct usbh_hid *hid_class = (struct usbh_hid *)arg;
|
struct usbh_hid *hid_class = (struct usbh_hid *)arg;
|
||||||
|
|
||||||
if (nbytes > 0) {
|
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("0x%02x ", hid_buffer[i]);
|
||||||
}
|
}
|
||||||
USB_LOG_RAW("nbytes:%d\r\n", nbytes);
|
USB_LOG_RAW("nbytes:%d\r\n", nbytes);
|
||||||
|
@ -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 *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;
|
struct usb_osal_timer *timer;
|
||||||
|
(void)name;
|
||||||
|
|
||||||
timer = pvPortMalloc(sizeof(struct usb_osal_timer));
|
timer = pvPortMalloc(sizeof(struct usb_osal_timer));
|
||||||
|
|
||||||
|
@ -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 *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;
|
struct usb_osal_timer *timer;
|
||||||
|
(void)name;
|
||||||
|
|
||||||
timer = pvPortMalloc(sizeof(struct usb_osal_timer));
|
timer = pvPortMalloc(sizeof(struct usb_osal_timer));
|
||||||
|
|
||||||
|
@ -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 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));
|
struct timer_adpt *timer = kmm_malloc(sizeof(struct timer_adpt));
|
||||||
|
|
||||||
|
(void)name;
|
||||||
|
|
||||||
if (!timer) {
|
if (!timer) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -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));
|
timer = rt_malloc(sizeof(struct usb_osal_timer));
|
||||||
memset(timer, 0, 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) {
|
if (timer->timer == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,7 @@ struct netif g_cdc_ecm_netif;
|
|||||||
static err_t usbh_cdc_ecm_linkoutput(struct netif *netif, struct pbuf *p)
|
static err_t usbh_cdc_ecm_linkoutput(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)netif;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_cdc_ecm_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_cdc_ecm_get_eth_txbuf());
|
||||||
ret = usbh_cdc_ecm_eth_output(p->tot_len);
|
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)
|
void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class)
|
||||||
{
|
{
|
||||||
struct netif *netif = &g_cdc_ecm_netif;
|
struct netif *netif = &g_cdc_ecm_netif;
|
||||||
|
(void)cdc_ecm_class;
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
dhcp_stop(netif);
|
dhcp_stop(netif);
|
||||||
dhcp_cleanup(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)
|
static err_t usbh_rndis_linkoutput(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)netif;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_rndis_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_rndis_get_eth_txbuf());
|
||||||
ret = usbh_rndis_eth_output(p->tot_len);
|
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)
|
void usbh_rndis_stop(struct usbh_rndis *rndis_class)
|
||||||
{
|
{
|
||||||
struct netif *netif = &g_rndis_netif;
|
struct netif *netif = &g_rndis_netif;
|
||||||
|
(void)rndis_class;
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
dhcp_stop(netif);
|
dhcp_stop(netif);
|
||||||
dhcp_cleanup(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)
|
static err_t usbh_cdc_ncm_linkoutput(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)netif;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_cdc_ncm_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_cdc_ncm_get_eth_txbuf());
|
||||||
ret = usbh_cdc_ncm_eth_output(p->tot_len);
|
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)
|
void usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class)
|
||||||
{
|
{
|
||||||
struct netif *netif = &g_cdc_ncm_netif;
|
struct netif *netif = &g_cdc_ncm_netif;
|
||||||
|
(void)cdc_ncm_class;
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
dhcp_stop(netif);
|
dhcp_stop(netif);
|
||||||
dhcp_cleanup(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)
|
static err_t usbh_asix_linkoutput(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)netif;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_asix_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_asix_get_eth_txbuf());
|
||||||
ret = usbh_asix_eth_output(p->tot_len);
|
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)
|
void usbh_asix_stop(struct usbh_asix *asix_class)
|
||||||
{
|
{
|
||||||
struct netif *netif = &g_asix_netif;
|
struct netif *netif = &g_asix_netif;
|
||||||
|
(void)asix_class;
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
dhcp_stop(netif);
|
dhcp_stop(netif);
|
||||||
dhcp_cleanup(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)
|
static err_t usbh_rtl8152_linkoutput(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)netif;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_rtl8152_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_rtl8152_get_eth_txbuf());
|
||||||
ret = usbh_rtl8152_eth_output(p->tot_len);
|
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)
|
void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class)
|
||||||
{
|
{
|
||||||
struct netif *netif = &g_rtl8152_netif;
|
struct netif *netif = &g_rtl8152_netif;
|
||||||
|
(void)rtl8152_class;
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
dhcp_stop(netif);
|
dhcp_stop(netif);
|
||||||
dhcp_cleanup(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)
|
static err_t usbh_bl616_linkoutput(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)netif;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_bl616_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_bl616_get_eth_txbuf());
|
||||||
ret = usbh_bl616_eth_output(p->tot_len);
|
ret = usbh_bl616_eth_output(p->tot_len);
|
||||||
@ -583,6 +599,7 @@ void usbh_bl616_sta_disconnect_callback(void)
|
|||||||
|
|
||||||
netif_set_down(netif);
|
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])
|
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;
|
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);
|
netif_set_up(netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbh_bl616_run(struct usbh_bl616 *bl616_class)
|
void usbh_bl616_run(struct usbh_bl616 *bl616_class)
|
||||||
{
|
{
|
||||||
struct netif *netif = &g_bl616_netif;
|
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;
|
struct netif *netif = &g_bl616_netif;
|
||||||
|
|
||||||
|
(void)bl616_class;
|
||||||
|
|
||||||
netif_set_down(netif);
|
netif_set_down(netif);
|
||||||
netif_remove(netif);
|
netif_remove(netif);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
static rt_err_t rt_usbh_cdc_ecm_eth_tx(rt_device_t dev, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)dev;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_cdc_ecm_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_cdc_ecm_get_eth_txbuf());
|
||||||
ret = usbh_cdc_ecm_eth_output(p->tot_len);
|
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 usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class)
|
||||||
{
|
{
|
||||||
|
(void)cdc_ecm_class;
|
||||||
|
|
||||||
eth_device_deinit(&g_cdc_ecm_dev);
|
eth_device_deinit(&g_cdc_ecm_dev);
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
static rt_err_t rt_usbh_rndis_eth_tx(rt_device_t dev, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)dev;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_rndis_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_rndis_get_eth_txbuf());
|
||||||
ret = usbh_rndis_eth_output(p->tot_len);
|
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 usbh_rndis_stop(struct usbh_rndis *rndis_class)
|
||||||
{
|
{
|
||||||
|
(void)rndis_class;
|
||||||
|
|
||||||
eth_device_deinit(&g_rndis_dev);
|
eth_device_deinit(&g_rndis_dev);
|
||||||
// rt_timer_stop(keep_timer);
|
// rt_timer_stop(keep_timer);
|
||||||
// rt_timer_delete(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)
|
static rt_err_t rt_usbh_cdc_ncm_eth_tx(rt_device_t dev, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)dev;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_cdc_ncm_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_cdc_ncm_get_eth_txbuf());
|
||||||
ret = usbh_cdc_ncm_eth_output(p->tot_len);
|
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 usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class)
|
||||||
{
|
{
|
||||||
|
(void)cdc_ncm_class;
|
||||||
|
|
||||||
eth_device_deinit(&g_cdc_ncm_dev);
|
eth_device_deinit(&g_cdc_ncm_dev);
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
static rt_err_t rt_usbh_asix_eth_tx(rt_device_t dev, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)dev;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_asix_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_asix_get_eth_txbuf());
|
||||||
ret = usbh_asix_eth_output(p->tot_len);
|
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 usbh_asix_stop(struct usbh_asix *asix_class)
|
||||||
{
|
{
|
||||||
|
(void)asix_class;
|
||||||
|
|
||||||
eth_device_deinit(&g_asix_dev);
|
eth_device_deinit(&g_asix_dev);
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
static rt_err_t rt_usbh_rtl8152_eth_tx(rt_device_t dev, struct pbuf *p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
(void)dev;
|
||||||
|
|
||||||
usbh_lwip_eth_output_common(p, usbh_rtl8152_get_eth_txbuf());
|
usbh_lwip_eth_output_common(p, usbh_rtl8152_get_eth_txbuf());
|
||||||
ret = usbh_rtl8152_eth_output(p->tot_len);
|
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 usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class)
|
||||||
{
|
{
|
||||||
|
(void)rtl8152_class;
|
||||||
|
|
||||||
eth_device_deinit(&g_rtl8152_dev);
|
eth_device_deinit(&g_rtl8152_dev);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -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)
|
__WEAK void usb_hc_low_level_init(struct usbh_bus *bus)
|
||||||
{
|
{
|
||||||
|
(void)bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus)
|
__WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus)
|
||||||
{
|
{
|
||||||
|
(void)bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_hc_init(struct usbh_bus *bus)
|
int usb_hc_init(struct usbh_bus *bus)
|
||||||
|
@ -167,6 +167,7 @@ static void ehci_qh_fill(struct ehci_qh_hw *qh,
|
|||||||
switch (speed) {
|
switch (speed) {
|
||||||
case USB_SPEED_LOW:
|
case USB_SPEED_LOW:
|
||||||
epchar |= QH_EPCHAR_EPS_LOW;
|
epchar |= QH_EPCHAR_EPS_LOW;
|
||||||
|
__attribute__((fallthrough));
|
||||||
case USB_SPEED_FULL:
|
case USB_SPEED_FULL:
|
||||||
if (ep_type == USB_ENDPOINT_TYPE_CONTROL) {
|
if (ep_type == USB_ENDPOINT_TYPE_CONTROL) {
|
||||||
epchar |= QH_EPCHAR_C; /* for TT */
|
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->parent->hub_addr,
|
||||||
urb->hport->port);
|
urb->hport->port);
|
||||||
|
|
||||||
while (buflen >= 0) {
|
while (1) {
|
||||||
qtd = &qh->qtd_pool[qtd_num];
|
qtd = &qh->qtd_pool[qtd_num];
|
||||||
|
|
||||||
if (buflen > 0x4000) {
|
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->parent->hub_addr,
|
||||||
urb->hport->port);
|
urb->hport->port);
|
||||||
|
|
||||||
while (buflen >= 0) {
|
while (1) {
|
||||||
qtd = &qh->qtd_pool[qtd_num];
|
qtd = &qh->qtd_pool[qtd_num];
|
||||||
|
|
||||||
if (buflen > 0x4000) {
|
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;
|
struct ehci_qtd_hw *qtd;
|
||||||
|
|
||||||
|
(void)bus;
|
||||||
|
|
||||||
ehci_qh_remove(qhead, qh);
|
ehci_qh_remove(qhead, qh);
|
||||||
|
|
||||||
qtd = EHCI_ADDR2QTD(qh->first_qtd);
|
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;
|
struct ehci_qtd_hw *qtd;
|
||||||
|
|
||||||
|
(void)bus;
|
||||||
|
|
||||||
ehci_qh_remove(qhead, qh);
|
ehci_qh_remove(qhead, qh);
|
||||||
|
|
||||||
qtd = EHCI_ADDR2QTD(qh->first_qtd);
|
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)
|
__WEAK void usb_hc_low_level_init(struct usbh_bus *bus)
|
||||||
{
|
{
|
||||||
|
(void)bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usb_hc_low_level2_init(struct usbh_bus *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)
|
__WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus)
|
||||||
{
|
{
|
||||||
|
(void)bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_hc_init(struct usbh_bus *bus)
|
int usb_hc_init(struct usbh_bus *bus)
|
||||||
|
@ -475,10 +475,12 @@ static void musb_pipe_free(struct musb_pipe *pipe)
|
|||||||
|
|
||||||
__WEAK void usb_hc_low_level_init(struct usbh_bus *bus)
|
__WEAK void usb_hc_low_level_init(struct usbh_bus *bus)
|
||||||
{
|
{
|
||||||
|
(void)bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
__WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus)
|
__WEAK void usb_hc_low_level_deinit(struct usbh_bus *bus)
|
||||||
{
|
{
|
||||||
|
(void)bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_hc_init(struct usbh_bus *bus)
|
int usb_hc_init(struct usbh_bus *bus)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user