Skip to content

Commit 56a2a14

Browse files
committed
docs: update rst
Signed-off-by: sakumisu <[email protected]>
1 parent 734cacb commit 56a2a14

File tree

8 files changed

+43
-48
lines changed

8 files changed

+43
-48
lines changed

docs/source/api/api_device.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- 有多少个接口就调用多少次 `usbd_add_interface`,参数填相关 `xxx_init_intf`, 如果没有支持的,手动创建一个 intf 填入
88
- 有多少个端点就调用多少次 `usbd_add_endpoint`,当中断完成时,会调用到注册的端点回调中。
99

10+
参考下面这张图:
11+
12+
.. figure:: img/api_device1.png
13+
1014
CORE
1115
-----------------
1216

docs/source/api/api_host.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ CLASS 驱动信息结构体
1515
.. code-block:: C
1616
1717
struct usbh_class_info {
18-
uint8_t match_flags; /* Used for product specific matches; range is inclusive */
19-
uint8_t class; /* Base device class code */
20-
uint8_t subclass; /* Sub-class, depends on base class. Eg. */
21-
uint8_t protocol; /* Protocol, depends on base class. Eg. */
22-
uint16_t vid; /* Vendor ID (for vendor/product specific devices) */
23-
uint16_t pid; /* Product ID (for vendor/product specific devices) */
18+
uint8_t match_flags; /* Used for product specific matches; range is inclusive */
19+
uint8_t bInterfaceClass; /* Base device class code */
20+
uint8_t bInterfaceSubClass; /* Sub-class, depends on base class. Eg. */
21+
uint8_t bInterfaceProtocol; /* Protocol, depends on base class. Eg. */
22+
const uint16_t (*id_table)[2]; /* List of Vendor/Product ID pairs */
2423
const struct usbh_class_driver *class_driver;
2524
};
2625
File renamed without changes.
66 KB
Loading
497 KB
Loading

docs/source/demo/usbd_adb.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
usbd_adb
2+
===============
3+
4+
本节主要介绍如何使用 adb device。支持 **cherrysh** 和 rt-thread **msh**,只需要在 main 中添加以下初始化即可。
5+
6+
.. code-block:: C
7+
8+
cherryadb_init(0, xxxxx);
9+
10+
如果使用 rt-thread,还需要在 menuconfig 中使能 adb device。
11+
12+
.. figure:: img/rtt_adb_shell1.png
13+
14+
进入 adb
15+
--------------
16+
17+
- 使用 **cherrysh** 时枚举完成以后自动进入 adb 模式
18+
- 使用 **msh** 需要在 **msh** 中输入 ``adb_enter`` 进入 adb 模式
19+
20+
退出 adb
21+
--------------
22+
23+
- 使用 **cherrysh** 时输入 ``exit`` 退出 adb 模式
24+
- 使用 **msh** 需要在 **msh** 中输入 ``adb_exit`` 退出 adb 模式
25+
26+
.. figure:: img/cherryadb.png
27+
28+
.. figure:: img/rtt_adb_shell2.png

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的
107107
demo/usbd_video
108108
demo/usbd_winusb
109109
demo/usbd_webusb
110+
demo/usbd_adb
110111
demo/usbh_serial
111112
demo/usbh_hid
112113
demo/usbh_msc

docs/source/quick_start/rtthread.rst

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
主机配置
5454
--------------------------
5555

56-
* 选择 Enable usb host mode 并敲回车进入
57-
* 选择 USB host ip,不清楚自己芯片是哪个 ip 的可以参考 **port** 目录下对应的 readme
56+
* 选择 Enable usb host mode 并敲回车进入
57+
* 选择 USB host ip,不清楚自己芯片是哪个 ip 的可以参考 **port** 目录下对应的 readme
5858
* 根据需要勾选 class 驱动
59-
* 选择是否开启模板 demo,请注意, msc 禁止使能,因为默认对接到 dfs。
59+
* 选择是否开启模板 demo,推荐不用
6060

6161
.. figure:: img/env2.png
6262

@@ -71,25 +71,8 @@
7171
7272
* USB IP 相关的 config 需要用户自己根据芯片实际情况修改
7373
* 在代码中实现 `usb_hc_low_level_init` 函数
74+
* 在中断函数中调用 `USBH_IRQHandler`,并传入 `busid`
7475
* 调用 `usbh_initialize` 并填入 `busid` 和 USB IP 的 `reg base`, `busid` 从 0 开始,不能超过 `CONFIG_USBHOST_MAX_BUS`
75-
* 以上内容我们推荐放在 **board.c** 中,如下代码:
76-
77-
.. code-block:: C
78-
79-
void OTG_HS_IRQHandler(void)
80-
{
81-
extern void USBH_IRQHandler(uint8_t busid);
82-
USBH_IRQHandler(0);
83-
}
84-
85-
int usbh_init(void)
86-
{
87-
usbh_initialize(0, USB_OTG_HS_PERIPH_BASE);
88-
return 0;
89-
}
90-
91-
INIT_APP_EXPORT(usbh_init);
92-
9376
* 使用 `scons --target=mdk5` 或者 `scons` 进行编译,如果是mdk,需要使用 AC6 编译器
9477
* 如果使用的是 GCC ,需要在链接脚本(需要放在 flash 位置)中添加如下代码:
9578

@@ -124,24 +107,4 @@
124107
__usbh_class_info_end__ = .;
125108
. = ALIGN(4);
126109
_etext = .; /* define a global symbols at end of code */
127-
} > FLASH
128-
129-
借助 STM32CubeMX 生成 USB 初始化
130-
----------------------------------
131-
132-
使用 STM32CubeMX 主要是用来生成 usb 时钟、引脚、中断的配置。我们需要点击如图所示文件,并配置好 USB 的时钟、中断,点击 `Generate Code`。
133-
134-
.. figure:: img/stm32cubemx0.png
135-
.. figure:: img/stm32cubemx1.png
136-
.. figure:: img/stm32cubemx2.png
137-
.. figure:: img/stm32cubemx_clk.png
138-
139-
- 将 `main.c` 中的 `SystemClock_Config` 替换掉 `board.c` 中的配置
140-
141-
.. figure:: img/stm32_init2.png
142-
143-
.. note :: 下面步骤从 V1.5.0 开始不再需要,**fsdev/usb_glue_st.c**, **dwc2/usb_glue_st.c** 文件中已经实现
144-
145-
- 将 `stm32xxxx_hal_msp.c` 中的 `HAL_PCD_MspInit` 或者是 `HAL_HCD_MspInit` 中的内容复制到 `usb_dc_low_level_init` 和 `usb_hc_low_level_init` 函数中,举例如下:
146-
147-
.. figure:: img/stm32_init.png
110+
} > FLASH

0 commit comments

Comments
 (0)