diff --git a/bsp/bouffalo_lab/bl61x/.config b/bsp/bouffalo_lab/bl61x/.config index 309a0e5da4..42641f3e09 100644 --- a/bsp/bouffalo_lab/bl61x/.config +++ b/bsp/bouffalo_lab/bl61x/.config @@ -14,7 +14,6 @@ CONFIG_RT_THREAD_PRIORITY_32=y # CONFIG_RT_THREAD_PRIORITY_256 is not set CONFIG_RT_THREAD_PRIORITY_MAX=32 CONFIG_RT_TICK_PER_SECOND=1000 -CONFIG_RT_USING_OVERFLOW_CHECK=y CONFIG_RT_USING_HOOK=y CONFIG_RT_HOOK_USING_FUNC_PTR=y # CONFIG_RT_USING_HOOKLIST is not set @@ -24,6 +23,8 @@ CONFIG_IDLE_THREAD_STACK_SIZE=2048 CONFIG_RT_USING_TIMER_SOFT=y CONFIG_RT_TIMER_THREAD_PRIO=4 CONFIG_RT_TIMER_THREAD_STACK_SIZE=2048 +# CONFIG_RT_USING_TIMER_ALL_SOFT is not set +# CONFIG_RT_USING_CPU_USAGE_TRACER is not set # # kservice optimization @@ -44,6 +45,7 @@ CONFIG_RT_DEBUGING_ASSERT=y CONFIG_RT_DEBUGING_COLOR=y CONFIG_RT_DEBUGING_CONTEXT=y # CONFIG_RT_DEBUGING_AUTO_INIT is not set +CONFIG_RT_USING_OVERFLOW_CHECK=y # # Inter-Thread communication @@ -171,6 +173,7 @@ CONFIG_RT_USING_DFS_ROMFS=y # Device Drivers # # CONFIG_RT_USING_DM is not set +# CONFIG_RT_USING_DEV_BUS is not set CONFIG_RT_USING_DEVICE_IPC=y CONFIG_RT_UNAMED_PIPE_NUMBER=64 # CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set @@ -189,6 +192,8 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_ZERO is not set # CONFIG_RT_USING_RANDOM is not set # CONFIG_RT_USING_PWM is not set +# CONFIG_RT_USING_PULSE_ENCODER is not set +# CONFIG_RT_USING_INPUT_CAPTURE is not set # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set # CONFIG_RT_USING_PM is not set @@ -207,51 +212,12 @@ CONFIG_RT_MMCSD_MAX_PARTITION=16 # CONFIG_RT_USING_TOUCH is not set # CONFIG_RT_USING_LCD is not set # CONFIG_RT_USING_HWCRYPTO is not set -# CONFIG_RT_USING_PULSE_ENCODER is not set -# CONFIG_RT_USING_INPUT_CAPTURE is not set -# CONFIG_RT_USING_DEV_BUS is not set # CONFIG_RT_USING_WIFI is not set # CONFIG_RT_USING_VIRTIO is not set CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_KTIME is not set # CONFIG_RT_USING_HWTIMER is not set -CONFIG_RT_USING_CHERRYUSB=y -# CONFIG_RT_CHERRYUSB_DEVICE is not set -CONFIG_RT_CHERRYUSB_HOST=y -# CONFIG_RT_CHERRYUSB_HOST_CUSTOM is not set -CONFIG_RT_CHERRYUSB_HOST_EHCI_BL=y -# CONFIG_RT_CHERRYUSB_HOST_EHCI_HPM is not set -# CONFIG_RT_CHERRYUSB_HOST_EHCI_AIC is not set -# CONFIG_RT_CHERRYUSB_HOST_EHCI_NUVOTON_NUC980 is not set -# CONFIG_RT_CHERRYUSB_HOST_EHCI_NUVOTON_MA35D0 is not set -# CONFIG_RT_CHERRYUSB_HOST_EHCI_CUSTOM is not set -# CONFIG_RT_CHERRYUSB_HOST_DWC2_ST is not set -# CONFIG_RT_CHERRYUSB_HOST_DWC2_ESP is not set -# CONFIG_RT_CHERRYUSB_HOST_DWC2_CUSTOM is not set -# CONFIG_RT_CHERRYUSB_HOST_MUSB_STANDARD is not set -# CONFIG_RT_CHERRYUSB_HOST_MUSB_SUNXI is not set -# CONFIG_RT_CHERRYUSB_HOST_MUSB_CUSTOM is not set -# CONFIG_RT_CHERRYUSB_HOST_PUSB2 is not set -# CONFIG_RT_CHERRYUSB_HOST_XHCI is not set -CONFIG_RT_CHERRYUSB_HOST_CDC_ACM=y -CONFIG_RT_CHERRYUSB_HOST_HID=y -CONFIG_RT_CHERRYUSB_HOST_MSC=y -# CONFIG_RT_CHERRYUSB_HOST_CDC_RNDIS is not set -# CONFIG_RT_CHERRYUSB_HOST_CDC_ECM is not set -# CONFIG_RT_CHERRYUSB_HOST_CDC_NCM is not set -# CONFIG_RT_CHERRYUSB_HOST_VIDEO is not set -# CONFIG_RT_CHERRYUSB_HOST_AUDIO is not set -# CONFIG_RT_CHERRYUSB_HOST_BLUETOOTH is not set -# CONFIG_RT_CHERRYUSB_HOST_ASIX is not set -# CONFIG_RT_CHERRYUSB_HOST_RTL8152 is not set -# CONFIG_RT_CHERRYUSB_HOST_FTDI is not set -# CONFIG_RT_CHERRYUSB_HOST_CH34X is not set -# CONFIG_RT_CHERRYUSB_HOST_CP210X is not set -# CONFIG_RT_CHERRYUSB_HOST_PL2303 is not set -CONFIG_RT_CHERRYUSB_HOST_TEMPLATE=y -CONFIG_TEST_USBH_CDC_ACM=1 -CONFIG_TEST_USBH_HID=1 -CONFIG_TEST_USBH_MSC=0 +# CONFIG_RT_USING_CHERRYUSB is not set # end of Device Drivers # @@ -335,6 +301,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_RT_USING_USB_HOST is not set # CONFIG_RT_USING_USB_DEVICE is not set # end of Using USB legacy version + +# CONFIG_RT_USING_FDT is not set # end of RT-Thread Components # @@ -362,6 +330,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_FREEMODBUS is not set # CONFIG_PKG_USING_NANOPB is not set +# CONFIG_PKG_USING_WIFI_HOST_DRIVER is not set # # Wi-Fi @@ -494,6 +463,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_JSMN is not set # CONFIG_PKG_USING_AGILE_JSMN is not set # CONFIG_PKG_USING_PARSON is not set +# CONFIG_PKG_USING_RYAN_JSON is not set # end of JSON: JavaScript Object Notation, a lightweight data-interchange format # @@ -612,6 +582,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set # end of enhanced kernel services +# CONFIG_PKG_USING_AUNITY is not set + # # acceleration: Assembly language or algorithmic acceleration packages # @@ -702,12 +674,29 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # # STM32 HAL & SDK Drivers # +# CONFIG_PKG_USING_STM32F4_HAL_DRIVER is not set +# CONFIG_PKG_USING_STM32F4_CMSIS_DRIVER is not set # CONFIG_PKG_USING_STM32L4_HAL_DRIVER is not set # CONFIG_PKG_USING_STM32L4_CMSIS_DRIVER is not set # CONFIG_PKG_USING_STM32WB55_SDK is not set # CONFIG_PKG_USING_STM32_SDIO is not set # end of STM32 HAL & SDK Drivers +# +# Infineon HAL Packages +# +# CONFIG_PKG_USING_INFINEON_CAT1CM0P is not set +# CONFIG_PKG_USING_INFINEON_CMSIS is not set +# CONFIG_PKG_USING_INFINEON_CORE_LIB is not set +# CONFIG_PKG_USING_INFINEON_MTB_HAL_CAT1 is not set +# CONFIG_PKG_USING_INFINEON_MTB_PDL_CAT1 is not set +# CONFIG_PKG_USING_INFINEON_RETARGET_IO is not set +# CONFIG_PKG_USING_INFINEON_CAPSENSE is not set +# CONFIG_PKG_USING_INFINEON_CSDIDAC is not set +# CONFIG_PKG_USING_INFINEON_SERIAL_FLASH is not set +# CONFIG_PKG_USING_INFINEON_USBDEV is not set +# end of Infineon HAL Packages + # CONFIG_PKG_USING_BLUETRUM_SDK is not set # CONFIG_PKG_USING_EMBARC_BSP is not set # CONFIG_PKG_USING_ESP_IDF is not set @@ -881,6 +870,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_SYSTEM_RUN_LED is not set # CONFIG_PKG_USING_BT_MX01 is not set # CONFIG_PKG_USING_RGPOWER is not set +# CONFIG_PKG_USING_BT_MX02 is not set # CONFIG_PKG_USING_SPI_TOOLS is not set # end of peripheral libraries and drivers @@ -902,6 +892,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # # Signal Processing and Control Algorithm Packages # +# CONFIG_PKG_USING_APID is not set # CONFIG_PKG_USING_FIRE_PID_CURVE is not set # CONFIG_PKG_USING_QPID is not set # CONFIG_PKG_USING_UKAL is not set @@ -989,6 +980,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set # CONFIG_PKG_USING_ARDUINO_SKETCH_LOADER_DEMO is not set # CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set +# CONFIG_PKG_USING_ARDUINO_RTDUINO_SENSORFUSION_SHIELD is not set # CONFIG_PKG_USING_ARDUINO_NINEINONE_SENSOR_SHIELD is not set # CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set # CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set @@ -1219,6 +1211,7 @@ CONFIG_BSP_USING_ROMAPI=y # CONFIG_BSP_USING_PSRAM is not set CONFIG_BSP_USING_BL61X_MODULE_DEFAULT=y # CONFIG_BSP_USING_BL61X_MODULE_M0P is not set +# CONFIG_BSP_USING_USB is not set # # General Drivers Configuration diff --git a/bsp/bouffalo_lab/bl61x/applications/main.c b/bsp/bouffalo_lab/bl61x/applications/main.c index 4d11a45f4c..06daf23dd4 100644 --- a/bsp/bouffalo_lab/bl61x/applications/main.c +++ b/bsp/bouffalo_lab/bl61x/applications/main.c @@ -9,9 +9,6 @@ */ #include -#include -#include -#include "drv_gpio.h" int main(void) { diff --git a/bsp/bouffalo_lab/bl61x/board/Kconfig b/bsp/bouffalo_lab/bl61x/board/Kconfig index 408952e8ed..1b46f07755 100755 --- a/bsp/bouffalo_lab/bl61x/board/Kconfig +++ b/bsp/bouffalo_lab/bl61x/board/Kconfig @@ -9,7 +9,7 @@ config BSP_USING_BL61X default y config BSP_USING_ROMAPI - bool + bool default y config BSP_USING_PSRAM @@ -27,3 +27,29 @@ choice bool "M0P Module" select BSP_USING_PSRAM endchoice + +menuconfig BSP_USING_USB + bool "Enable USB" + default n + if BSP_USING_USB + config BSP_USING_USB_DEVICE + bool "Enable USB Device, default is msc ramdisk" + default n + select RT_USING_CHERRYUSB + select RT_CHERRYUSB_DEVICE + select RT_CHERRYUSB_DEVICE_SPEED_HS + select RT_CHERRYUSB_DEVICE_BL + select RT_CHERRYUSB_DEVICE_MSC + select RT_CHERRYUSB_DEVICE_TEMPLATE_MSC + config BSP_USING_USB_HOST + bool "Enable USB Host" + default n + select RT_USING_CACHE + select RT_USING_CHERRYUSB + select RT_CHERRYUSB_HOST + select RT_CHERRYUSB_HOST_EHCI_BL + select RT_CHERRYUSB_HOST_CDC_ACM + select RT_CHERRYUSB_HOST_HID + select RT_CHERRYUSB_HOST_MSC + select RT_CHERRYUSB_HOST_CDC_RNDIS + endif diff --git a/bsp/bouffalo_lab/bl61x/board/cherryusb_port.c b/bsp/bouffalo_lab/bl61x/board/cherryusb_port.c index ecba0e6562..2a92418976 100644 --- a/bsp/bouffalo_lab/bl61x/board/cherryusb_port.c +++ b/bsp/bouffalo_lab/bl61x/board/cherryusb_port.c @@ -8,7 +8,30 @@ * 2024/04/23 sakumisu first version */ #include +#include /* low level init here, this has implemented in cherryusb */ /* low level deinit here, this has implemented in cherryusb */ + +#ifdef RT_CHERRYUSB_DEVICE_TEMPLATE_MSC +int cherryusb_devinit(void) +{ + extern void msc_ram_init(uint8_t busid, uintptr_t reg_base); + + msc_ram_init(0, 0x20072000); + return 0; +} +INIT_COMPONENT_EXPORT(cherryusb_devinit); +#endif + +#ifdef RT_CHERRYUSB_HOST +#include "usbh_core.h" + +int cherryusb_hostinit(void) +{ + usbh_initialize(0, 0x20072000); + return 0; +} +INIT_COMPONENT_EXPORT(cherryusb_hostinit); +#endif \ No newline at end of file diff --git a/bsp/bouffalo_lab/bl61x/board/usb_config.h b/bsp/bouffalo_lab/bl61x/board/usb_config.h index 1ecbb4dcca..d61ba9fc0d 100644 --- a/bsp/bouffalo_lab/bl61x/board/usb_config.h +++ b/bsp/bouffalo_lab/bl61x/board/usb_config.h @@ -6,20 +6,12 @@ #ifndef CHERRYUSB_CONFIG_H #define CHERRYUSB_CONFIG_H -#define CHERRYUSB_VERSION 0x010300 -#define CHERRYUSB_VERSION_STR "v1.3.0" +#include /* ================ USB common Configuration ================ */ -#include - #define CONFIG_USB_PRINTF(...) rt_kprintf(__VA_ARGS__) -#define usb_malloc(size) rt_malloc(size) -#define usb_free(ptr) rt_free(ptr) - -#define memcpy rt_memcpy - #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -76,6 +68,10 @@ #define CONFIG_USBDEV_MSC_VERSION_STRING "0.01" #endif +/* move msc read & write from isr to while(1), you should call usbd_msc_polling in while(1) */ +// #define CONFIG_USBDEV_MSC_POLLING + +/* move msc read & write from isr to thread */ // #define CONFIG_USBDEV_MSC_THREAD #ifndef CONFIG_USBDEV_MSC_PRIO @@ -172,6 +168,17 @@ #define CONFIG_USBHOST_CDC_NCM_ETH_MAX_TX_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. + */ +#ifndef CONFIG_USBHOST_ASIX_ETH_MAX_RX_SIZE +#define CONFIG_USBHOST_ASIX_ETH_MAX_RX_SIZE (2048) +#endif +/* Because lwip do not support multi pbuf at a time, so increasing this variable has no performance improvement */ +#ifndef CONFIG_USBHOST_ASIX_ETH_MAX_TX_SIZE +#define CONFIG_USBHOST_ASIX_ETH_MAX_TX_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. */ @@ -200,14 +207,18 @@ #endif #ifndef CONFIG_USBDEV_EP_NUM -#define CONFIG_USBDEV_EP_NUM 4 +#define CONFIG_USBDEV_EP_NUM 5 #endif /* ---------------- FSDEV Configuration ---------------- */ //#define CONFIG_USBDEV_FSDEV_PMA_ACCESS 2 // maybe 1 or 2, many chips may have a difference /* ---------------- DWC2 Configuration ---------------- */ +/* (5 * number of control endpoints + 8) + ((largest USB packet used / 4) + 1 for + * status information) + (2 * number of OUT endpoints) + 1 for Global NAK + */ // #define CONFIG_USB_DWC2_RXALL_FIFO_SIZE (1024 / 4) +/* IN Endpoints Max packet Size / 4 */ // #define CONFIG_USB_DWC2_TX0_FIFO_SIZE (64 / 4) // #define CONFIG_USB_DWC2_TX1_FIFO_SIZE (512 / 4) // #define CONFIG_USB_DWC2_TX2_FIFO_SIZE (64 / 4) diff --git a/bsp/bouffalo_lab/bl61x/rtconfig.h b/bsp/bouffalo_lab/bl61x/rtconfig.h index b2cbd54593..ab0287fcd4 100644 --- a/bsp/bouffalo_lab/bl61x/rtconfig.h +++ b/bsp/bouffalo_lab/bl61x/rtconfig.h @@ -9,7 +9,6 @@ #define RT_THREAD_PRIORITY_32 #define RT_THREAD_PRIORITY_MAX 32 #define RT_TICK_PER_SECOND 1000 -#define RT_USING_OVERFLOW_CHECK #define RT_USING_HOOK #define RT_HOOK_USING_FUNC_PTR #define RT_USING_IDLE_HOOK @@ -30,6 +29,7 @@ #define RT_DEBUGING_ASSERT #define RT_DEBUGING_COLOR #define RT_DEBUGING_CONTEXT +#define RT_USING_OVERFLOW_CHECK /* Inter-Thread communication */ @@ -125,16 +125,6 @@ #define RT_MMCSD_THREAD_PREORITY 22 #define RT_MMCSD_MAX_PARTITION 16 #define RT_USING_PIN -#define RT_USING_CHERRYUSB -#define RT_CHERRYUSB_HOST -#define RT_CHERRYUSB_HOST_EHCI_BL -#define RT_CHERRYUSB_HOST_CDC_ACM -#define RT_CHERRYUSB_HOST_HID -#define RT_CHERRYUSB_HOST_MSC -#define RT_CHERRYUSB_HOST_TEMPLATE -#define TEST_USBH_CDC_ACM 1 -#define TEST_USBH_HID 1 -#define TEST_USBH_MSC 0 /* end of Device Drivers */ /* C/C++ and POSIX layer */ @@ -273,6 +263,10 @@ /* end of STM32 HAL & SDK Drivers */ +/* Infineon HAL Packages */ + +/* end of Infineon HAL Packages */ + /* Kendryte SDK */ /* end of Kendryte SDK */