rename usb_stack to CherryUSB
This commit is contained in:
36
README.md
36
README.md
@@ -1,10 +1,10 @@
|
|||||||
# USB Stack
|
# CherryUSB
|
||||||
|
|
||||||
[中文版](./README_zh.md)
|
[中文版](./README_zh.md)
|
||||||
|
|
||||||
USB Stack is a tiny, beautiful and portable USB host and device stack for embedded system.
|
CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system.
|
||||||
|
|
||||||
## USB Stack Directoy Structure
|
## CherryUSB Directoy Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
@@ -51,13 +51,13 @@ USB Stack is a tiny, beautiful and portable USB host and device stack for embedd
|
|||||||
|packet capture | packet capture file |
|
|packet capture | packet capture file |
|
||||||
|port | usb dcd and hcd porting |
|
|port | usb dcd and hcd porting |
|
||||||
|
|
||||||
## USB Device Stack Overview
|
## CherryUSB Device Stack Overview
|
||||||
|
|
||||||
USB Device Stack provides a unified framework of functions for standard device requests, CLASS requests, VENDOR requests and custom special requests. The object-oriented and chained approach allows the user to quickly get started with composite devices without having to worry about the underlying logic. At the same time, a standard dcd porting interface has been standardised for adapting different USB IPs to achieve ip-oriented programming.
|
CherryUSB Device Stack provides a unified framework of functions for standard device requests, CLASS requests, VENDOR requests and custom special requests. The object-oriented and chained approach allows the user to quickly get started with composite devices without having to worry about the underlying logic. At the same time, a standard dcd porting interface has been standardised for adapting different USB IPs to achieve ip-oriented programming.
|
||||||
|
|
||||||
How USB Device Stack is implemented, this video will tell you: <https://www.bilibili.com/video/BV1Ef4y1t73d> .
|
How CherryUSB Device Stack is implemented, this video will tell you: <https://www.bilibili.com/video/BV1Ef4y1t73d> .
|
||||||
|
|
||||||
USB Device Stack has the following functions:
|
CherryUSB Device Stack has the following functions:
|
||||||
|
|
||||||
- Support USB2.0 full and high speed
|
- Support USB2.0 full and high speed
|
||||||
- Support endpoint irq callback register by users, let users do whatever they wants in endpoint irq callback.
|
- Support endpoint irq callback register by users, let users do whatever they wants in endpoint irq callback.
|
||||||
@@ -74,7 +74,7 @@ USB Device Stack has the following functions:
|
|||||||
- Support Vendor class
|
- Support Vendor class
|
||||||
- Support WINUSB1.0、WINUSB2.0
|
- Support WINUSB1.0、WINUSB2.0
|
||||||
|
|
||||||
USB Device Stack resource usage:
|
CherryUSB Device Stack resource usage:
|
||||||
|
|
||||||
| file | FLASH (Byte) | RAM (Byte) |
|
| file | FLASH (Byte) | RAM (Byte) |
|
||||||
|:-----------:|:--------------:|:------------:|
|
|:-----------:|:--------------:|:------------:|
|
||||||
@@ -85,13 +85,13 @@ USB Device Stack resource usage:
|
|||||||
|usbd_audio.c | 438 | 14 |
|
|usbd_audio.c | 438 | 14 |
|
||||||
|usbd_video.c | 402 | 4 |
|
|usbd_video.c | 402 | 4 |
|
||||||
|
|
||||||
## USB Host Stack Overview
|
## CherryUSB Host Stack Overview
|
||||||
|
|
||||||
The USB Host Stack has a standard enumeration implementation for devices mounted on roothubs and external hubs, and a standard interface for the different Class to indicate what the Class driver needs to do after enumeration and after disconnection. A standard hcd porting interface has also been standardised for adapting different USB IPs for IP-oriented programming. Finally, the protocol stack is managed using os, and provides osal to make a adaptation to different os.
|
The CherryUSB Host Stack has a standard enumeration implementation for devices mounted on roothubs and external hubs, and a standard interface for the different Class to indicate what the Class driver needs to do after enumeration and after disconnection. A standard hcd porting interface has also been standardised for adapting different USB IPs for IP-oriented programming. Finally, the protocol stack is managed using os, and provides osal to make a adaptation to different os.
|
||||||
|
|
||||||
How USB Host Stack is implemented, the video will be provided in future.
|
How CherryUSB Host Stack is implemented, the video will be provided in future.
|
||||||
|
|
||||||
USB Host Stack has the following functions:
|
CherryUSB Host Stack has the following functions:
|
||||||
|
|
||||||
- Automatic loading of supported Class drivers
|
- Automatic loading of supported Class drivers
|
||||||
- Support blocking transfers and asynchronous transfers
|
- Support blocking transfers and asynchronous transfers
|
||||||
@@ -103,18 +103,18 @@ USB Host Stack has the following functions:
|
|||||||
- Support Vendor class
|
- Support Vendor class
|
||||||
- Support Andriod AOA Communication
|
- Support Andriod AOA Communication
|
||||||
|
|
||||||
The USB Host stack also provides the lsusb function, which allows you to view information about all mounted devices, including those on external hubs, with the help of a shell plugin.
|
The CherryUSB Host stack also provides the lsusb function, which allows you to view information about all mounted devices, including those on external hubs, with the help of a shell plugin.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## USB Device API
|
## CherryUSB Device API
|
||||||
|
|
||||||
More of USB Device API reference, please visit : [USB Device API](docs/usb_device.md)
|
More of USB Device API reference, please visit : [CherryUSB Device API](docs/usb_device.md)
|
||||||
|
|
||||||
## USB Host API
|
## CherryUSB Host API
|
||||||
|
|
||||||
More of USB Host API reference, please visit: [USB Host API](docs/usb_host.md)
|
More of USB Host API reference, please visit: [CherryUSB Host API](docs/usb_host.md)
|
||||||
|
|
||||||
## How To Use In RT-Thread package
|
## How To Use In RT-Thread package
|
||||||
|
|
||||||
How to use in RT-Thread package, please visit:[RT-Thread package Userguide with usb stack](docs/rt-thread.md)
|
How to use in RT-Thread package, please visit:[RT-Thread package Userguide with CherryUSB](docs/rt-thread.md)
|
||||||
|
|||||||
36
README_zh.md
36
README_zh.md
@@ -1,10 +1,10 @@
|
|||||||
# USB Stack
|
# CherryUSB
|
||||||
|
|
||||||
[English](./README.md)
|
[English](./README.md)
|
||||||
|
|
||||||
USB Stack 是一个小而美的、可移植性高的、用于嵌入式系统的 USB 主从协议栈。
|
CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的 USB 主从协议栈。
|
||||||
|
|
||||||
## USB Stack 目录结构
|
## CherryUSB 目录结构
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
@@ -51,13 +51,13 @@ USB Stack 是一个小而美的、可移植性高的、用于嵌入式系统的
|
|||||||
|packet capture | 抓包文件(需要使用力科软件打开)|
|
|packet capture | 抓包文件(需要使用力科软件打开)|
|
||||||
|port | usb 主从需要实现的 porting 接口 |
|
|port | usb 主从需要实现的 porting 接口 |
|
||||||
|
|
||||||
## USB Device 协议栈简介
|
## CherryUSB Device 协议栈简介
|
||||||
|
|
||||||
USB Device 协议栈对标准设备请求、CLASS 请求、VENDOR 请求以及 custom 特殊请求规范了一套统一的函数框架,采用面向对象和链表的方式,能够使得用户快速上手复合设备,不用管底层的逻辑。同时,规范了一套标准的 dcd porting 接口,用于适配不同的 USB IP,达到面向 ip 编程。
|
CherryUSB Device 协议栈对标准设备请求、CLASS 请求、VENDOR 请求以及 custom 特殊请求规范了一套统一的函数框架,采用面向对象和链表的方式,能够使得用户快速上手复合设备,不用管底层的逻辑。同时,规范了一套标准的 dcd porting 接口,用于适配不同的 USB IP,达到面向 ip 编程。
|
||||||
|
|
||||||
USB Device 协议栈的代码实现过程参考 <https://www.bilibili.com/video/BV1Ef4y1t73d> 。
|
CherryUSB Device 协议栈的代码实现过程参考 <https://www.bilibili.com/video/BV1Ef4y1t73d> 。
|
||||||
|
|
||||||
USB Device 协议栈当前实现以下功能:
|
CherryUSB Device 协议栈当前实现以下功能:
|
||||||
|
|
||||||
- 支持 USB2.0 全速和高速设备
|
- 支持 USB2.0 全速和高速设备
|
||||||
- 支持端点中断注册功能,porting 给用户自己处理中断里的数据
|
- 支持端点中断注册功能,porting 给用户自己处理中断里的数据
|
||||||
@@ -74,7 +74,7 @@ USB Device 协议栈当前实现以下功能:
|
|||||||
- 支持 Vendor 类 class
|
- 支持 Vendor 类 class
|
||||||
- 支持 WINUSB1.0、WINUSB2.0
|
- 支持 WINUSB1.0、WINUSB2.0
|
||||||
|
|
||||||
USB Device 协议栈资源占用说明:
|
CherryUSB Device 协议栈资源占用说明:
|
||||||
|
|
||||||
| file | FLASH (Byte) | RAM (Byte) |
|
| file | FLASH (Byte) | RAM (Byte) |
|
||||||
|:-----------:|:--------------:|:------------:|
|
|:-----------:|:--------------:|:------------:|
|
||||||
@@ -85,13 +85,13 @@ USB Device 协议栈资源占用说明:
|
|||||||
|usbd_audio.c | 438 | 14 |
|
|usbd_audio.c | 438 | 14 |
|
||||||
|usbd_video.c | 402 | 4 |
|
|usbd_video.c | 402 | 4 |
|
||||||
|
|
||||||
## USB Host 协议栈简介
|
## CherryUSB Host 协议栈简介
|
||||||
|
|
||||||
USB Host 协议栈对挂载在 roothub、外部 hub 上的设备规范了一套标准的枚举实现,对不同的 Class 类也规范了一套标准接口,用来指示在枚举后和断开连接后该 Class 驱动需要做的事情。同时,规范了一套标准的 hcd porting 接口,用于适配不同的 USB IP,达到面向 IP 编程。最后,协议栈使用 OS 管理,并提供了 osal 用来适配不同的 os。
|
CherryUSB Host 协议栈对挂载在 roothub、外部 hub 上的设备规范了一套标准的枚举实现,对不同的 Class 类也规范了一套标准接口,用来指示在枚举后和断开连接后该 Class 驱动需要做的事情。同时,规范了一套标准的 hcd porting 接口,用于适配不同的 USB IP,达到面向 IP 编程。最后,协议栈使用 OS 管理,并提供了 osal 用来适配不同的 os。
|
||||||
|
|
||||||
USB Host 协议栈的代码实现过程参考:视频后续发布。
|
CherryUSB Host 协议栈的代码实现过程参考:视频后续发布。
|
||||||
|
|
||||||
USB Host 协议栈当前实现以下功能:
|
CherryUSB Host 协议栈当前实现以下功能:
|
||||||
|
|
||||||
- 自动加载支持的Class 驱动
|
- 自动加载支持的Class 驱动
|
||||||
- 支持阻塞式传输和异步传输
|
- 支持阻塞式传输和异步传输
|
||||||
@@ -102,18 +102,18 @@ USB Host 协议栈当前实现以下功能:
|
|||||||
- 支持 Mass Storage Class (MSC)
|
- 支持 Mass Storage Class (MSC)
|
||||||
- 支持安卓 AOA Communication
|
- 支持安卓 AOA Communication
|
||||||
|
|
||||||
同时,USB Host 协议栈还提供了 lsusb 的功能,借助 shell 插件可以查看所有挂载设备的信息,包括外部 hub 上的设备的信息。
|
同时,CherryUSB Host 协议栈还提供了 lsusb 的功能,借助 shell 插件可以查看所有挂载设备的信息,包括外部 hub 上的设备的信息。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## USB Device API
|
## CherryUSB Device API
|
||||||
|
|
||||||
更详细的设备协议栈 API 请参考: [USB Device API](docs/usb_device.md)
|
更详细的设备协议栈 API 请参考: [CherryUSB Device API](docs/usb_device.md)
|
||||||
|
|
||||||
## USB Host API
|
## CherryUSB Host API
|
||||||
|
|
||||||
更详细的主机协议栈 API 请参考: [USB Host API](docs/usb_host.md)
|
更详细的主机协议栈 API 请参考: [CherryUSB Host API](docs/usb_host.md)
|
||||||
|
|
||||||
## RT-Thread 软件包使用
|
## RT-Thread 软件包使用
|
||||||
|
|
||||||
如何在 RT-Thread OS 中使用软件包,请参考:[USB Stack 在 RT-Thread package 中的使用](docs/rt-thread_zh.md)
|
如何在 RT-Thread OS 中使用软件包,请参考:[CherryUSB 在 RT-Thread package 中的使用](docs/rt-thread_zh.md)
|
||||||
|
|||||||
24
SConscript
24
SConscript
@@ -5,32 +5,32 @@ path = [cwd + '/common']
|
|||||||
path += [cwd + '/core']
|
path += [cwd + '/core']
|
||||||
src = Glob('core/usbd_core.c')
|
src = Glob('core/usbd_core.c')
|
||||||
CPPDEFINES = []
|
CPPDEFINES = []
|
||||||
if GetDepend(['PKG_USB_STACK_USING_HS']):
|
if GetDepend(['PKG_CherryUSB_USING_HS']):
|
||||||
CPPDEFINES+=['CONFIG_USB_HS']
|
CPPDEFINES+=['CONFIG_USB_HS']
|
||||||
elif GetDepend(['PKG_USB_STACK_USING_HS_IN_FULL']):
|
elif GetDepend(['PKG_CherryUSB_USING_HS_IN_FULL']):
|
||||||
CPPDEFINES += ['CONFIG_USB_HS_IN_FULL']
|
CPPDEFINES += ['CONFIG_USB_HS_IN_FULL']
|
||||||
|
|
||||||
# USB DEVICE
|
# USB DEVICE
|
||||||
if GetDepend(['PKG_USB_STACK_USING_DEVICE']):
|
if GetDepend(['PKG_CherryUSB_USING_DEVICE']):
|
||||||
if GetDepend(['PKG_USB_STACK_USING_CDC']):
|
if GetDepend(['PKG_CherryUSB_USING_CDC']):
|
||||||
path += [cwd + '/class/cdc']
|
path += [cwd + '/class/cdc']
|
||||||
src += Glob('class/cdc/usbd_cdc.c')
|
src += Glob('class/cdc/usbd_cdc.c')
|
||||||
if GetDepend(['PKG_USB_STACK_USING_HID']):
|
if GetDepend(['PKG_CherryUSB_USING_HID']):
|
||||||
path += [cwd + '/class/hid']
|
path += [cwd + '/class/hid']
|
||||||
src += Glob('class/cdc/usbd_hid.c')
|
src += Glob('class/cdc/usbd_hid.c')
|
||||||
if GetDepend(['PKG_USB_STACK_USING_DFU']):
|
if GetDepend(['PKG_CherryUSB_USING_DFU']):
|
||||||
path += [cwd + '/class/dfu']
|
path += [cwd + '/class/dfu']
|
||||||
src += Glob('class/cdc/usbd_dfu.c')
|
src += Glob('class/cdc/usbd_dfu.c')
|
||||||
if GetDepend(['PKG_USB_STACK_USING_HUB']):
|
if GetDepend(['PKG_CherryUSB_USING_HUB']):
|
||||||
path += [cwd + '/class/hub']
|
path += [cwd + '/class/hub']
|
||||||
src += Glob('class/cdc/usbd_hub.c')
|
src += Glob('class/cdc/usbd_hub.c')
|
||||||
if GetDepend(['PKG_USB_STACK_USING_AUDIO']):
|
if GetDepend(['PKG_CherryUSB_USING_AUDIO']):
|
||||||
path += [cwd + '/class/audio']
|
path += [cwd + '/class/audio']
|
||||||
src += Glob('class/cdc/usbd_audio.c')
|
src += Glob('class/cdc/usbd_audio.c')
|
||||||
if GetDepend(['PKG_USB_STACK_USING_VIDEO']):
|
if GetDepend(['PKG_CherryUSB_USING_VIDEO']):
|
||||||
path += [cwd + '/class/video']
|
path += [cwd + '/class/video']
|
||||||
src += Glob('class/cdc/usbd_video.c')
|
src += Glob('class/cdc/usbd_video.c')
|
||||||
if GetDepend(['PKG_USB_STACK_USING_MSC']):
|
if GetDepend(['PKG_CherryUSB_USING_MSC']):
|
||||||
path += [cwd + '/class/msc']
|
path += [cwd + '/class/msc']
|
||||||
src += Glob('class/cdc/usbd_msc.c')
|
src += Glob('class/cdc/usbd_msc.c')
|
||||||
if GetDepend(['SOC_FAMILY_STM32']):
|
if GetDepend(['SOC_FAMILY_STM32']):
|
||||||
@@ -42,10 +42,10 @@ if GetDepend(['PKG_USB_STACK_USING_DEVICE']):
|
|||||||
CPPDEFINES += ['STM32H7']
|
CPPDEFINES += ['STM32H7']
|
||||||
|
|
||||||
# USB HOST
|
# USB HOST
|
||||||
if GetDepend(['PKG_USB_STACK_USING_HOST']):
|
if GetDepend(['PKG_CherryUSB_USING_HOST']):
|
||||||
pass;
|
pass;
|
||||||
|
|
||||||
group = DefineGroup('usb_stack', src, depend = ['PKG_USING_USB_STACK'], CPPPATH = path, CPPDEFINES = CPPDEFINES)
|
group = DefineGroup('CherryUSB', src, depend = ['PKG_USING_CherryUSB'], CPPPATH = path, CPPDEFINES = CPPDEFINES)
|
||||||
|
|
||||||
Return('group')
|
Return('group')
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
# RT-Thread package Userguide with usb stack
|
# RT-Thread package Userguide with CherryUSB
|
||||||
|
|
||||||
[中文版](rt-thread_zh.md)
|
[中文版](rt-thread_zh.md)
|
||||||
|
|
||||||
To use usb stack package, you need to select it in the RT-Thread package manager. The specific path is as follows:
|
To use CherryUSB package, you need to select it in the RT-Thread package manager. The specific path is as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
-> RT-Thread online packages
|
-> RT-Thread online packages
|
||||||
-> system packages
|
-> system packages
|
||||||
--- USB Stack: tiny and portable USB stack for embedded system with USB IP
|
--- CherryUSB: tiny and portable USB stack for embedded system with USB IP
|
||||||
|
|
||||||
USB STACK Options ---->
|
CherryUSB Options ---->
|
||||||
USB Speed (FS) --->
|
USB Speed (FS) --->
|
||||||
[*] Enable usb device mode
|
[*] Enable usb device mode
|
||||||
[*] Enable usb cdc acm device
|
[*] Enable usb cdc acm device
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
# USB Stack 在 RT-Thread package 中的使用
|
# CherryUSB 在 RT-Thread package 中的使用
|
||||||
|
|
||||||
[English Version](rt-thread.md)
|
[English Version](rt-thread.md)
|
||||||
|
|
||||||
使用 USB Stack package 需要在 RT-Thread 的包管理器中选择它,具体路径如下:
|
使用 CherryUSB package 需要在 RT-Thread 的包管理器中选择它,具体路径如下:
|
||||||
|
|
||||||
```
|
```
|
||||||
-> RT-Thread online packages
|
-> RT-Thread online packages
|
||||||
-> system packages
|
-> system packages
|
||||||
--- USB Stack: tiny and portable USB stack for embedded system with USB IP
|
--- CherryUSB: tiny and portable USB stack for embedded system with USB IP
|
||||||
|
|
||||||
USB STACK Options ---->
|
CherryUSB Options ---->
|
||||||
USB Speed (FS) --->
|
USB Speed (FS) --->
|
||||||
[*] Enable usb device mode
|
[*] Enable usb device mode
|
||||||
[*] Enable usb cdc acm device
|
[*] Enable usb cdc acm device
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# USB STACK API For device
|
# CherryUSB Device API
|
||||||
|
|
||||||
## USB Device Controller Porting 接口
|
## CherryUSB Device Controller Porting 接口
|
||||||
|
|
||||||
USB Device controller porting 接口在 `usb_stack/common/usb_dc.h` 文件中声明,用户根据自己的 MCU 实现以下接口:
|
USB Device controller porting 接口在 `usb_stack/common/usb_dc.h` 文件中声明,用户根据自己的 MCU 实现以下接口:
|
||||||
|
|
||||||
@@ -13,13 +13,13 @@ USB Device controller porting 接口在 `usb_stack/common/usb_dc.h` 文件中声
|
|||||||
- `usbd_ep_write`
|
- `usbd_ep_write`
|
||||||
- `usbd_ep_read`
|
- `usbd_ep_read`
|
||||||
|
|
||||||
## USB Device Controller 其他接口
|
## CherryUSB Device Controller 其他接口
|
||||||
|
|
||||||
用户需要实现 usb device controller 相关寄存器初始化的函数(可以命名为 `usb_dc_init` ),以及在 USB 中断函数中根据不同的中断标志调用 `usbd_event_notify_handler`。
|
用户需要实现 usb device controller 相关寄存器初始化的函数(可以命名为 `usb_dc_init` ),以及在 USB 中断函数中根据不同的中断标志调用 `usbd_event_notify_handler`。
|
||||||
|
|
||||||
## USB Device 应用层接口
|
## CherryUSB Device 应用层接口
|
||||||
|
|
||||||
### USB Device 通用接口
|
### CherryUSB Device 通用接口
|
||||||
|
|
||||||
#### **usbd_desc_register**
|
#### **usbd_desc_register**
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
# USB STACK API For host
|
# CherryUSB Host API
|
||||||
Reference in New Issue
Block a user