Skip to content

Commit ab12c40

Browse files
committed
update(cherryusb): update to v1.6.1
Signed-off-by: sakumisu <1203593632@qq.com>
1 parent ed74810 commit ab12c40

91 files changed

Lines changed: 2086 additions & 3012 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

components/drivers/usb/cherryusb/Kconfig

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,26 @@ if RT_USING_CHERRYUSB
139139
prompt "Enable usb dfu device"
140140
default n
141141

142+
config RT_CHERRYUSB_DEVICE_DISPLAY
143+
bool
144+
prompt "Enable usb display device"
145+
default n
146+
142147
config RT_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV
143148
bool
144149
prompt "Enable chardev for cdc acm device"
145150
default n
146151

152+
config RT_CHERRYUSB_DEVICE_MSC_BLKDEV
153+
bool
154+
prompt "Enable blkdev for msc device"
155+
default n
156+
157+
config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
158+
string "usb device msc block device name"
159+
depends on RT_CHERRYUSB_DEVICE_MSC_BLKDEV
160+
default "sd0"
161+
147162
config CONFIG_USBDEV_REQUEST_BUFFER_LEN
148163
int
149164
prompt "Set device control transfer max buffer size"
@@ -184,7 +199,7 @@ if RT_USING_CHERRYUSB
184199
config RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV
185200
bool
186201
prompt "msc_blkdev"
187-
depends on RT_CHERRYUSB_DEVICE_MSC
202+
depends on RT_CHERRYUSB_DEVICE_MSC && RT_CHERRYUSB_DEVICE_MSC_BLKDEV
188203
config RT_CHERRYUSB_DEVICE_TEMPLATE_HID_KEYBOARD
189204
bool
190205
prompt "hid_keyboard"
@@ -221,6 +236,10 @@ if RT_USING_CHERRYUSB
221236
bool
222237
prompt "cdc_ncm"
223238
depends on RT_CHERRYUSB_DEVICE_CDC_NCM
239+
config RT_CHERRYUSB_DEVICE_TEMPLATE_DFU
240+
bool
241+
prompt "dfu"
242+
depends on RT_CHERRYUSB_DEVICE_DFU
224243
config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_MSC
225244
bool
226245
prompt "cdc_acm_msc"
@@ -243,6 +262,10 @@ if RT_USING_CHERRYUSB
243262
bool
244263
prompt "webusb_hid"
245264
depends on RT_CHERRYUSB_DEVICE_HID
265+
config RT_CHERRYUSB_DEVICE_TEMPLATE_DISPLAY
266+
bool
267+
prompt "display"
268+
depends on RT_CHERRYUSB_DEVICE_DISPLAY
246269
config RT_CHERRYUSB_DEVICE_TEMPLATE_ADB
247270
bool
248271
prompt "adb"
@@ -253,11 +276,6 @@ if RT_USING_CHERRYUSB
253276
depends on RT_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV
254277
endchoice
255278

256-
config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
257-
string "usb device msc block device name"
258-
depends on RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV
259-
default "sd0"
260-
261279
endif
262280

263281
menuconfig RT_CHERRYUSB_HOST
@@ -470,22 +488,22 @@ if RT_USING_CHERRYUSB
470488
default "/"
471489

472490
menu "Select USB host template, please select class driver first"
473-
config CONFIG_TEST_USBH_SERIAL
491+
config RT_TEST_USBH_SERIAL
474492
bool
475493
prompt "demo for test seial, cannot enable this demo, you can use rt-thread device api to test"
476494
default n
477495
depends on CONFIG_USBHOST_SERIAL
478-
config CONFIG_TEST_USBH_HID
496+
config RT_TEST_USBH_HID
479497
int
480498
prompt "demo for test hid"
481499
default 0
482500
depends on RT_CHERRYUSB_HOST_HID
483-
config CONFIG_TEST_USBH_MSC
501+
config RT_TEST_USBH_MSC
484502
bool
485503
prompt "demo for test msc, cannot enable this demo, you can use rt-thread dfs api to test"
486504
default n
487505
depends on RT_CHERRYUSB_HOST_MSC
488-
config CONFIG_TEST_USBH_NET
506+
config RT_TEST_USBH_NET
489507
bool
490508
prompt "demo for test net, cannot enable this demo, you can use lwip api to test"
491509
default n

components/drivers/usb/cherryusb/README.md

Lines changed: 67 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ CherryUSB is a tiny and beautiful, high performance and portable USB host and de
1414

1515
## Why choose CherryUSB
1616

17-
### Easy to study USB
17+
### Easy to Learn USB
1818

19-
In order to make it easier for users to learn USB basics, enumeration, driver loading and IP drivers, the code has been written with the following advantages:
19+
To facilitate user learning of USB fundamentals, enumeration, driver loading, and IP drivers, the written code has the following advantages:
2020

21-
- Lean code, simple logic, no complex C syntax
22-
- Tree-based programming with cascading code
23-
- Class-drivers and porting-drivers are templating and simplification
24-
- Clear API classification (slave: initialisation, registration api, command callback api, data sending and receiving api; host: initialisation, lookup api, data sending and receiving api)
21+
- Streamlined code with simple logic and no complex C language syntax
22+
- Tree-structured programming with progressive code layers
23+
- Templated and simplified Class drivers and porting drivers
24+
- Clear API categorization (Device: initialization, class registration, command callbacks, data transmission; Host: initialization, class discovery, data transmission)
2525

26-
### Easy to use USB
26+
### Easy to Use USB
2727

28-
In order to facilitate the use of the USB interface and to take into account the fact that users have learned about uart and dma, the following advantages have been designed for the data sending and receiving class of interface:
28+
To facilitate user interaction with USB interfaces, considering users’ familiarity with UART and DMA, the designed data transmission interface has the following advantages:
2929

30-
- Equivalent to using uart tx dma/uart rx dma
31-
- There is no limit to the length of send and receive, the user does not need to care about the USB packetization process (the porting driver does it)
30+
- Equivalent to using UART TX DMA/UART RX DMA
31+
- No length restrictions on transmission/reception; users don’t need to worry about USB packetization (porting drivers handle packetization)
3232

33-
### Easy to bring out USB performance
33+
### Easy to Achieve USB Performance
3434

35-
Taking into account USB performance issues and trying to achieve the theoretical bandwidth of the USB hardware, the design of the data transceiver class interface has the following advantages:
35+
Considering USB performance requirements to reach theoretical USB hardware bandwidth, the designed data transmission interface has the following advantages:
3636

37-
- Porting drivers directly to registers, no abstraction layer encapsulation
37+
- Porting drivers directly interface with registers without abstraction layer encapsulation
3838
- Memory zero copy
39-
- If IP has DMA then uses DMA mode (DMA with hardware packetization)
40-
- Unlimited length make it easier to interface with hardware DMA and take advantage of DMA
41-
- Packetization is handled in interrupt
39+
- DMA mode used when IP supports DMA (DMA provides hardware packetization functionality)
40+
- No length restrictions, facilitating hardware DMA interfacing and maximizing DMA advantages
41+
- Packetization handled in interrupt context
4242

4343
Performance show:https://cherryusb.cherry-embedded.org/show/
4444

@@ -70,11 +70,13 @@ CherryUSB Device Stack has the following functions:
7070
- Support Mass Storage Class (MSC)
7171
- Support USB VIDEO CLASS (UVC1.0, UVC1.5)
7272
- Support USB AUDIO CLASS (UAC1.0, UAC2.0)
73+
- Support Remote NDIS (RNDIS)
7374
- Support Device Firmware Upgrade CLASS (DFU)
7475
- Support USB MIDI CLASS (MIDI)
75-
- Support Remote NDIS (RNDIS)
7676
- Support Media Transfer Protocol (MTP)
77+
- Support Test and Measurement Class (TMC)
7778
- Support WINUSB1.0, WINUSB2.0, WEBUSB, BOS
79+
- Support Vendor display ([xfz1986_usb_graphic_driver](https://github.com/chuanjinpang/win10_idd_xfz1986_usb_graphic_driver_display))
7880
- Support Vendor class
7981
- Support UF2
8082
- Support Android Debug Bridge (Only support shell)
@@ -84,15 +86,18 @@ CherryUSB Device Stack resource usage (GCC 10.2 with -O2, disable log):
8486

8587
| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) |
8688
|:-------------:|:--------------:|:-------------------------:|:-------------:|:----------------:|
87-
|usbd_core.c | ~4500 | (512(default) + 320) * bus | 0 | 0 |
88-
|usbd_cdc_acm.c | ~900 | 0 | 0 | 0 |
89-
|usbd_msc.c | ~5000 | (128 + 512(default)) * bus | 16 * bus | 0 |
90-
|usbd_hid.c | ~300 | 0 | 0 | 0 |
91-
|usbd_audio.c | ~4000 | 0 | 0 | 0 |
92-
|usbd_video.c | ~7000 | 0 | 132 * bus | 0 |
93-
|usbd_rndis.c | ~2500 | 2 * 1580(default)+156+8 | 80 | 0 |
94-
|usbd_cdc_ecm.c | ~900 | 2 * 1514(default)+16 | 42 | 0 |
89+
|usbd_core.c | ~4000 | (512(default) + 320) * bus | 8 | 0 |
90+
|usbd_cdc_acm.c | ~400 | 0 | 0 | 0 |
91+
|usbd_msc.c | ~3200 | (128 + 512(default)) * bus | 16 * bus | 0 |
92+
|usbd_hid.c | ~200 | 0 | 0 | 0 |
93+
|usbd_audio.c | ~1300 | 0 | 8 * bus | 0 |
94+
|usbd_video.c | ~2500 | 0 | 124 * bus | 0 |
95+
|usbd_rndis.c | ~2000 | 2 * 1580(default)+156+8 | 76 | 0 |
96+
|usbd_cdc_ecm.c | ~1500 | 2 * 1514(default)+16 | 42 | 0 |
9597
|usbd_mtp.c | ~9000 | 2048(default)+128 | sizeof(struct mtp_object) * n| 0 |
98+
|usbd_dfu.c | ~800 | 0 | 1 | 0 |
99+
100+
![usbdevice_usage](docs/assets/usbdevice_usage.png)
96101

97102
## Host Stack Overview
98103

@@ -111,6 +116,7 @@ CherryUSB Host Stack has the following functions:
111116
- Support USB Video CLASS (UVC1.0, UVC1.5)
112117
- Support USB Audio CLASS (UAC1.0)
113118
- Support Remote NDIS (RNDIS)
119+
- Support Device Firmware Upgrade CLASS (DFU)
114120
- Support USB Bluetooth class (support nimble and zephyr bluetooth stack, support **CLASS:0xE0** or vendor class like cdc acm)
115121
- Support Vendor Serial Class(CH34X、CP210X、PL2303、FTDI、GSM)
116122
- Support Vendor network Class(RTL8152、AX88772)
@@ -124,19 +130,27 @@ CherryUSB Host Stack resource usage (GCC 10.2 with -O2, disable log):
124130

125131
| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) |
126132
|:-------------:|:--------------:|:-------------------------------:|:---------------------------:|:------------:|
127-
|usbh_core.c | ~4500 | (512(default) + 8 * (1+x) *n) * bus | sizeof(struct usbh_hub) * bus | raw_config_desc |
128-
|usbh_hub.c | ~3500 | (32 + 4 * (1+x)) * bus | 12 + sizeof(struct usbh_hub) * x | 0 |
129-
|usbh_cdc_acm.c | ~600 | 7 * x | 4 + sizeof(struct usbh_cdc_acm) * x | 0 |
130-
|usbh_msc.c | ~2000 | 128 * x | 4 + sizeof(struct usbh_msc) * x | 0 |
131-
|usbh_hid.c | ~800 | 64 * x | 4 + sizeof(struct usbh_hid) * x | 0 |
132-
|usbh_video.c | ~5000 | 128 * x | 4 + sizeof(struct usbh_video) * x | 0 |
133-
|usbh_audio.c | ~4000 | 128 * x | 4 + sizeof(struct usbh_audio) * x | 0 |
133+
|usbh_core.c | ~4000 | (512(default) + 8 * (1+x) *n) * bus | sizeof(struct usbh_hub) * bus | raw_config_desc |
134+
|usbh_hub.c | ~3000 | (32 + 4 * (1+x)) * bus | 12 + sizeof(struct usbh_hub) * x | 0 |
135+
|usbh_msc.c | ~1500 | 128 * x | 4 + sizeof(struct usbh_msc) * x | 0 |
136+
|usbh_hid.c | ~2000 | 64 * x | 4 + sizeof(struct usbh_hid) * x | 0 |
137+
|usbh_video.c | ~2500 | 128 * x | 4 + sizeof(struct usbh_video) * x | 0 |
138+
|usbh_audio.c | ~3000 | 128 * x | 4 + sizeof(struct usbh_audio) * x | 0 |
134139
|usbh_rndis.c | ~3000 | 512 + 2 * 2048(default)| sizeof(struct usbh_rndis) * 1 | 0 |
135140
|usbh_cdc_ecm.c | ~1500 | 2 * 1514 + 16 | sizeof(struct usbh_cdc_ecm) * 1 | 0 |
136141
|usbh_cdc_ncm.c | ~2000 | 2 * 2048(default) + 16 + 32 | sizeof(struct usbh_cdc_ncm) * 1| 0 |
137142
|usbh_bluetooth.c | ~1000 | 2 * 2048(default) | sizeof(struct usbh_bluetooth) * 1 | 0 |
138-
|usbh_asix.c | ~7000 | 2 * 2048(default) + 16 + 32 | sizeof(struct usbh_asix) * 1 | 0 |
139-
|usbh_rtl8152.c | ~9000 | 16K+ 2K(default) + 2 + 32 | sizeof(struct usbh_rtl8152) * 1 | 0 |
143+
|usbh_asix.c | ~3500 | 2 * 2048(default) + 16 + 32 | sizeof(struct usbh_asix) * 1 | 0 |
144+
|usbh_rtl8152.c | ~5500 | 16K+ 2K(default) + 2 + 32 | sizeof(struct usbh_rtl8152) * 1 | 0 |
145+
|usbh_serial.c | ~3000 | (512 * 2 + 32 * 2) * x | sizeof(struct usbh_serial) * x (2048 default) | 0 |
146+
|usbh_cdc_acm.c | ~1000 | 0 | 0 | 0 |
147+
|usbh_ch340.c | ~1200 | 0 | 0 | 0 |
148+
|usbh_ftdi.c | ~1200 | 0 | 0 | 0 |
149+
|usbh_cp2102.c | ~2200 | 0 | 0 | 0 |
150+
|usbh_pl2303.c | ~2500 | 0 | 0 | 0 |
151+
|usbh_gsm.c | ~300 | 0 | 0 | 0 |
152+
153+
![usbhost_usage](docs/assets/usbhost_usage.png)
140154

141155
Among them, `sizeof(struct usbh_hub)` and `sizeof(struct usbh_hubport)` are affected by the following macros:
142156

@@ -176,55 +190,35 @@ Only standard and commercial USB IP are listed.
176190
| CDNS3(cadence) | CDNS3 | XHCI | × |
177191
| DWC3(synopsys) | DWC3 | XHCI | × |
178192

179-
## Documentation Tutorial
180-
181-
Quickly start, USB basic concepts, API manual, Class basic concepts and examples, see [CherryUSB Documentation Tutorial](https://cherryusb.readthedocs.io/).
182-
183-
## Video Tutorial
184-
185-
CherryUSB Cheese (>= V1.4.3): https://www.bilibili.com/cheese/play/ss707687201 .
186-
187-
## Descriptor Generator Tool
193+
## Resources
188194

189-
Cherry Descriptor: https://desc.cherry-embedded.org/en
195+
### Getting Started
190196

191-
## Demo Repo
197+
- 📖 [CherryUSB Documentation](https://cherryusb.readthedocs.io/en/latest/)
198+
- 💻 [CherryUSB Demo Repo](https://cherryusb.readthedocs.io/en/latest/quick_start/demo.html)
199+
- 📺 [CherryUSB Cheese(>= V1.4.3)](https://www.bilibili.com/cheese/play/ss707687201)
192200

193-
| Manufacturer | CHIP or Series | USB IP| Repo Url | Support version | Note |
194-
|:--------------------:|:------------------:|:-----:|:--------:|:------------------:|:-------------:|
195-
|Bouffalolab | BL702/BL616/BL808 | bouffalolab/ehci|[bouffalo_sdk](https://github.com/CherryUSB/bouffalo_sdk)|<= latest | Official |
196-
|ST | STM32F1x/STM32F4/STM32H7 | fsdev/dwc2 |[stm32_repo](https://github.com/CherryUSB/cherryusb_stm32)|<= latest | Community |
197-
|HPMicro | HPM6000/HPM5000 | hpm/ehci |[hpm_sdk](https://github.com/CherryUSB/hpm_sdk)|<= latest | Official |
198-
|Essemi | ES32F36xx | musb |[es32f369_repo](https://github.com/CherryUSB/cherryusb_es32)|<= latest | Official |
199-
|Phytium | e2000 | pusb2/xhci |[phytium_repo](https://gitee.com/phytium_embedded/phytium-free-rtos-sdk)|>=1.4.0 | Official |
200-
|Artinchip | d12x/d13x/d21x | aic/ehci/ohci |[luban-lite](https://gitee.com/artinchip/luban-lite)|<= latest | Official |
201-
|Espressif | esp32s2/esp32s3/esp32p4 | dwc2 |[esp32_repo](https://github.com/CherryUSB/cherryusb_esp32)/[espressif](https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb)|<= latest | Official |
202-
|Kendryte | k230 | dwc2 |[k230_repo](https://github.com/CherryUSB/k230_sdk)|v1.2.0 | Official |
203-
|Actionstech | ATS30xx | dwc2 |[action_zephyr_repo](https://github.com/CherryUSB/lv_port_actions_technology/tree/master/action_technology_sdk)|>=1.4.0 | Official |
204-
|SiFli | SF32LB5x | musb |[SiFli_sdk](https://github.com/OpenSiFli/SiFli-SDK)|>=1.5.0 | Official |
205-
|NXP | mcx | kinetis/chipidea/ehci |[nxp_mcx_repo](https://github.com/CherryUSB/cherryusb_mcx)|<= latest | Community |
206-
|Nationstech | n32h4x | dwc2 |[nation_repo](https://github.com/CherryUSB/cherryusb_nation)|>=1.5.0 | Official ongoing |
207-
|Raspberry pi | rp2040/rp2350 | rp2040 |[pico-sdk](https://github.com/CherryUSB/pico-sdk)|<= latest | Official ongoing |
208-
|AllwinnerTech | F1C100S/F1C200S | musb |[cherryusb_rtt_f1c100s](https://github.com/CherryUSB/cherryusb_rtt_f1c100s)|<= latest | no more update |
209-
|Bekencorp | bk7256/bk7258 | musb |[bk_idk](https://github.com/CherryUSB/bk_idk)| v0.7.0 | Official |
210-
|Sophgo | cv18xx | dwc2 |[cvi_alios_open](https://github.com/CherryUSB/cvi_alios_open)| v0.7.0 | Official |
211-
|WCH | CH32V307/ch58x | ch32_usbfs/ch32_usbhs/ch58x |[wch_repo](https://github.com/CherryUSB/cherryusb_wch)|<= v0.10.2/>=v1.5.0 | no more update |
201+
### Tools
212202

213-
## Package Support
203+
- 🌐 [Cherry Descriptor Generator](https://desc.cherry-embedded.org/en)
204+
- 🔧 [CDC Speed Test](https://github.com/cherry-embedded/CherryUSB/blob/master/tools/test_srcipts/test_cdc_speed.py)
205+
- 🔧 [HID Custom Test](https://github.com/cherry-embedded/CherryUSB/blob/master/tools/test_srcipts/test_hid_inout.py)
214206

215-
CherryUSB package is available as follows:
207+
### Community Or Commercial Support
216208

217-
- [RT-Thread](https://packages.rt-thread.org/detail.html?package=CherryUSB)
218-
- [YOC](https://www.xrvm.cn/document?temp=usb-host-protocol-stack-device-driver-adaptation-instructions&slug=yocbook)
219-
- [ESP-Registry](https://components.espressif.com/components/cherry-embedded/cherryusb)
209+
- 💬 [CherryUSB QQ Group](https://qm.qq.com/q/w3GnM4bkfA)
210+
- 💬 [CherryUSB discord](https://discord.com/invite/wFfvrSAey8)
211+
- 🙋🏽 [Commercial Support](https://cherryusb.readthedocs.io/en/latest/support/index.html)
220212

221-
## Commercial Support
213+
### Package Support
222214

223-
Refer to https://cherryusb.readthedocs.io/zh-cn/latest/support/index.html.
215+
- 🌐 [RT-Thread](https://packages.rt-thread.org/detail.html?package=CherryUSB)
216+
- 🌐 [YOC](https://www.xrvm.cn/document?temp=usb-host-protocol-stack-device-driver-adaptation-instructions&slug=yocbook)
217+
- 🌐 [ESP-Registry](https://components.espressif.com/components/cherry-embedded/cherryusb)
224218

225-
## Contact
219+
### Mirror URL
226220

227-
CherryUSB discord: https://discord.com/invite/wFfvrSAey8.
221+
- [AtomGit](https://atomgit.com/cherry-embedded/CherryUSB)
228222

229223
## Company Support
230224

0 commit comments

Comments
 (0)