From 58550b3ed551169911b3b6bb6dce22a9e558b906 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sun, 12 May 2024 13:08:20 +0800 Subject: [PATCH] update: rename ecm and asix eth macro name --- class/cdc/usbh_cdc_ecm.c | 18 +++++++++--------- class/vendor/net/usbh_asix.c | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/class/cdc/usbh_cdc_ecm.c b/class/cdc/usbh_cdc_ecm.c index b274da8a..9b015add 100644 --- a/class/cdc/usbh_cdc_ecm.c +++ b/class/cdc/usbh_cdc_ecm.c @@ -21,11 +21,11 @@ #define INTF_DESC_bInterfaceNumber 2 /** Interface number offset */ #define INTF_DESC_bAlternateSetting 3 /** Alternate setting offset */ -#define CONFIG_USBHOST_CDC_ECM_PKT_FILTER 0x000C -#define CONFIG_USBHOST_CDC_ECM_ETH_MAX_SEGSZE 1514U +#define CONFIG_USBHOST_CDC_ECM_PKT_FILTER 0x000C +#define CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE 1514U -static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_cdc_ecm_rx_buffer[CONFIG_USBHOST_CDC_ECM_ETH_MAX_SEGSZE]; -static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_cdc_ecm_tx_buffer[CONFIG_USBHOST_CDC_ECM_ETH_MAX_SEGSZE]; +static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_cdc_ecm_rx_buffer[CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE]; +static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_cdc_ecm_tx_buffer[CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE]; static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_cdc_ecm_inttx_buffer[16]; static struct usbh_cdc_ecm g_cdc_ecm_class; @@ -139,8 +139,8 @@ get_mac: cdc_ecm_class->mac[4], cdc_ecm_class->mac[5]); - if (cdc_ecm_class->max_segment_size > CONFIG_USBHOST_CDC_ECM_ETH_MAX_SEGSZE) { - USB_LOG_ERR("CDC ECM Max Segment Size is overflow, default is %u, but now %u\r\n", CONFIG_USBHOST_CDC_ECM_ETH_MAX_SEGSZE, cdc_ecm_class->max_segment_size); + if (cdc_ecm_class->max_segment_size > CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE) { + USB_LOG_ERR("CDC ECM Max Segment Size is overflow, default is %u, but now %u\r\n", CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE, cdc_ecm_class->max_segment_size); } else { USB_LOG_INFO("CDC ECM Max Segment Size:%u\r\n", cdc_ecm_class->max_segment_size); } @@ -258,7 +258,7 @@ find_class: g_cdc_ecm_rx_length = 0; while (1) { - usbh_bulk_urb_fill(&g_cdc_ecm_class.bulkin_urb, g_cdc_ecm_class.hport, g_cdc_ecm_class.bulkin, &g_cdc_ecm_rx_buffer[g_cdc_ecm_rx_length], USB_GET_MAXPACKETSIZE(g_cdc_ecm_class.bulkin->wMaxPacketSize), USB_OSAL_WAITING_FOREVER, NULL, NULL); + usbh_bulk_urb_fill(&g_cdc_ecm_class.bulkin_urb, g_cdc_ecm_class.hport, g_cdc_ecm_class.bulkin, &g_cdc_ecm_rx_buffer[g_cdc_ecm_rx_length], CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE, USB_OSAL_WAITING_FOREVER, NULL, NULL); ret = usbh_submit_urb(&g_cdc_ecm_class.bulkin_urb); if (ret < 0) { goto find_class; @@ -266,7 +266,7 @@ find_class: g_cdc_ecm_rx_length += g_cdc_ecm_class.bulkin_urb.actual_length; - if (g_cdc_ecm_class.bulkin_urb.actual_length != USB_GET_MAXPACKETSIZE(g_cdc_ecm_class.bulkin->wMaxPacketSize)) { + if (g_cdc_ecm_rx_length % USB_GET_MAXPACKETSIZE(g_cdc_ecm_class.bulkin->wMaxPacketSize)) { USB_LOG_DBG("rxlen:%d\r\n", g_cdc_ecm_rx_length); p = pbuf_alloc(PBUF_RAW, g_cdc_ecm_rx_length, type); @@ -288,7 +288,7 @@ find_class: } } else { /* read continue util read short packet */ - if (g_cdc_ecm_rx_length > CONFIG_USBHOST_CDC_ECM_ETH_MAX_SEGSZE) { + if (g_cdc_ecm_rx_length > CONFIG_USBHOST_CDC_ECM_ETH_MAX_SIZE) { USB_LOG_ERR("Rx packet is overflow\r\n"); g_cdc_ecm_rx_length = 0; } diff --git a/class/vendor/net/usbh_asix.c b/class/vendor/net/usbh_asix.c index 20c682f2..7c23e054 100644 --- a/class/vendor/net/usbh_asix.c +++ b/class/vendor/net/usbh_asix.c @@ -14,10 +14,10 @@ #define DEV_FORMAT "/dev/asix" static struct usbh_asix g_asix_class; -#define CONFIG_USBHOST_ASIX_ETH_MAX_SEGSZE (1514U + 8) +#define CONFIG_USBHOST_ASIX_ETH_MAX_SIZE (1514U + 8) -static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_asix_rx_buffer[CONFIG_USBHOST_ASIX_ETH_MAX_SEGSZE]; -static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_asix_tx_buffer[CONFIG_USBHOST_ASIX_ETH_MAX_SEGSZE]; +static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_asix_rx_buffer[CONFIG_USBHOST_ASIX_ETH_MAX_SIZE]; +static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_asix_tx_buffer[CONFIG_USBHOST_ASIX_ETH_MAX_SIZE]; static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_asix_inttx_buffer[16]; USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_asix_buf[32]; @@ -683,7 +683,7 @@ find_class: g_asix_rx_length = 0; while (1) { - usbh_bulk_urb_fill(&g_asix_class.bulkin_urb, g_asix_class.hport, g_asix_class.bulkin, &g_asix_rx_buffer[g_asix_rx_length], USB_GET_MAXPACKETSIZE(g_asix_class.bulkin->wMaxPacketSize), USB_OSAL_WAITING_FOREVER, NULL, NULL); + usbh_bulk_urb_fill(&g_asix_class.bulkin_urb, g_asix_class.hport, g_asix_class.bulkin, &g_asix_rx_buffer[g_asix_rx_length], CONFIG_USBHOST_ASIX_ETH_MAX_SIZE, USB_OSAL_WAITING_FOREVER, NULL, NULL); ret = usbh_submit_urb(&g_asix_class.bulkin_urb); if (ret < 0) { goto find_class; @@ -720,7 +720,7 @@ find_class: USB_LOG_ERR("No memory to alloc pbuf for asix rx\r\n"); } } else { - if (g_asix_rx_length > CONFIG_USBHOST_ASIX_ETH_MAX_SEGSZE) { + if (g_asix_rx_length > CONFIG_USBHOST_ASIX_ETH_MAX_SIZE) { USB_LOG_ERR("Rx packet is overflow\r\n"); g_asix_rx_length = 0; }