diff options
| author | sakumisu <[email protected]> | 2026-11-24 22:26:29 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-11-25 21:13:24 +0800 |
| commit | 537dbd69cbe2dc0887eb7803266c2d510ae9fa52 (patch) | |
| tree | 681e94b51611df0a7eb022e2f71f50a36cec9f29 /docs | |
| parent | 87276ca5efd6538c87cc70d01a484379e4ea6ad2 (diff) | |
docs: update rst
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'docs')
| -rwxr-xr-x | docs/en/api/api_config.rst | 2 | ||||
| -rwxr-xr-x | docs/en/demo/usbh_hid.rst | 2 | ||||
| -rwxr-xr-x | docs/en/demo/usbh_msc.rst | 2 | ||||
| -rwxr-xr-x | docs/en/demo/usbh_net.rst | 2 | ||||
| -rw-r--r-- | docs/zh/api/api_config.rst | 2 | ||||
| -rw-r--r-- | docs/zh/demo/usbh_hid.rst | 2 | ||||
| -rw-r--r-- | docs/zh/demo/usbh_msc.rst | 2 | ||||
| -rw-r--r-- | docs/zh/demo/usbh_net.rst | 2 | ||||
| -rw-r--r-- | docs/zh/quick_start/opensource.rst | 10 | ||||
| -rw-r--r-- | docs/zh/quick_start/q&a.rst | 60 | ||||
| -rw-r--r-- | docs/zh/show/img/wch_hs_speed.jpg (renamed from docs/zh/show/img/wch_speed.jpg) | bin | 75341 -> 75341 bytes | |||
| -rw-r--r-- | docs/zh/show/img/wch_ss_ch372_speed.png | bin | 0 -> 74411 bytes | |||
| -rw-r--r-- | docs/zh/show/img/wch_ss_speed.png | bin | 0 -> 144893 bytes | |||
| -rw-r--r-- | docs/zh/show/index.rst | 6 | ||||
| -rw-r--r-- | docs/zh/version.rst | 7 |
15 files changed, 83 insertions, 16 deletions
diff --git a/docs/en/api/api_config.rst b/docs/en/api/api_config.rst index f1fed77a..6cc67f17 100755 --- a/docs/en/api/api_config.rst +++ b/docs/en/api/api_config.rst @@ -139,7 +139,7 @@ The following parameters determine the maximum number of supported class drivers CONFIG_USBHOST_PSC_PRIO ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Priority of host plug/unplug thread, default is 0. Lower values mean higher priority. +Priority of host plug/unplug thread, default is 29. Lower values mean higher priority. CONFIG_USBHOST_PSC_STACKSIZE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/en/demo/usbh_hid.rst b/docs/en/demo/usbh_hid.rst index 7929179d..f315144f 100755 --- a/docs/en/demo/usbh_hid.rst +++ b/docs/en/demo/usbh_hid.rst @@ -10,7 +10,7 @@ This section mainly introduces the use of Host HID class. void usbh_hid_run(struct usbh_hid *hid_class) { - usb_osal_thread_create("usbh_hid", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_hid_thread, hid_class); + usb_osal_thread_create("usbh_hid", 2048, CONFIG_USBHOST_PSC_PRIO - 1, usbh_hid_thread, hid_class); } void usbh_hid_stop(struct usbh_hid *hid_class) diff --git a/docs/en/demo/usbh_msc.rst b/docs/en/demo/usbh_msc.rst index b47abdc8..4d540981 100755 --- a/docs/en/demo/usbh_msc.rst +++ b/docs/en/demo/usbh_msc.rst @@ -9,7 +9,7 @@ This section mainly introduces the use of Host MSC. Read and write functions are void usbh_msc_run(struct usbh_msc *msc_class) { - usb_osal_thread_create("usbh_msc", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_msc_thread, msc_class); + usb_osal_thread_create("usbh_msc", 2048, CONFIG_USBHOST_PSC_PRIO - 1, usbh_msc_thread, msc_class); } void usbh_msc_stop(struct usbh_msc *msc_class) diff --git a/docs/en/demo/usbh_net.rst b/docs/en/demo/usbh_net.rst index 13069563..95b40054 100755 --- a/docs/en/demo/usbh_net.rst +++ b/docs/en/demo/usbh_net.rst @@ -77,7 +77,7 @@ The following example shows the LWIP connection process. } } - usb_osal_thread_create("usbh_cdc_ecm_rx", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_cdc_ecm_rx_thread, NULL); + usb_osal_thread_create("usbh_cdc_ecm_rx", 2048, CONFIG_USBHOST_PSC_PRIO - 1, usbh_cdc_ecm_rx_thread, NULL); #if LWIP_DHCP dhcp_start(netif); usb_osal_timer_start(dhcp_handle); diff --git a/docs/zh/api/api_config.rst b/docs/zh/api/api_config.rst index c1fe8603..ba9358be 100644 --- a/docs/zh/api/api_config.rst +++ b/docs/zh/api/api_config.rst @@ -140,7 +140,7 @@ rndis 与 lwip 接口的对接 CONFIG_USBHOST_PSC_PRIO ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -主机插拔线程的优先级,默认是 0,数值越小,优先级越高 +主机插拔线程的优先级,默认是 29,数值越小,优先级越高 CONFIG_USBHOST_PSC_STACKSIZE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/zh/demo/usbh_hid.rst b/docs/zh/demo/usbh_hid.rst index 2719bf70..bd68325a 100644 --- a/docs/zh/demo/usbh_hid.rst +++ b/docs/zh/demo/usbh_hid.rst @@ -10,7 +10,7 @@ HID Host void usbh_hid_run(struct usbh_hid *hid_class) { - usb_osal_thread_create("usbh_hid", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_hid_thread, hid_class); + usb_osal_thread_create("usbh_hid", 2048, CONFIG_USBHOST_PSC_PRIO - 1, usbh_hid_thread, hid_class); } void usbh_hid_stop(struct usbh_hid *hid_class) diff --git a/docs/zh/demo/usbh_msc.rst b/docs/zh/demo/usbh_msc.rst index 524dc5c1..fb982d29 100644 --- a/docs/zh/demo/usbh_msc.rst +++ b/docs/zh/demo/usbh_msc.rst @@ -9,7 +9,7 @@ MSC Host void usbh_msc_run(struct usbh_msc *msc_class) { - usb_osal_thread_create("usbh_msc", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_msc_thread, msc_class); + usb_osal_thread_create("usbh_msc", 2048, CONFIG_USBHOST_PSC_PRIO - 1, usbh_msc_thread, msc_class); } void usbh_msc_stop(struct usbh_msc *msc_class) diff --git a/docs/zh/demo/usbh_net.rst b/docs/zh/demo/usbh_net.rst index 1516f397..49aec895 100644 --- a/docs/zh/demo/usbh_net.rst +++ b/docs/zh/demo/usbh_net.rst @@ -66,7 +66,7 @@ USB 网卡对接过程 } } - usb_osal_thread_create("usbh_cdc_ecm_rx", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_cdc_ecm_rx_thread, NULL); + usb_osal_thread_create("usbh_cdc_ecm_rx", 2048, CONFIG_USBHOST_PSC_PRIO - 1, usbh_cdc_ecm_rx_thread, NULL); #if LWIP_DHCP dhcp_start(netif); usb_osal_timer_start(dhcp_handle); diff --git a/docs/zh/quick_start/opensource.rst b/docs/zh/quick_start/opensource.rst index ed730dbc..e671bcbb 100644 --- a/docs/zh/quick_start/opensource.rst +++ b/docs/zh/quick_start/opensource.rst @@ -74,4 +74,12 @@ * - zmk - OpenSiFli - https://github.com/OpenSiFli/zmk - + * - esp-hosted-mcu + - espressif + - https://github.com/espressif/esp-hosted-mcu + * - ds5dongle-bl618-opensource + - sqlCRT + - https://github.com/sqlCRT/ds5dongle-bl618-opensource + * - zephyr-components + - YuzukiHD + - https://github.com/YuzukiHD/zephyr-components diff --git a/docs/zh/quick_start/q&a.rst b/docs/zh/quick_start/q&a.rst index 821688ac..6b816cb2 100644 --- a/docs/zh/quick_start/q&a.rst +++ b/docs/zh/quick_start/q&a.rst @@ -39,7 +39,7 @@ GD IP 问题 GD IP 采用 DWC2,但是读取的硬件参数都是 0(我也不懂为什么不给人知道),因此需要用户自行知道硬件信息,从 1.5.0 开始由于需要读取硬件信息,因此无法直接使用。 -其次 GD 复位以后无法使用 EPDIS 功能关闭端点,需要用户删除 reset 中断中的以下代码: +其次 GD 复位以后无法使用 EPDIS 功能关闭端点,需要用户删除 reset 中断中的以下代码(从 1.7.0 开始不需要加了,默认不再 EPDIS): .. code-block:: C @@ -48,6 +48,8 @@ GD IP 采用 DWC2,但是读取的硬件参数都是 0(我也不懂为什么� 除此之外可能存在其他未知 BUG,请自行测试。 +.. note:: 从 1.7.0 开始,新增 dwc2_get_gd_reg,用于软件模拟 DWC2 参数寄存器信息,以替换硬件参数寄存器 + 开启 USB_LOG_DBG 后无法枚举 ---------------------------------------------------------------- @@ -81,7 +83,7 @@ This dwc2 version does not support dma mode, so stop working OTG 有哪些芯片支持 ------------------------------ -当前主线仅 HPM 芯片支持 OTG 功能,通过 ID 引脚自动切换主从模式,其他芯片请使用手动切换模式 OR 自行实现添加 ID 识别的驱动。 +当前主线仅 hpmicro 支持,厂家 sdk 则包括 phytuim,artinchip, nuvoton 芯片支持 OTG 功能,通过 ID 引脚或者 UCSI-ACPI 自动切换主从模式,其他芯片请使用手动切换模式 OR 自行实现添加 ID 识别的驱动。 PC 识别的 COM 口如何更改名称 ---------------------------------------------------------------- @@ -135,4 +137,56 @@ USB host 连接 USB 网卡问题 ------------------------------------------------- - 在未开启 CONFIG_USB_DCACHE_ENABLE 时,仅 DWC2/WCH/AIC IP 需要 4字节对齐,其余 1字节对齐即可。 -- 在开启 CONFIG_USB_DCACHE_ENABLE 时,所有 IP 都需要对齐到 CONFIG_USB_ALIGN_SIZE 字节
\ No newline at end of file +- 在开启 CONFIG_USB_DCACHE_ENABLE 时,所有 IP 都需要对齐到 CONFIG_USB_ALIGN_SIZE 字节 + +主机优先级相关注意事项 +------------------------------------------------- + +枚举线程优先级需要比所有用到 submit 地方的 USB APP 优先级低。 + +主机 class 变量生命周期的处理 +------------------------------------------------- + +当前每个 class 提供了 disconnect 函数,当这个函数执行完成后,class 的资源就准备释放了,因此,其他地方就不可以再访问该资源。合理的做法是, +在 disconnect 函数中增加信号量等待,直到所有对该 class 资源的操作完成,然后释放信号量,这样才能保证安全退出。 **也可以使用互斥锁解决**。选其一即可。 + +举例如下: + +.. code-block:: C + static usb_osal_sem_t xxx_exit_sem; + + /* 启动任务前执行;初始计数为 0 */ + xxx_exit_sem = usb_osal_sem_create(0); + + static void xxx_thread(void *arg) + { + struct usbh_xxx *xxx = arg; + int ret; + + while (xxx->hport->connected) { + ret = usbh_submit_urb(&xxx->xxxin_urb); + if (ret < 0) { + break; + } + + /* 处理数据 */ + } + + /* 在这里完成其他收尾 */ + + usb_osal_sem_give(xxx_exit_sem); + /* 从这里开始,不能再访问 xxx、URB 或相关 buffer */ + usb_osal_thread_delete(NULL); + } + + void usbh_xxx_stop(struct usbh_xxx *xxx) + { + /* 等待任务退出 */ + usb_osal_sem_take(xxx_exit_sem, USB_OSAL_WAIT_FOREVER); + } + +主机 class 驱动编写注意事项 +------------------------------------------------- + +- 禁止在 class 驱动中调用非控制传输的请求,class 驱动只做枚举相关功能 +- 禁止在 class 驱动中使用除了控制传输的阻塞功能,否则影响插拔时效
\ No newline at end of file diff --git a/docs/zh/show/img/wch_speed.jpg b/docs/zh/show/img/wch_hs_speed.jpg Binary files differindex e7fb6c63..e7fb6c63 100644 --- a/docs/zh/show/img/wch_speed.jpg +++ b/docs/zh/show/img/wch_hs_speed.jpg diff --git a/docs/zh/show/img/wch_ss_ch372_speed.png b/docs/zh/show/img/wch_ss_ch372_speed.png Binary files differnew file mode 100644 index 00000000..b823aad8 --- /dev/null +++ b/docs/zh/show/img/wch_ss_ch372_speed.png diff --git a/docs/zh/show/img/wch_ss_speed.png b/docs/zh/show/img/wch_ss_speed.png Binary files differnew file mode 100644 index 00000000..841741f9 --- /dev/null +++ b/docs/zh/show/img/wch_ss_speed.png diff --git a/docs/zh/show/index.rst b/docs/zh/show/index.rst index ed9e2a88..cd01532d 100644 --- a/docs/zh/show/index.rst +++ b/docs/zh/show/index.rst @@ -13,9 +13,11 @@ CDC ACM 通信 - HPM 系列(从机可以到 42MB/S, 主机 44MB/S, 已经达到硬件极限) - BL 系列(从机 32MB/S, 主机 25MB/S, 已经达到硬件极限) - STM32F4 全速(从机 900KB/S, 主机 1.12MB/S, 已经达到硬件极限) -- WCH USBHS 高速(从机 46MB/S) +- WCH USBHS 高速(从机 46MB/S), 超高速(从机 400MB/S) -.. figure:: img/wch_speed.jpg +.. figure:: img/wch_hs_speed.jpg +.. figure:: img/wch_ss_speed.jpg +.. figure:: img/wch_ss_ch372_speed.jpg 从机测速demo: cdc_acm_template.c 并且关闭 log,脚本使用 `tools/test_srcipts/test_cdc_speed.py` 主机测速demo: usb_host.c 中 TEST_USBH_CDC_SPEED=1 diff --git a/docs/zh/version.rst b/docs/zh/version.rst index d5019261..197c5614 100644 --- a/docs/zh/version.rst +++ b/docs/zh/version.rst @@ -219,6 +219,7 @@ v1.7.0 ---------------------- - **新增注册驱动 API,从这个版本开始可以同时使用多个不同的 USBIP** +- **设置枚举线程优先级默认为 29,修改所有 USB APP 优先级为 CONFIG_USBHOST_PSC_PRIO - 1,需要大于枚举线程优先级,解决 kill urb 和 submit urb 存在的互斥问题** - device: **新增 cdc ncm class 驱动** - device: **新增 tmc class 驱动** - device: **新增 usb3.0 request 和配置** @@ -227,6 +228,7 @@ v1.7.0 - device: 新增获取 speed 和 ep info api - device: **新增 usb_vfs api, posix 标准接口** - device: msc 支持 SCSI_readCapacity16 命令 +- device: **新增 gs usb 驱动** - host: **重构 audio 驱动和 API,volume 配置范围改成 0~ 100,audio sample rate 最大支持 8个默认** - host: **serial 增加 RX 流控** - host: **简化 net class rx 接收,最大不再超过 16K** @@ -235,10 +237,11 @@ v1.7.0 - host: 修复 hid API 漏掉的 **hport->intf** - host: only release hport in disconnect - port: **renesas 从机支持** -- port: **esp32s31 支持** +- port: **esp32s31,esp32h4 支持** - port: **N32H49X和N32H7XX USBHS 支持** - port: **N32H4x (N32H47x_48x / N32H49x) FSDEV 支持** - port: **删除旧版本 wch 驱动,重构 usbfs,usbhs 主从驱动支持** +- port: **wch usb3.0 主从支持** - port: 统一 cache 处理到 usbh_submit_urb - port: 将部分 glue 文件放到厂家文件夹中 - port: 修复 ehci setup cache 和 qh,qtd cache 处理 @@ -256,4 +259,4 @@ v1.7.0 - 更新 usb 测速工具 - CI 功能新增 wch,sifli,phytium 支持 - osal 的部分修复 -- 安全性代码检查
\ No newline at end of file +- 安全性代码检查和修复
\ No newline at end of file |
