Prechádzať zdrojové kódy

chore(kconfig): update rtthread pkg & master kconfig

Signed-off-by: sakumisu <1203593632@qq.com>
sakumisu 8 mesiacov pred
rodič
commit
a92b5488b0

+ 355 - 0
Kconfig.rtt

@@ -0,0 +1,355 @@
+# Kconfig file for package CherryUSB
+menuconfig RT_USING_CHERRYUSB
+    bool "Using USB with CherryUSB"
+    default n
+
+if RT_USING_CHERRYUSB
+
+    menuconfig RT_CHERRYUSB_DEVICE
+        bool "Enable usb device mode"
+        default n
+
+    if RT_CHERRYUSB_DEVICE
+        choice
+            prompt "Select usb device speed"
+            default RT_CHERRYUSB_DEVICE_SPEED_FS
+            config RT_CHERRYUSB_DEVICE_SPEED_FS
+                bool "FS"
+            config RT_CHERRYUSB_DEVICE_SPEED_HS
+                bool "HS"
+            config RT_CHERRYUSB_DEVICE_SPEED_AUTO
+                bool "AUTO"
+        endchoice
+
+        choice
+            prompt "Select usb device ip, and some ip need config in usb_config.h, please check"
+            default RT_CHERRYUSB_DEVICE_CUSTOM
+            config RT_CHERRYUSB_DEVICE_CUSTOM
+                bool "CUSTOM (Implement it yourself)"
+            config RT_CHERRYUSB_DEVICE_FSDEV_ST
+                bool "fsdev_st"
+            config RT_CHERRYUSB_DEVICE_FSDEV_CUSTOM
+                bool "fsdev_custom"
+            config RT_CHERRYUSB_DEVICE_DWC2_ST
+                bool "dwc2_st"
+            config RT_CHERRYUSB_DEVICE_DWC2_ESP
+                bool "dwc2_esp"
+            config RT_CHERRYUSB_DEVICE_DWC2_KENDRYTE
+                bool "dwc2_kendryte"
+            config RT_CHERRYUSB_DEVICE_DWC2_AT
+                bool "dwc2_at"
+            config RT_CHERRYUSB_DEVICE_DWC2_HC
+                bool "dwc2_hc"
+            config RT_CHERRYUSB_DEVICE_DWC2_GD
+                bool "dwc2_gd"
+            config RT_CHERRYUSB_DEVICE_DWC2_CUSTOM
+                bool "dwc2_custom"
+            config RT_CHERRYUSB_DEVICE_MUSB_ES
+                bool "musb_es"
+            config RT_CHERRYUSB_DEVICE_MUSB_SUNXI
+                bool "musb_sunxi"
+            config RT_CHERRYUSB_DEVICE_MUSB_BK
+                bool "musb_bk"
+            config RT_CHERRYUSB_DEVICE_MUSB_CUSTOM
+                bool "musb_custom"
+            config RT_CHERRYUSB_DEVICE_CHIPIDEA_MCX
+                bool "chipidea_mcx"
+            config RT_CHERRYUSB_DEVICE_CHIPIDEA_CUSTOM
+                bool "chipidea_custom"
+            config RT_CHERRYUSB_DEVICE_KINETIS_MCX
+                bool "kinetis_mcx"
+            config RT_CHERRYUSB_DEVICE_KINETIS_MM32
+                bool "kinetis_mm32"
+            config RT_CHERRYUSB_DEVICE_KINETIS_CUSTOM
+                bool "kinetis_custom"
+            config RT_CHERRYUSB_DEVICE_BL
+                bool "bouffalo"
+            config RT_CHERRYUSB_DEVICE_HPM
+                bool "hpm"
+            config RT_CHERRYUSB_DEVICE_AIC
+                bool "aic"
+            config RT_CHERRYUSB_DEVICE_RP2040
+                bool "rp2040"
+            config RT_CHERRYUSB_DEVICE_CH32
+                bool "ch32"
+            config RT_CHERRYUSB_DEVICE_PUSB2
+                bool "pusb2"
+            config RT_CHERRYUSB_DEVICE_NRF5X
+                bool "nrf5x"
+        endchoice
+
+        config RT_CHERRYUSB_DEVICE_CDC_ACM
+            bool
+            prompt "Enable usb cdc acm device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_HID
+            bool
+            prompt "Enable usb hid device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_MSC
+            bool
+            prompt "Enable usb msc device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_AUDIO
+            bool
+            prompt "Enable usb audio device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_VIDEO
+            bool
+            prompt "Enable usb video device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_CDC_RNDIS
+            bool
+            prompt "Enable usb cdc rndis device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_CDC_ECM
+            bool
+            prompt "Enable usb cdc ecm device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_CDC_NCM
+            bool
+            prompt "Enable usb cdc ncm device"
+            default n
+
+        config RT_CHERRYUSB_DEVICE_DFU
+            bool
+            prompt "Enable usb dfu device"
+            default n
+
+        choice
+            prompt "Select usb device template"
+            default RT_CHERRYUSB_DEVICE_TEMPLATE_NONE
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_NONE
+                bool "none (Implement it yourself)"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM
+                bool "cdc_acm"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_MSC
+                bool "msc_ram"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV
+                bool "msc_blkdev"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_HID_KEYBOARD
+                bool "hid_keyboard"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_HID_MOUSE
+                bool "hid_mouse"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_HID_CUSTOM
+                bool "hid_custom"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_VIDEO
+                bool "video"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_AUDIO_V1_MIC_SPEAKER
+                bool "audio_v1_mic_speaker_multichan"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_AUDIO_V2_MIC_SPEAKER
+                bool "audio_v2_mic_speaker_multichan"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_RNDIS
+                bool "cdc_rndis"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ECM
+                bool "cdc_ecm"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_NCM
+                bool "cdc_ncm"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_MSC
+                bool "cdc_acm_msc"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_MSC_HID
+                bool "cdc_acm_msc_hid"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV1
+                bool "winusbv1"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_CDC
+                bool "winusbv2_cdc"
+            config RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID
+                bool "winusbv2_hid"
+        endchoice
+
+        config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
+            string "usb device msc block device name"
+            depends on RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV
+            default "sd0"
+
+    endif
+
+    menuconfig RT_CHERRYUSB_HOST
+        bool "Enable usb host mode"
+        default n
+
+    if RT_CHERRYUSB_HOST
+        choice
+            prompt "Select usb host ip, and some ip need config in usb_config.h, please check"
+            default RT_CHERRYUSB_HOST_CUSTOM
+            config RT_CHERRYUSB_HOST_CUSTOM
+                bool "CUSTOM (Implement it yourself)"
+            config RT_CHERRYUSB_HOST_EHCI_BL
+                bool "ehci_bouffalo"
+            config RT_CHERRYUSB_HOST_EHCI_HPM
+                bool "ehci_hpm"
+            config RT_CHERRYUSB_HOST_EHCI_AIC
+                bool "ehci_aic"
+            config RT_CHERRYUSB_HOST_EHCI_MCX
+                bool "ehci_mcx"
+            config RT_CHERRYUSB_HOST_EHCI_NUC980
+                bool "ehci_nuc980"
+            config RT_CHERRYUSB_HOST_EHCI_MA35D0
+                bool "ehci_ma35d0"
+            config RT_CHERRYUSB_HOST_EHCI_CUSTOM
+                bool "ehci_custom"
+            config RT_CHERRYUSB_HOST_DWC2_ST
+                bool "dwc2_st"
+            config RT_CHERRYUSB_HOST_DWC2_ESP
+                bool "dwc2_esp"
+            config RT_CHERRYUSB_HOST_DWC2_KENDRYTE
+                bool "dwc2_kendryte"
+            config RT_CHERRYUSB_HOST_DWC2_HC
+                bool "dwc2_hc"
+            config RT_CHERRYUSB_HOST_DWC2_CUSTOM
+                bool "dwc2_custom"
+            config RT_CHERRYUSB_HOST_MUSB_ES
+                bool "musb_es"
+            config RT_CHERRYUSB_HOST_MUSB_SUNXI
+                bool "musb_sunxi"
+            config RT_CHERRYUSB_HOST_MUSB_BK
+                bool "musb_bk"
+            config RT_CHERRYUSB_HOST_MUSB_CUSTOM
+                bool "musb_custom"
+            config RT_CHERRYUSB_HOST_PUSB2
+                bool "pusb2"
+            config RT_CHERRYUSB_HOST_XHCI
+                bool "xhci"
+            config RT_CHERRYUSB_HOST_RP2040
+                bool "rp2040"
+        endchoice
+
+        config RT_CHERRYUSB_HOST_CDC_ACM
+            bool
+            prompt "Enable usb cdc acm driver"
+            default n
+
+        config RT_CHERRYUSB_HOST_HID
+            bool
+            prompt "Enable usb hid driver"
+            default n
+
+        config RT_CHERRYUSB_HOST_MSC
+            bool
+            prompt "Enable usb msc driver"
+            default n
+            select RT_USING_DFS
+            select RT_USING_DFS_ELMFAT
+
+        config RT_CHERRYUSB_HOST_CDC_ECM
+            bool
+            prompt "Enable usb cdc ecm driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_CDC_ECM
+            default n
+
+        config RT_CHERRYUSB_HOST_CDC_RNDIS
+            bool
+            prompt "Enable usb rndis driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_CDC_RNDIS
+            default n
+
+        config RT_CHERRYUSB_HOST_CDC_NCM
+            bool
+            prompt "Enable usb cdc ncm driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_CDC_NCM
+            default n
+
+        config RT_CHERRYUSB_HOST_VIDEO
+            bool
+            prompt "Enable usb video driver, it is commercial charge"
+            default n
+
+        config RT_CHERRYUSB_HOST_AUDIO
+            bool
+            prompt "Enable usb audio driver, it is commercial charge"
+            default n
+
+        config RT_CHERRYUSB_HOST_BLUETOOTH
+            bool
+            prompt "Enable usb bluetooth driver"
+            default n
+
+        config RT_CHERRYUSB_HOST_ASIX
+            bool
+            prompt "Enable usb asix driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_ASIX
+            default n
+
+        config RT_CHERRYUSB_HOST_RTL8152
+            bool
+            prompt "Enable usb rtl8152 driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_RTL8152
+            default n
+
+        config RT_CHERRYUSB_HOST_FTDI
+            bool
+            prompt "Enable usb ftdi driver"
+            default n
+
+        config RT_CHERRYUSB_HOST_CH34X
+            bool
+            prompt "Enable usb ch34x driver"
+            default n
+
+        config RT_CHERRYUSB_HOST_CP210X
+            bool
+            prompt "Enable usb cp210x driver"
+            default n
+
+        config RT_CHERRYUSB_HOST_PL2303
+            bool
+            prompt "Enable usb pl2303 driver"
+            default n
+
+        config CONFIG_USBHOST_PLATFORM_CDC_ECM
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_CDC_RNDIS
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_CDC_NCM
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_ASIX
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_RTL8152
+            bool
+
+        config RT_LWIP_PBUF_POOL_BUFSIZE
+            int "The size of each pbuf in the pbuf pool"
+            range 1500 2000
+            default 1600
+
+        config CONFIG_USB_DFS_MOUNT_POINT
+            string "usb host dfs mount point"
+            depends on RT_CHERRYUSB_HOST_MSC
+            default "/"
+
+        config RT_CHERRYUSB_HOST_TEMPLATE
+            bool
+            prompt "Use usb host template"
+            default n
+
+        if RT_CHERRYUSB_HOST_TEMPLATE
+            config TEST_USBH_CDC_ACM
+                int
+                prompt "demo for test cdc acm"
+                default 0
+                depends on CHERRYUSB_HOST_CDC_ACM
+            config TEST_USBH_HID
+                int
+                prompt "demo for test hid"
+                default 0
+                depends on CHERRYUSB_HOST_HID
+        endif
+    endif
+
+endif

+ 392 - 0
Kconfig.rttpkg

@@ -0,0 +1,392 @@
+# Kconfig file for package CherryUSB
+menuconfig PKG_USING_CHERRYUSB
+    depends on  RT_VER_NUM < 0x50200
+    bool "CherryUSB: tiny and portable USB host/device stack for embedded system with USB IP"
+    default n
+
+if PKG_USING_CHERRYUSB
+
+    menuconfig PKG_CHERRYUSB_DEVICE
+        bool "Enable usb device mode"
+        default n
+
+    if PKG_CHERRYUSB_DEVICE
+        choice
+            prompt "Select usb device speed"
+            default PKG_CHERRYUSB_DEVICE_SPEED_FS
+            config PKG_CHERRYUSB_DEVICE_SPEED_FS
+                bool "FS"
+            config PKG_CHERRYUSB_DEVICE_SPEED_HS
+                bool "HS"
+            config PKG_CHERRYUSB_DEVICE_SPEED_AUTO
+                bool "AUTO"
+        endchoice
+
+        choice
+            prompt "Select usb device ip, and some ip need config in usb_config.h, please check"
+            default PKG_CHERRYUSB_DEVICE_CUSTOM
+            config PKG_CHERRYUSB_DEVICE_CUSTOM
+                bool "CUSTOM (Implement it yourself)"
+            config PKG_CHERRYUSB_DEVICE_FSDEV_ST
+                bool "fsdev_st"
+            config PKG_CHERRYUSB_DEVICE_FSDEV_CUSTOM
+                bool "fsdev_custom"
+            config PKG_CHERRYUSB_DEVICE_DWC2_ST
+                bool "dwc2_st"
+            config PKG_CHERRYUSB_DEVICE_DWC2_ESP
+                bool "dwc2_esp"
+            config PKG_CHERRYUSB_DEVICE_DWC2_KENDRYTE
+                bool "dwc2_kendryte"
+            config PKG_CHERRYUSB_DEVICE_DWC2_AT
+                bool "dwc2_at"
+            config PKG_CHERRYUSB_DEVICE_DWC2_HC
+                bool "dwc2_hc"
+            config PKG_CHERRYUSB_DEVICE_DWC2_GD
+                bool "dwc2_gd"
+            config PKG_CHERRYUSB_DEVICE_DWC2_CUSTOM
+                bool "dwc2_custom"
+            config PKG_CHERRYUSB_DEVICE_MUSB_ES
+                bool "musb_es"
+            config PKG_CHERRYUSB_DEVICE_MUSB_SUNXI
+                bool "musb_sunxi"
+            config PKG_CHERRYUSB_DEVICE_MUSB_BK
+                bool "musb_bk"
+            config PKG_CHERRYUSB_DEVICE_MUSB_CUSTOM
+                bool "musb_custom"
+            config PKG_CHERRYUSB_DEVICE_CHIPIDEA_MCX
+                bool "chipidea_mcx"
+            config PKG_CHERRYUSB_DEVICE_CHIPIDEA_CUSTOM
+                bool "chipidea_custom"
+            config PKG_CHERRYUSB_DEVICE_KINETIS_MCX
+                bool "kinetis_mcx"
+            config PKG_CHERRYUSB_DEVICE_KINETIS_MM32
+                bool "kinetis_mm32"
+            config PKG_CHERRYUSB_DEVICE_KINETIS_CUSTOM
+                bool "kinetis_custom"
+            config PKG_CHERRYUSB_DEVICE_BL
+                bool "bouffalo"
+            config PKG_CHERRYUSB_DEVICE_HPM
+                bool "hpm"
+            config PKG_CHERRYUSB_DEVICE_AIC
+                bool "aic"
+            config PKG_CHERRYUSB_DEVICE_RP2040
+                bool "rp2040"
+            config PKG_CHERRYUSB_DEVICE_CH32
+                bool "ch32"
+            config PKG_CHERRYUSB_DEVICE_PUSB2
+                bool "pusb2"
+        endchoice
+
+        config PKG_CHERRYUSB_DEVICE_CDC_ACM
+            bool
+            prompt "Enable usb cdc acm device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_HID
+            bool
+            prompt "Enable usb hid device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_MSC
+            bool
+            prompt "Enable usb msc device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_AUDIO
+            bool
+            prompt "Enable usb audio device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_VIDEO
+            bool
+            prompt "Enable usb video device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_CDC_RNDIS
+            bool
+            prompt "Enable usb cdc rndis device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_CDC_ECM
+            bool
+            prompt "Enable usb cdc ecm device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_CDC_NCM
+            bool
+            prompt "Enable usb cdc ncm device"
+            default n
+
+        config PKG_CHERRYUSB_DEVICE_DFU
+            bool
+            prompt "Enable usb dfu device"
+            default n
+
+        choice
+            prompt "Select usb device template"
+            default PKG_CHERRYUSB_DEVICE_TEMPLATE_NONE
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_NONE
+                bool "none (Implement it yourself)"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM
+                bool "cdc_acm"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_MSC
+                bool "msc_ram"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV
+                bool "msc_blkdev"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_HID_KEYBOARD
+                bool "hid_keyboard"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_HID_MOUSE
+                bool "hid_mouse"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_HID_CUSTOM
+                bool "hid_custom"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_VIDEO
+                bool "video"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_AUDIO_V1_MIC_SPEAKER
+                bool "audio_v1_mic_speaker_multichan"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_AUDIO_V2_MIC_SPEAKER
+                bool "audio_v2_mic_speaker_multichan"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_RNDIS
+                bool "cdc_rndis"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ECM
+                bool "cdc_ecm"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_NCM
+                bool "cdc_ncm"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_MSC
+                bool "cdc_acm_msc"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_MSC_HID
+                bool "cdc_acm_msc_hid"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV1
+                bool "winusbv1"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_CDC
+                bool "winusbv2_cdc"
+            config PKG_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID
+                bool "winusbv2_hid"
+        endchoice
+
+        config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
+            string "usb device msc block device name"
+            depends on PKG_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV
+            default "sd0"
+
+    endif
+
+    menuconfig PKG_CHERRYUSB_HOST
+        bool "Enable usb host mode"
+        default n
+
+    if PKG_CHERRYUSB_HOST
+        choice
+            prompt "Select usb host ip, and some ip need config in usb_config.h, please check"
+            default PKG_CHERRYUSB_HOST_CUSTOM
+            config PKG_CHERRYUSB_HOST_CUSTOM
+                bool "CUSTOM (Implement it yourself)"
+            config PKG_CHERRYUSB_HOST_EHCI_BL
+                bool "ehci_bouffalo"
+            config PKG_CHERRYUSB_HOST_EHCI_HPM
+                bool "ehci_hpm"
+            config PKG_CHERRYUSB_HOST_EHCI_AIC
+                bool "ehci_aic"
+            config PKG_CHERRYUSB_HOST_EHCI_MCX
+                bool "ehci_mcx"
+            config PKG_CHERRYUSB_HOST_EHCI_NUC980
+                bool "ehci_nuc980"
+            config PKG_CHERRYUSB_HOST_EHCI_MA35D0
+                bool "ehci_ma35d0"
+            config PKG_CHERRYUSB_HOST_EHCI_CUSTOM
+                bool "ehci_custom"
+            config PKG_CHERRYUSB_HOST_DWC2_ST
+                bool "dwc2_st"
+            config PKG_CHERRYUSB_HOST_DWC2_ESP
+                bool "dwc2_esp"
+            config PKG_CHERRYUSB_HOST_DWC2_KENDRYTE
+                bool "dwc2_kendryte"
+            config PKG_CHERRYUSB_HOST_DWC2_HC
+                bool "dwc2_hc"
+            config PKG_CHERRYUSB_HOST_DWC2_CUSTOM
+                bool "dwc2_custom"
+            config PKG_CHERRYUSB_HOST_MUSB_ES
+                bool "musb_es"
+            config PKG_CHERRYUSB_HOST_MUSB_SUNXI
+                bool "musb_sunxi"
+            config PKG_CHERRYUSB_HOST_MUSB_BK
+                bool "musb_bk"
+            config PKG_CHERRYUSB_HOST_MUSB_CUSTOM
+                bool "musb_custom"
+            config PKG_CHERRYUSB_HOST_PUSB2
+                bool "pusb2"
+            config PKG_CHERRYUSB_HOST_XHCI
+                bool "xhci"
+            config PKG_CHERRYUSB_HOST_RP2040
+                bool "rp2040"
+        endchoice
+
+        config PKG_CHERRYUSB_HOST_CDC_ACM
+            bool
+            prompt "Enable usb cdc acm driver"
+            default n
+
+        config PKG_CHERRYUSB_HOST_HID
+            bool
+            prompt "Enable usb hid driver"
+            default n
+
+        config PKG_CHERRYUSB_HOST_MSC
+            bool
+            prompt "Enable usb msc driver"
+            default n
+            select RT_USING_DFS
+            select RT_USING_DFS_ELMFAT
+
+        config PKG_CHERRYUSB_HOST_CDC_ECM
+            bool
+            prompt "Enable usb cdc ecm driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_CDC_ECM
+            default n
+
+        config PKG_CHERRYUSB_HOST_CDC_RNDIS
+            bool
+            prompt "Enable usb rndis driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_CDC_RNDIS
+            default n
+
+        config PKG_CHERRYUSB_HOST_CDC_NCM
+            bool
+            prompt "Enable usb cdc ncm driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_CDC_NCM
+            default n
+
+        config PKG_CHERRYUSB_HOST_VIDEO
+            bool
+            prompt "Enable usb video driver, it is commercial charge"
+            default n
+
+        config PKG_CHERRYUSB_HOST_AUDIO
+            bool
+            prompt "Enable usb audio driver, it is commercial charge"
+            default n
+
+        config PKG_CHERRYUSB_HOST_BLUETOOTH
+            bool
+            prompt "Enable usb bluetooth driver"
+            default n
+
+        config PKG_CHERRYUSB_HOST_ASIX
+            bool
+            prompt "Enable usb asix driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_ASIX
+            default n
+
+        config PKG_CHERRYUSB_HOST_RTL8152
+            bool
+            prompt "Enable usb rtl8152 driver"
+            select RT_USING_LWIP
+            select CONFIG_USBHOST_PLATFORM_RTL8152
+            default n
+
+        config PKG_CHERRYUSB_HOST_FTDI
+            bool
+            prompt "Enable usb ftdi driver"
+            default n
+
+        config PKG_CHERRYUSB_HOST_CH34X
+            bool
+            prompt "Enable usb ch34x driver"
+            default n
+
+        config PKG_CHERRYUSB_HOST_CP210X
+            bool
+            prompt "Enable usb cp210x driver"
+            default n
+
+        config PKG_CHERRYUSB_HOST_PL2303
+            bool
+            prompt "Enable usb pl2303 driver"
+            default n
+
+        config CONFIG_USBHOST_PLATFORM_CDC_ECM
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_CDC_RNDIS
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_CDC_NCM
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_ASIX
+            bool
+
+        config CONFIG_USBHOST_PLATFORM_RTL8152
+            bool
+
+        config RT_LWIP_PBUF_POOL_BUFSIZE
+            int "The size of each pbuf in the pbuf pool"
+            range 1500 2000
+            default 1600
+
+        config CONFIG_USB_DFS_MOUNT_POINT
+            string "usb host dfs mount point"
+            depends on RT_CHERRYUSB_HOST_MSC
+            default "/"
+
+        config PKG_CHERRYUSB_HOST_TEMPLATE
+            bool
+            prompt "Use usb host template"
+            default n
+
+        if PKG_CHERRYUSB_HOST_TEMPLATE
+            config TEST_USBH_CDC_ACM
+                int
+                prompt "demo for test cdc acm"
+                default 0
+                depends on PKG_CHERRYUSB_HOST_CDC_ACM
+            config TEST_USBH_HID
+                int
+                prompt "demo for test hid"
+                default 0
+                depends on PKG_CHERRYUSB_HOST_HID
+        endif
+    endif
+
+    config PKG_CHERRYUSB_PATH
+        string
+        default "/packages/system/CherryUSB"
+
+    choice
+        prompt "Version"
+        default PKG_USING_CHERRYUSB_V010403
+        help
+            Select the package version
+
+        config PKG_USING_CHERRYUSB_LATEST_VERSION
+            bool "latest"
+        config PKG_USING_CHERRYUSB_V010403
+            bool "v1.4.3"
+        config PKG_USING_CHERRYUSB_V010402
+            bool "v1.4.2"
+        config PKG_USING_CHERRYUSB_V010400
+            bool "v1.4.0"
+        config PKG_USING_CHERRYUSB_V010301
+            bool "v1.3.1"
+        config PKG_USING_CHERRYUSB_V010300
+            bool "v1.3.0"
+        config PKG_USING_CHERRYUSB_V010200
+            bool "v1.2.0"
+        config PKG_USING_CHERRYUSB_V001002
+            bool "v0.10.2"
+    endchoice
+
+    config PKG_CHERRYUSB_VER
+       string
+       default "latest"    if PKG_USING_CHERRYUSB_LATEST_VERSION
+       default "v1.4.3"   if PKG_USING_CHERRYUSB_V010403
+       default "v1.4.2"   if PKG_USING_CHERRYUSB_V010402
+       default "v1.4.0"   if PKG_USING_CHERRYUSB_V010400
+       default "v1.3.1"   if PKG_USING_CHERRYUSB_V010301
+       default "v1.3.0"   if PKG_USING_CHERRYUSB_V010300
+       default "v1.2.0"   if PKG_USING_CHERRYUSB_V010200
+       default "v0.10.2"   if PKG_USING_CHERRYUSB_V001002
+endif

+ 1 - 1
SConscript

@@ -30,7 +30,7 @@ if GetDepend(['PKG_CHERRYUSB_DEVICE']):
     src += Glob('core/usbd_core.c')
     src += Glob('osal/usb_osal_rtthread.c')
 
-    if GetDepend(['PKG_CHERRYUSB_DEVICE_HS']):
+    if GetDepend(['PKG_CHERRYUSB_DEVICE_SPEED_HS']):
         CPPDEFINES+=['CONFIG_USB_HS']
 
     if GetDepend(['PKG_CHERRYUSB_DEVICE_FSDEV_ST']):

+ 45 - 0
demo/msc_ram_template.c

@@ -189,6 +189,7 @@ static void usbd_event_handler(uint8_t busid, uint8_t event)
     }
 }
 
+#if !defined(RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV) && !defined(PKG_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV)
 #define BLOCK_SIZE  512
 #define BLOCK_COUNT 10
 
@@ -217,11 +218,55 @@ int usbd_msc_sector_write(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *
         memcpy(mass_block[sector].BlockSpace, buffer, length);
     return 0;
 }
+#else
+#include <rtthread.h>
+#include <rtdevice.h>
+
+#ifndef CONFIG_USBDEV_MSC_THREAD
+#error "Please enable CONFIG_USBDEV_MSC_THREAD, move msc read & write from isr to thread"
+#endif
+
+#ifndef CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
+#define CONFIG_USBDEV_MSC_BLOCK_DEV_NAME "sd0"
+#endif
+
+static rt_device_t blk_dev = RT_NULL;
+struct rt_device_blk_geometry geometry = { 0 };
+
+void usbd_msc_get_cap(uint8_t busid, uint8_t lun, uint32_t *block_num, uint32_t *block_size)
+{
+    rt_device_control(blk_dev, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
+
+    *block_num = geometry.sector_count;
+    *block_size = geometry.bytes_per_sector;
+}
+
+int usbd_msc_sector_read(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length)
+{
+    rt_device_read(blk_dev, sector, buffer, length / geometry.bytes_per_sector);
+    return 0;
+}
+
+int usbd_msc_sector_write(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length)
+{
+    rt_device_write(blk_dev, sector, buffer, length / geometry.bytes_per_sector);
+    return 0;
+}
+#endif
 
 static struct usbd_interface intf0;
 
 void msc_ram_init(uint8_t busid, uintptr_t reg_base)
 {
+#if defined(RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV) || defined(PKG_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV)
+    rt_err_t res;
+
+    blk_dev = rt_device_find(CONFIG_USBDEV_MSC_BLOCK_DEV_NAME);
+    RT_ASSERT(blk_dev);
+
+    res = rt_device_open(blk_dev, RT_DEVICE_OFLAG_RDWR);
+    RT_ASSERT(res == RT_EOK);
+#endif
 #ifdef CONFIG_USBDEV_ADVANCE_DESC
     usbd_desc_register(busid, &msc_ram_descriptor);
 #else

+ 1 - 1
platform/rtthread/usb_check.c

@@ -1,6 +1,6 @@
 #include "rtthread.h"
 
-#ifdef PKG_CHERRYUSB_HOST
+#if defined(PKG_CHERRYUSB_HOST) || defined(RT_CHERRYUSB_HOST)
 
 #ifndef RT_USING_TIMER_SOFT
 #error must enable RT_USING_TIMER_SOFT to support timer callback in thread

+ 1 - 1
platform/rtthread/usb_msh.c

@@ -5,7 +5,7 @@
  */
 #include "rtthread.h"
 
-#ifdef PKG_CHERRYUSB_HOST
+#if defined(PKG_CHERRYUSB_HOST) || defined(RT_CHERRYUSB_HOST)
 
 #include "usbh_core.h"
 

+ 0 - 175
platform/rtthread/usbd_msc_blkdev.c

@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2024, sakumisu
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-#include "usbd_core.h"
-#include "usbd_msc.h"
-
-#ifndef CONFIG_USBDEV_MSC_THREAD
-#error "Please enable CONFIG_USBDEV_MSC_THREAD, move msc read & write from isr to thread"
-#endif
-
-#define MSC_IN_EP  0x81
-#define MSC_OUT_EP 0x02
-
-#define USBD_VID           0xFFFF
-#define USBD_PID           0xFFFF
-#define USBD_MAX_POWER     100
-#define USBD_LANGID_STRING 1033
-
-#define USB_CONFIG_SIZE (9 + MSC_DESCRIPTOR_LEN)
-
-#ifdef CONFIG_USB_HS
-#define MSC_MAX_MPS 512
-#else
-#define MSC_MAX_MPS 64
-#endif
-
-const uint8_t msc_storage_descriptor[] = {
-    USB_DEVICE_DESCRIPTOR_INIT(USB_2_0, 0x00, 0x00, 0x00, USBD_VID, USBD_PID, 0x0200, 0x01),
-    USB_CONFIG_DESCRIPTOR_INIT(USB_CONFIG_SIZE, 0x01, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER),
-    MSC_DESCRIPTOR_INIT(0x00, MSC_OUT_EP, MSC_IN_EP, MSC_MAX_MPS, 0x02),
-    ///////////////////////////////////////
-    /// string0 descriptor
-    ///////////////////////////////////////
-    USB_LANGID_INIT(USBD_LANGID_STRING),
-    ///////////////////////////////////////
-    /// string1 descriptor
-    ///////////////////////////////////////
-    0x14,                       /* bLength */
-    USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */
-    'C', 0x00,                  /* wcChar0 */
-    'h', 0x00,                  /* wcChar1 */
-    'e', 0x00,                  /* wcChar2 */
-    'r', 0x00,                  /* wcChar3 */
-    'r', 0x00,                  /* wcChar4 */
-    'y', 0x00,                  /* wcChar5 */
-    'U', 0x00,                  /* wcChar6 */
-    'S', 0x00,                  /* wcChar7 */
-    'B', 0x00,                  /* wcChar8 */
-    ///////////////////////////////////////
-    /// string2 descriptor
-    ///////////////////////////////////////
-    0x26,                       /* bLength */
-    USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */
-    'C', 0x00,                  /* wcChar0 */
-    'h', 0x00,                  /* wcChar1 */
-    'e', 0x00,                  /* wcChar2 */
-    'r', 0x00,                  /* wcChar3 */
-    'r', 0x00,                  /* wcChar4 */
-    'y', 0x00,                  /* wcChar5 */
-    'U', 0x00,                  /* wcChar6 */
-    'S', 0x00,                  /* wcChar7 */
-    'B', 0x00,                  /* wcChar8 */
-    ' ', 0x00,                  /* wcChar9 */
-    'M', 0x00,                  /* wcChar10 */
-    'S', 0x00,                  /* wcChar11 */
-    'C', 0x00,                  /* wcChar12 */
-    ' ', 0x00,                  /* wcChar13 */
-    'D', 0x00,                  /* wcChar14 */
-    'E', 0x00,                  /* wcChar15 */
-    'M', 0x00,                  /* wcChar16 */
-    'O', 0x00,                  /* wcChar17 */
-    ///////////////////////////////////////
-    /// string3 descriptor
-    ///////////////////////////////////////
-    0x16,                       /* bLength */
-    USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */
-    '2', 0x00,                  /* wcChar0 */
-    '0', 0x00,                  /* wcChar1 */
-    '2', 0x00,                  /* wcChar2 */
-    '2', 0x00,                  /* wcChar3 */
-    '1', 0x00,                  /* wcChar4 */
-    '2', 0x00,                  /* wcChar5 */
-    '3', 0x00,                  /* wcChar6 */
-    '4', 0x00,                  /* wcChar7 */
-    '5', 0x00,                  /* wcChar8 */
-    '6', 0x00,                  /* wcChar9 */
-#ifdef CONFIG_USB_HS
-    ///////////////////////////////////////
-    /// device qualifier descriptor
-    ///////////////////////////////////////
-    0x0a,
-    USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER,
-    0x00,
-    0x02,
-    0x00,
-    0x00,
-    0x00,
-    0x40,
-    0x00,
-    0x00,
-#endif
-    0x00
-};
-
-struct usbd_interface intf0;
-
-#ifndef CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
-#define CONFIG_USBDEV_MSC_BLOCK_DEV_NAME "sd0"
-#endif
-
-static rt_device_t blk_dev = RT_NULL;
-struct rt_device_blk_geometry geometry = { 0 };
-
-static void usbd_event_handler(uint8_t busid, uint8_t event)
-{
-    switch (event) {
-        case USBD_EVENT_RESET:
-            break;
-        case USBD_EVENT_CONNECTED:
-            break;
-        case USBD_EVENT_DISCONNECTED:
-            break;
-        case USBD_EVENT_RESUME:
-            break;
-        case USBD_EVENT_SUSPEND:
-            break;
-        case USBD_EVENT_CONFIGURED:
-            break;
-        case USBD_EVENT_SET_REMOTE_WAKEUP:
-            break;
-        case USBD_EVENT_CLR_REMOTE_WAKEUP:
-            break;
-
-        default:
-            break;
-    }
-}
-
-void usbd_msc_get_cap(uint8_t busid, uint8_t lun, uint32_t *block_num, uint32_t *block_size)
-{
-    rt_device_control(blk_dev, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
-
-    *block_num = geometry.sector_count;
-    *block_size = geometry.bytes_per_sector;
-}
-
-int usbd_msc_sector_read(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length)
-{
-    rt_device_read(blk_dev, sector, buffer, length / geometry.bytes_per_sector);
-    return 0;
-}
-
-int usbd_msc_sector_write(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length)
-{
-    rt_device_write(blk_dev, sector, buffer, length / geometry.bytes_per_sector);
-    return 0;
-}
-
-void msc_storage_init(uint8_t busid, uintptr_t reg_base)
-{
-    rt_err_t res;
-
-    blk_dev = rt_device_find(CONFIG_USBDEV_MSC_BLOCK_DEV_NAME);
-    RT_ASSERT(blk_dev);
-
-    res = rt_device_open(blk_dev, RT_DEVICE_OFLAG_RDWR);
-    RT_ASSERT(res == RT_EOK);
-
-    usbd_desc_register(busid, msc_storage_descriptor);
-    usbd_add_interface(busid, usbd_msc_init_intf(busid, &intf0, MSC_OUT_EP, MSC_IN_EP));
-
-    usbd_initialize(busid, reg_base, usbd_event_handler);
-}