From 174a07fb898291e0ca2e8dadc4384d3962de1320 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sun, 3 Jul 2022 22:14:23 +0800 Subject: [PATCH] update readme --- README.md | 11 ++++++----- README_zh.md | 11 ++++++----- common/usb_dc.h | 9 --------- docs/source/api/api_device.rst | 25 +------------------------ docs/source/index.rst | 11 +++++------ 5 files changed, 18 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index fa324d6e..b19f244b 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,12 @@ CherryUSB is a tiny, beautiful and portable USB host and device stack for embedd ## Why choose -- Ip-oriented programming means the same usb ip's driver has no need to be written repeatedly, only the parts(such as `usb_xx_low_level_init`:including usb clock, usb gpio and usb irq configuration)that are not the same have to be implemented, -- Tree-based coding makes it easier for users to understand usb concept, enumeration process and class driver loading process -- Templating the class drivers makes it easier to use composite device and add custom drivers -- Simplifying the complex transfer of usb makes it easier for users to use usb as easily as uart and dma -- Fewer directory structures, fewer apis, fewer codesize, extreme usb bandwidth +- More comprehensive class drivers, and class drivers are all templated, easy to learn and add independently +- Tree programming, easy to understand the relationship between class driver and interface, endpoint, the relationship between hub, port, class; code layer by layer, call relationship at a glance, easy to understand the usb enumeration process and class driver loading +- The use of the device stack is simplified to the use of classes such as uart and dma, and the use of the host stack is simplified to the use of files +- Standardized porting interface, as well as ip-oriented programming, eliminating the need to rewrite drivers for the same ip +- Api less, clear classification: dcd/hcd api, registration api, command callback api +- Streamlined code, minimal memory footprint, and the ability to achieve the maximum bandwidth that usb hardware can achieve ## Directoy Structure diff --git a/README_zh.md b/README_zh.md index f1271963..96247f93 100644 --- a/README_zh.md +++ b/README_zh.md @@ -8,11 +8,12 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统(带 ## 为什么选择 -- 面向 ip 编程,使得相同的 usb ip 驱动无需重复编写,仅需实现不相同的部分(例如实现 `usb_xx_low_level_init`:包含 usb 时钟、usb gpio、usb 中断) -- 代码树状化编写,轻松理解 usb 概念、枚举过程、class 驱动加载 -- Class 驱动模板化,轻松实现复合设备和自定义添加驱动 -- 将 usb 的复杂传输简单化,使得用户能够像 uart、dma 一样轻松使用 usb -- 少量的目录结构,少量的 api,少量的 codesize,极致的 usb 带宽 +- 比较全面的 class 驱动,并且 class 驱动全部模板化,方便学习和自主添加 +- 树状化编程,方便理清 class 驱动与接口、端点的关系,hub、port、class 之间的关系;代码层层递进,调用关系一目了然,方便理清 usb 枚举过程和 class 驱动加载 +- 设备协议栈的使用简化到类如 uart 、dma 的使用,主机协议栈的使用简化到文件的使用 +- 标准化的 porting 接口,同时面向 ip 化编程,相同 ip 无需重复编写驱动 +- Api 少,分类清晰:dcd/hcd api、注册 api、命令回调 api +- 代码精简,内存占用极小,同时能够达到 usb 硬件能够达到的最大带宽 ## 目录结构 diff --git a/common/usb_dc.h b/common/usb_dc.h index 51627a6b..dd060a5a 100644 --- a/common/usb_dc.h +++ b/common/usb_dc.h @@ -229,15 +229,6 @@ int usbd_ep_read_async(const uint8_t ep, uint8_t *data, uint32_t data_len); */ uint32_t usbd_ep_get_read_len(const uint8_t ep); -/** - * @brief Check if in ep transfers done. - * - * @param[in] ep Endpoint address corresponding to the one - * listed in the device configuration table - * @return true means transfer completely.Otherwise not. - */ -bool usbd_ep_is_complete(const uint8_t ep); - /** * @brief Get endpoint max packet size. * diff --git a/docs/source/api/api_device.rst b/docs/source/api/api_device.rst index fff16d48..708659d7 100644 --- a/docs/source/api/api_device.rst +++ b/docs/source/api/api_device.rst @@ -241,7 +241,7 @@ CDC ACM usbd_cdc_add_acm_interface """""""""""""""""""""""""""""""""""" -``usbd_cdc_add_acm_interface`` 用来给 USB CDC ACM 类添加接口,并实现该接口相关的函数: +``usbd_cdc_add_acm_interface`` 用来给 USB CDC ACM 类添加接口,并实现该接口相关的函数。 - ``cdc_acm_class_request_handler`` 用来处理 USB CDC ACM 类 Setup 请求。 - ``cdc_notify_handler`` 用来处理 USB CDC 其他中断回调函数。 @@ -339,29 +339,6 @@ usbd_hid_report_descriptor_register - **desc** 报告描述符 - **desc_len** 报告描述符长度 -usbd_hid_set_request_callback -"""""""""""""""""""""""""""""""""""" - -``usbd_hid_set_request_callback`` 用来注册 hid 类请求命令的回调函数。 - -.. code-block:: C - - void usbd_hid_set_request_callback( uint8_t intf_num, - uint8_t (*get_report_callback)(uint8_t report_id, uint8_t report_type), - void (*set_report_callback)(uint8_t report_id, uint8_t report_type, uint8_t *report, uint8_t report_len), - uint8_t (*get_idle_callback)(uint8_t report_id), - void (*set_idle_callback)(uint8_t report_id, uint8_t duration), - void (*set_protocol_callback)(uint8_t protocol), - uint8_t (*get_protocol_callback)(void)); - -- **intf_num** 当前 hid 报告描述符所在接口偏移 -- **get_report_callback** get report命令处理回调函数 -- **set_report_callback** set report命令处理回调函数 -- **get_idle_callback** get idle命令处理回调函数 -- **set_idle_callback** set idle命令处理回调函数 -- **set_protocol_callback** set protocol命令处理回调函数 -- **get_protocol_callback** get protocol命令处理回调函数 - MSC ----------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index b78b5a44..bf88bb3e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,13 +8,12 @@ CherryUSB 使用指南 CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的 USB 主从协议栈。同时 CherryUSB 具有以下优点: -- 比较全面的 class 驱动,并且 class 驱动全部模板化,方便自主添加 -- 协议栈采用链表动态注册的方式,减少内存占用 -- 树状化编程,方便理清 class 驱动与接口、端点的关系,hub、port、class 之间的关系 -- 标准化的 porting 接口 +- 比较全面的 class 驱动,并且 class 驱动全部模板化,方便学习和自主添加 +- 树状化编程,方便理清 class 驱动与接口、端点的关系,hub、port、class 之间的关系;代码层层递进,调用关系一目了然,方便理清 usb 枚举过程和 class 驱动加载 - 设备协议栈的使用简化到类如 uart 、dma 的使用,主机协议栈的使用简化到文件的使用 -- 协议栈实现代码简短,并且从上往下看完就能理清 usb 枚举过程和 class 加载机制 -- Api 少,并且分为三类:dcd/hcd api、注册 api、命令回调 api +- 标准化的 porting 接口,同时面向 ip 化编程,相同 ip 无需重复编写驱动 +- Api 少,分类清晰:dcd/hcd api、注册 api、命令回调 api +- 代码精简,内存占用极小,同时能够达到 usb 硬件能够达到的最大带宽 其他相关链接: