update rst

This commit is contained in:
sakimisu
2022-12-04 14:25:59 +08:00
parent 9b72a17a5b
commit 1bd423cef9
8 changed files with 33 additions and 15 deletions

View File

@@ -26,6 +26,7 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的
其他相关链接:
- **CherryUSB 大纲** https://www.bilibili.com/video/BV1st4y1H7K2
- **从机协议栈视频教程** https://www.bilibili.com/video/BV1Ef4y1t73d
- **主机协议栈视频教程** TODO
- **github** https://github.com/sakumisu/CherryUSB
@@ -36,6 +37,7 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的
quick_start/bl702
quick_start/stm32
quick_start/hpm
quick_start/es32
quick_start/rt-thread/rtthread
quick_start/other_chip

View File

@@ -1,12 +1,24 @@
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

@@ -155,6 +155,8 @@ DWC2
DWC2 IP 支持主从,并且由 **synopsys** 定义了一套标准的寄存器偏移。大部分厂家都使用标准的寄存器偏移,所以如果是从机仅需要修改 `USBD_IRQHandler``USB_BASE``USB_NUM_BIDIR_ENDPOINTS` ,主机仅需要修改 `USBH_IRQHandler``USB_BASE` 即可。
其次还有需要注意 VBUS SENSING 这个项,也会影响 USB 的正常枚举,如何修改参考 `GD32 dwc2驱动的GCCFG_NOVBUSSENS寄存器兼容性和stm32存在区别 <https://github.com/sakumisu/CherryUSB/issues/64>`_
.. caution:: 主机 port 仅支持有高速功能的 dwc2 ip, 因为他支持 dma 模式,如果厂家买的 ip 不支持 dma 模式,则无法使用。
下表为具体芯片从机相关宏的修改值:

View File

@@ -1,6 +1,6 @@
基于 BL 系列开发指南
=========================
BL 系列 USB 的开发主要使用 bl_mcu_sdk关于 bl_mcu_sdk 的环境搭建,参考 `bl_mcu_sdk 环境搭建 <https://dev.bouffalolab.com/media/doc/sdk/bl_mcu_sdk_zh/get_started/index.html>`_
BL 系列 USB 的开发主要使用 bl_mcu_sdk参考 `bl_mcu_sdk <https://github.com/bouffalolab/bl_mcu_sdk>`_
USB 的相关应用位于 `examples/usb` 目录下,环境搭建完成后,即可编译使用。
USB 的相关应用位于 `examples/usbdev``examples/usbhost` 目录下,环境搭建完成后,即可编译使用。

View File

@@ -0,0 +1,6 @@
基于 HPM 系列开发指南
=========================
HPM 系列 USB 的开发主要使用 hpm_sdk ,参考 `hpm sdk <https://github.com/hpmicro/hpm_sdk>`_
USB 的相关应用位于 `samples/cherryusb` 目录下,环境搭建完成后,即可编译使用。

View File

@@ -38,12 +38,12 @@ USB Host 移植要点
.. code-block:: C
define region CHERRYUSB_RAM = [from 0x1080000 + 700k size 68k]; /* reserve for cherryusb region */
define block cherryusb_usbh_class_info { section .usbh_class_info };
define exported symbol __usbh_class_info_start__ = start of region CHERRYUSB_RAM;
define exported symbol __usbh_class_info_end__ = end of region CHERRYUSB_RAM + 1;
define exported symbol __usbh_class_info_start__ = start of block cherryusb_usbh_class_info;
define exported symbol __usbh_class_info_end__ = end of block cherryusb_usbh_class_info + 1;
place in CHERRYUSB_RAM { section .usbh_class_info };
place in AXI_SRAM { block cherryusb_usbh_class_info };
keep { section .usbh_class_info};
- 编译使用。各个 class 如何使用,参考 demo 下的 `usb_host.c` 文件

View File

@@ -84,8 +84,4 @@
其次将 `main.c` 中的 `SystemClock_Config` 替换掉 `board.c` 中的配置
.. figure:: img/stm32_init2.png
其他小伙伴的移植笔记
-------------------------
- @kylongmu `stm32h743-st-nucleo移植CherryUSB- CDC串口 <https://club.rt-thread.org/ask/article/3719.html>`_
.. figure:: img/stm32_init2.png

View File

@@ -34,7 +34,7 @@
}
.. note :: 如果使用 STM32F7 或者 STM32H7, 请在 CFLAG 中添加 STM32F7 或者 STM32H7 宏定义,否则无法枚举
.. caution :: 如果使用 STM32F7 或者 STM32H7, 请在 CFLAG 中添加 STM32F7 或者 STM32H7 宏定义,否则无法枚举
工程样例试用
-----------------------