mirror of
https://github.com/sakumisu/CherryUSB.git
synced 2025-05-08 16:18:44 +08:00
update(class): replace ecm & rndis USB_ERR_NOTDEV with USB_ERR_NOTCONN
Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
parent
cf22bcf252
commit
bf2ba7324a
@ -173,7 +173,7 @@ void cdc_ecm_int_in(uint8_t busid, uint8_t ep, uint32_t nbytes)
|
||||
int usbd_cdc_ecm_start_write(uint8_t *buf, uint32_t len)
|
||||
{
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NODEV;
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
if (g_cdc_ecm_tx_data_length > 0) {
|
||||
@ -189,7 +189,7 @@ int usbd_cdc_ecm_start_write(uint8_t *buf, uint32_t len)
|
||||
int usbd_cdc_ecm_start_read(uint8_t *buf, uint32_t len)
|
||||
{
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NODEV;
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
g_cdc_ecm_rx_data_length = 0;
|
||||
@ -222,6 +222,10 @@ int usbd_cdc_ecm_eth_tx(struct pbuf *p)
|
||||
struct pbuf *q;
|
||||
uint8_t *buffer;
|
||||
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
if (g_cdc_ecm_tx_data_length > 0) {
|
||||
return -USB_ERR_BUSY;
|
||||
}
|
||||
@ -261,8 +265,12 @@ struct usbd_interface *usbd_cdc_ecm_init_intf(struct usbd_interface *intf, const
|
||||
return intf;
|
||||
}
|
||||
|
||||
void usbd_cdc_ecm_set_connect(bool connect, uint32_t speed[2])
|
||||
int usbd_cdc_ecm_set_connect(bool connect, uint32_t speed[2])
|
||||
{
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
if (connect) {
|
||||
g_current_net_status = 2;
|
||||
memcpy(g_connect_speed_table, speed, 8);
|
||||
@ -271,6 +279,8 @@ void usbd_cdc_ecm_set_connect(bool connect, uint32_t speed[2])
|
||||
g_current_net_status = 1;
|
||||
usbd_cdc_ecm_send_notify(CDC_ECM_NOTIFY_CODE_NETWORK_CONNECTION, CDC_ECM_NET_DISCONNECTED, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__WEAK void usbd_cdc_ecm_data_recv_done(uint32_t len)
|
||||
|
@ -15,7 +15,7 @@ extern "C" {
|
||||
/* Init cdc ecm interface driver */
|
||||
struct usbd_interface *usbd_cdc_ecm_init_intf(struct usbd_interface *intf, const uint8_t int_ep, const uint8_t out_ep, const uint8_t in_ep);
|
||||
|
||||
void usbd_cdc_ecm_set_connect(bool connect, uint32_t speed[2]);
|
||||
int usbd_cdc_ecm_set_connect(bool connect, uint32_t speed[2]);
|
||||
|
||||
void usbd_cdc_ecm_data_recv_done(uint32_t len);
|
||||
void usbd_cdc_ecm_data_send_done(uint32_t len);
|
||||
|
@ -515,7 +515,7 @@ void rndis_int_in(uint8_t busid, uint8_t ep, uint32_t nbytes)
|
||||
int usbd_rndis_start_write(uint8_t *buf, uint32_t len)
|
||||
{
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NODEV;
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
if (g_rndis_tx_data_length > 0) {
|
||||
@ -531,7 +531,7 @@ int usbd_rndis_start_write(uint8_t *buf, uint32_t len)
|
||||
int usbd_rndis_start_read(uint8_t *buf, uint32_t len)
|
||||
{
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NODEV;
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
g_rndis_rx_data_buffer = buf;
|
||||
@ -569,7 +569,7 @@ int usbd_rndis_eth_tx(struct pbuf *p)
|
||||
uint8_t *buffer;
|
||||
rndis_data_packet_t *hdr;
|
||||
|
||||
if (g_usbd_rndis.link_status == NDIS_MEDIA_STATE_DISCONNECTED) {
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ struct usbd_interface *usbd_rndis_init_intf(struct usbd_interface *intf,
|
||||
int usbd_rndis_set_connect(bool connect)
|
||||
{
|
||||
if (!usb_device_is_configured(0)) {
|
||||
return -USB_ERR_NODEV;
|
||||
return -USB_ERR_NOTCONN;
|
||||
}
|
||||
|
||||
if(g_usbd_rndis.set_rsp_get)
|
||||
|
Loading…
x
Reference in New Issue
Block a user