mirror of
https://github.com/sakumisu/CherryUSB.git
synced 2025-05-09 00:21:44 +08:00
update readme
This commit is contained in:
parent
66e95c9d81
commit
4dff5aac24
34
README.md
34
README.md
@ -2,19 +2,37 @@
|
||||
|
||||
[中文版](./README_zh.md)
|
||||
|
||||
CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB ip.
|
||||
CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB IP.
|
||||
|
||||

|
||||
|
||||
## Why choose
|
||||
|
||||
- Streamlined code with small memory usage which also can be further trimmed
|
||||
- Comprehensive class drivers and all master and slave class drivers are templated,making it easy for users to add new class drivers and find patterns when learning
|
||||
- The APIs available to the users are very few and clearly categorised. Device: initialisation + registration apis, command callback apis, data sending and receiving apis; Host: initialisation + lookup apis, data sending and receiving apis
|
||||
- Tree-based programming with a hierarchy of code that makes it easy for the user to sort out function call relationships, enumerations and class-driven loading processes
|
||||
- Standardised porting interface, no need to rewrite the driver for the same ip, and porting drivers are templated to make it easier for users to add new ports
|
||||
- The use of the device or host transceiver apis are equivalent to the use of the uart tx/rx dma, and there is no limit to the length
|
||||
- Capable of achieving theoretical USB hardware bandwidth
|
||||
### Easy to study USB
|
||||
|
||||
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:
|
||||
|
||||
- Lean code, simple logic, no complex C syntax
|
||||
- Tree-based programming with cascading code
|
||||
- Class-drivers and porting-drivers are templating and simplification
|
||||
- Clear API classification (slave: initialisation, registration api, command callback api, data sending and receiving api; host: initialisation, lookup api, data sending and receiving api)
|
||||
|
||||
### Easy to use USB
|
||||
|
||||
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:
|
||||
|
||||
- Equivalent to using uart tx dma/uart rx dma
|
||||
- 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 the packetization process)
|
||||
|
||||
### Easy to bring out USB performance
|
||||
|
||||
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:
|
||||
|
||||
- Porting drivers directly to registers, no abstraction layer encapsulation
|
||||
- Memory zero copy
|
||||
- If IP has DMA then uses DMA mode (DMA with hardware packetization)
|
||||
- Unlimited length make it easier to interface with hardware DMA and take advantage of DMA
|
||||
- Subcontracting function is handled in interrupt
|
||||
|
||||
## Directoy Structure
|
||||
|
||||
|
34
README_zh.md
34
README_zh.md
@ -2,19 +2,37 @@
|
||||
|
||||
[English](./README.md)
|
||||
|
||||
CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统(带 USB ip)的 USB 主从协议栈。
|
||||
CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统(带 USB IP)的 USB 主从协议栈。
|
||||
|
||||

|
||||
|
||||
## 为什么选择
|
||||
|
||||
- 代码精简,并且内存占用极小,详细参考下面表格,而且还可进一步的裁剪
|
||||
- 全面的 class 驱动,并且主从 class 驱动全部模板化,方便用户增加新的 class 驱动以及学习的时候查找规律
|
||||
- 可供用户使用的 API 非常少,并且分类清晰。从机:初始化 + 注册类、命令回调类、数据收发类;主机:初始化 + 查找类、数据收发类
|
||||
- 树状化编程,代码层层递进,方便用户理清函数调用关系、枚举和 class 驱动加载过程
|
||||
- 标准化的 porting 接口,相同 ip 无需重写驱动,并且 porting 驱动也进行了模板化,方便用户新增 porting。
|
||||
- 主从收发接口的使用等价于 uart tx/rx dma 的使用,长度也没有限制
|
||||
- 能够达到 USB 硬件理论带宽
|
||||
### 易于学习 USB
|
||||
|
||||
为了方便用户学习 USB 基本知识、枚举、驱动加载、IP 驱动,因此,编写的代码具备以下优点:
|
||||
|
||||
- 代码精简,逻辑简单,无复杂 C 语言语法
|
||||
- 树状化编程,代码层层递进
|
||||
- Class 驱动和 porting 驱动模板化、精简化
|
||||
- API 分类清晰(从机:初始化、注册类、命令回调类、数据收发类;主机:初始化、查找类、数据收发类)
|
||||
|
||||
### 易于使用 USB
|
||||
|
||||
为了方便用户使用 USB 接口,考虑到用户学习过 uart 和 dma,因此,设计的数据收发类接口具备以下优点:
|
||||
|
||||
- 等价于使用 uart tx dma/uart rx dma
|
||||
- 收发长度没有限制,用户不需要关心 USB 分包过程(porting 驱动做分包过程)
|
||||
|
||||
### 易于发挥 USB 性能
|
||||
|
||||
考虑到 USB 性能问题,尽量达到 USB 硬件理论带宽,因此,设计的数据收发类接口具备以下优点:
|
||||
|
||||
- Porting 驱动直接对接寄存器,无抽象层封装
|
||||
- Memory zero copy
|
||||
- IP 如果带 DMA 则使用 DMA 模式(DMA 带硬件分包功能)
|
||||
- 长度无限制,方便对接硬件 DMA 并且发挥 DMA 的优势
|
||||
- 分包功能在中断中处理
|
||||
|
||||
## 目录结构
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user