refactor(serial): add host serial framework

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-12-12 22:45:10 +08:00
parent 707e865627
commit da2263728a
43 changed files with 4649 additions and 3297 deletions

View File

@@ -158,7 +158,7 @@
#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 2
#define CONFIG_USBHOST_MAX_ENDPOINTS 4
#define CONFIG_USBHOST_MAX_CDC_ACM_CLASS 4
#define CONFIG_USBHOST_MAX_SERIAL_CLASS 4
#define CONFIG_USBHOST_MAX_HID_CLASS 4
#define CONFIG_USBHOST_MAX_MSC_CLASS 2
#define CONFIG_USBHOST_MAX_AUDIO_CLASS 1
@@ -193,6 +193,10 @@
#define CONFIG_USBHOST_MSC_TIMEOUT 5000
#endif
#ifndef CONFIG_USBHOST_SERIAL_RX_SIZE
#define CONFIG_USBHOST_SERIAL_RX_SIZE 2048
#endif
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
*/

View File

@@ -47,7 +47,7 @@
#define USBD_MAX_POWER 200
/* attribute data into no cache ram */
#define USB_NOCACHE_RAM_SECTION __attribute__((section(".fast_ram.non_init")))
#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable.non_init")))
/* use usb_memcpy default for high performance but cost more flash memory.
* And, arm libc has a bug that memcpy() may cause data misalignment when the size is not a multiple of 4.
@@ -174,7 +174,7 @@
#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 2
#define CONFIG_USBHOST_MAX_ENDPOINTS 4
#define CONFIG_USBHOST_MAX_CDC_ACM_CLASS 4
#define CONFIG_USBHOST_MAX_SERIAL_CLASS 4
#define CONFIG_USBHOST_MAX_HID_CLASS 4
#define CONFIG_USBHOST_MAX_MSC_CLASS 2
#define CONFIG_USBHOST_MAX_AUDIO_CLASS 1
@@ -209,6 +209,10 @@
#define CONFIG_USBHOST_MSC_TIMEOUT 5000
#endif
#ifndef CONFIG_USBHOST_SERIAL_RX_SIZE
#define CONFIG_USBHOST_SERIAL_RX_SIZE 2048
#endif
/* This parameter affects usb performance, and depends on (TCP_WND)tcp eceive windows size,
* you can change to 2K ~ 16K and must be larger than TCP RX windows size in order to avoid being overflow.
*/

View File

@@ -17,6 +17,7 @@
#include "hpm_gpio_drv.h"
#include "shell.h"
#include "usbh_core.h"
#include "usbh_serial.h"
#include "lwip/tcpip.h"
#ifdef CONFIG_USB_EHCI_ISO
#include "usbh_uvc_stream.h"
@@ -116,6 +117,7 @@ static void task_start(void *param)
}
CSH_CMD_EXPORT(lsusb, );
CSH_CMD_EXPORT(usbh_serial, );
#ifdef CONFIG_USB_EHCI_ISO
// clang-format off