docs: update rst framework

This commit is contained in:
sakumisu
2024-09-08 00:17:55 +08:00
parent b56b67182a
commit da391c6cf9
50 changed files with 133 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
USB CONFIG USB CONFIG 说明
========================= =========================
通用 CONFIG 通用 CONFIG
--------------------- ---------------------
CONFIG_USB_PRINTF CONFIG_USB_PRINTF
@@ -29,13 +29,13 @@ USB_NOCACHE_RAM_SECTION
如果芯片没有 cache 功能,此宏无效。如果有,则 USB 的输入输出 buffer 必须放在 nocache ram 中,保证数据一致性。 如果芯片没有 cache 功能,此宏无效。如果有,则 USB 的输入输出 buffer 必须放在 nocache ram 中,保证数据一致性。
设备相关 CONFIG 设备协议栈 CONFIG
--------------------- ---------------------
CONFIG_USBDEV_REQUEST_BUFFER_LEN CONFIG_USBDEV_REQUEST_BUFFER_LEN
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
控制传输接收和发送的 buffer 最大长度,默认是 256 控制传输接收和发送的 buffer 最大长度,默认是 512
CONFIG_USBDEV_SETUP_LOG_PRINT CONFIG_USBDEV_SETUP_LOG_PRINT
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -55,7 +55,7 @@ CONFIG_USBDEV_MSC_MAX_BUFSIZE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
msc 缓存的最大长度缓存越大USB 的速度越高,因为介质一般多个 block 读写速度比单个 block 高很多,比如 sd 卡。 msc 缓存的最大长度缓存越大USB 的速度越高,因为介质一般多个 block 读写速度比单个 block 高很多,比如 sd 卡。
默认 512 ,如果是 flash 需要改成 4K, 缓存的大小需要是 介质的一个 block size 的整数倍。 默认 512 ,如果是 flash 需要改成 4K, 缓存的大小需要是介质的一个 block size 的整数倍。
CONFIG_USBDEV_MSC_MANUFACTURER_STRING CONFIG_USBDEV_MSC_MANUFACTURER_STRING
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -66,6 +66,11 @@ CONFIG_USBDEV_MSC_PRODUCT_STRING
CONFIG_USBDEV_MSC_VERSION_STRING CONFIG_USBDEV_MSC_VERSION_STRING
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CONFIG_USBDEV_MSC_POLLING
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
将 usbd_msc_sector_read 和 usbd_msc_sector_write 操作放在 while1 中运行,裸机下使用。
CONFIG_USBDEV_MSC_THREAD CONFIG_USBDEV_MSC_THREAD
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -90,7 +95,7 @@ rndis 控制传输最大接收和发送的长度,根据 RNDIS options list 决
CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rndis 以太网帧的最大长度,默认 1536 rndis 以太网帧的最大长度,默认 1580
CONFIG_USBDEV_RNDIS_VENDOR_ID CONFIG_USBDEV_RNDIS_VENDOR_ID
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -103,7 +108,7 @@ CONFIG_USBDEV_RNDIS_USING_LWIP
rndis 与 lwip 接口的对接 rndis 与 lwip 接口的对接
主机相关 CONFIG 主机协议栈 CONFIG
--------------------- ---------------------
以下参数决定了支持的最大外部hub数量接口数每个接口的端点数和 altsetting 数量,更改此值会影响 ram 的大小,建议根据实际情况更改。 以下参数决定了支持的最大外部hub数量接口数每个接口的端点数和 altsetting 数量,更改此值会影响 ram 的大小,建议根据实际情况更改。

View File

@@ -142,6 +142,17 @@ usb_hc_init
- **return** 返回 0 表示正确,其他表示错误 - **return** 返回 0 表示正确,其他表示错误
usb_hc_deinit
""""""""""""""""""""""""""""""""""""
``usb_hc_deinit`` 用于反初始化 usb host controller 寄存器。 **此函数不对用户开放**
.. code-block:: C
int usb_hc_deinit(void);
- **return** 返回 0 表示正确,其他表示错误
usbh_roothub_control usbh_roothub_control
"""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""

View File

@@ -1 +0,0 @@
TODO

View File

@@ -0,0 +1,2 @@
usbd_audiov1
===============

View File

@@ -0,0 +1,2 @@
usbd_audiov2
===============

View File

@@ -0,0 +1,2 @@
usbd_cdc_acm
===============

View File

@@ -0,0 +1,2 @@
usbd_cdc_ecm
===============

View File

@@ -0,0 +1,2 @@
usbd_hid
===============

View File

@@ -0,0 +1,2 @@
usbd_msc
===============

View File

@@ -0,0 +1,2 @@
usbd_rndis
===============

View File

@@ -0,0 +1,2 @@
usbd_video
===============

View File

@@ -0,0 +1,2 @@
usbd_webusb
===============

View File

@@ -0,0 +1,2 @@
usbd_winusb
===============

View File

@@ -0,0 +1,2 @@
usbh_bluetooth
===============

View File

@@ -0,0 +1,2 @@
usbh_hid
===============

View File

@@ -0,0 +1,2 @@
usbh_msc
===============

View File

@@ -0,0 +1,2 @@
usbh_net
===============

View File

@@ -0,0 +1,2 @@
usbh_serial
===============

View File

@@ -0,0 +1,2 @@
usbh_wifi
===============

View File

@@ -53,10 +53,10 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的
:maxdepth: 1 :maxdepth: 1
:caption: 快速上手 :caption: 快速上手
quick_start/index quick_start/demo
quick_start/rt-thread/rtthread quick_start/transplant
quick_start/other_chip quick_start/rtthread
version quick_start/esp
q&a q&a
.. toctree:: .. toctree::
@@ -92,16 +92,39 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: 基本例程 :caption: 例程说明
demo/index demo/usbd_cdc_acm
demo/usbd_hid
demo/usbd_msc
demo/usbd_rndis
demo/usbd_ecm
demo/usbd_audiov1
demo/usbd_audiov2
demo/usbd_video
demo/usbd_winusb
demo/usbd_webusb
demo/usbh_serial
demo/usbh_hid
demo/usbh_msc
demo/usbh_net
demo/usbh_bluetooth
demo/usbh_wifi
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Porting 说明 :caption: USBIP 介绍
porting usbip/ohci
porting_usbip usbip/ehci
usbip/xhci
usbip/chipidea
usbip/dwc2
usbip/musb
usbip/fotg210
usbip/cdns2
usbip/cdns3
usbip/dwc3
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
@@ -109,6 +132,12 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的
tools/index tools/index
.. toctree::
:maxdepth: 1
:caption: 版本说明
version
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: 商业支持 :caption: 商业支持

View File

@@ -1,24 +0,0 @@
Porting 如何编写
==============================
本节主要介绍没有支持的芯片如何做 porting。
从机 porting
----------------------------
- 首先复制一份从 `port/template` 复制一份 `usb_dc.c` 并参与编译,保证能编译过。
- 实现 ``usb_dc_init`` 保证能进入中断
- 在中断中判断 reset 中断并能够正常触发 reset 中断,在 reset 中断中调用 ``usbd_event_reset_handler``,如果可能,还需要启动读取 setup 包。
- 在中断中判断 setup 中断并能够正常触发 setup 中断,然后将读取的数据传入 ``usbd_event_ep0_setup_complete_handler``
- 实现 ``usbd_ep_start_write`` 并能够触发发送完成中断
- 实现 ``usbd_ep_start_read`` 并能够触发接收完成中断
- 分包处理
主机 porting
----------------------------
- 首先复制一份从 `port/template` 复制一份 `usb_hc.c` 并参与编译,保证能编译过。
- 实现 ``usb_hc_init`` 保证能进入中断
- 能够进入插拔中断,比如 ``connect````disconnect``,并调用 ``usbh_roothub_thread_wakeup`` 能够唤醒 hub 线程
- 实现 ``usbh_roothub_control`` 并根据第三个条件,能够完成 ``usbh_hub_events````usbh_enumerate`` 之前的流程
- 实现 ``usbh_submit_urb``

View File

@@ -0,0 +1,17 @@
基于 ESP-Registry 开发指南
===========================
ESP-Registry 可以参考官方文档,推荐使用 vscode + esp-idf 的开发环境。
- ctrl + shift + p 选择 ESP-IDF 欢迎界面,然后选择 Component mananger
.. figure:: img/esp1.png
- 找到 cherryusb 并安装
.. figure:: img/esp2.png
- 打开 menuconfig并打开 cherryusb 的配置,根据实际情况选择主机或者从机模式
.. figure:: img/esp3.png
.. figure:: img/esp4.png

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,6 +1,8 @@
基于 RT-Thread 软件包开发指南 基于 RT-Thread 软件包开发指南
=============================== ===============================
.. note:: CherryUSB 已经加入 RT-Thread 主线,可以选择使用主线版本,配置方式相同。
本节主要介绍使用 RT-Thread 提供的软件包管理器来配置工程,以 env 作为演示。本节操作不同芯片都一样,后续不再重复讲解。打开 env 以后使用 menuconfig 进入包管理器,并在如图所示路径中选择 CherryUSB。 本节主要介绍使用 RT-Thread 提供的软件包管理器来配置工程,以 env 作为演示。本节操作不同芯片都一样,后续不再重复讲解。打开 env 以后使用 menuconfig 进入包管理器,并在如图所示路径中选择 CherryUSB。
.. figure:: img/env0.png .. figure:: img/env0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

View File

@@ -12,6 +12,7 @@
.. figure:: img/dwc2_hostuvc1.png .. figure:: img/dwc2_hostuvc1.png
.. figure:: img/dwc2_hostuvc2.png .. figure:: img/dwc2_hostuvc2.png
.. figure:: img/dwc2_hostuac.png
- 主机 UVC & UAC 类 MUSB IP 中 ISO 驱动和 UAC/UVC 框架, MUSB 需要为 mentor 公司制定的标准 IP - 主机 UVC & UAC 类 MUSB IP 中 ISO 驱动和 UAC/UVC 框架, MUSB 需要为 mentor 公司制定的标准 IP

View File

@@ -0,0 +1,2 @@
CDNS2
===============

View File

@@ -0,0 +1,2 @@
CDNS3
===============

View File

@@ -0,0 +1,2 @@
CHIPIDEA
=================

View File

@@ -0,0 +1,2 @@
DWC2
=================

View File

@@ -0,0 +1,2 @@
DWC3
===============

View File

@@ -0,0 +1,2 @@
EHCI
=================

View File

@@ -0,0 +1,2 @@
FOTG210
===============

View File

@@ -0,0 +1,2 @@
MUSB
=================

View File

@@ -0,0 +1,2 @@
OHCI
=================

View File

@@ -0,0 +1,2 @@
XHCI
=================