update rst
This commit is contained in:
@@ -119,7 +119,7 @@ USB Device 移植要点
|
||||
.. figure:: img/stm32_12.png
|
||||
.. figure:: img/stm32_14.png
|
||||
|
||||
- 在中断函数中调用 `USBH_IRQHandler`,并传入 `busid`
|
||||
- 在中断函数中调用 `USBD_IRQHandler`,并传入 `busid`
|
||||
|
||||
.. figure:: img/stm32_13.png
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ USB Device 移植要点
|
||||
USB Host 移植要点
|
||||
-----------------------
|
||||
|
||||
.. note:: 请注意,当前是最新版本,支持多 port 功能,`USBH_BASE` 和 `USBH_IRQHandler` 的宏不能再使用,并且必须调用 `usbh_alloc_bus`,具体按照以下步骤执行。
|
||||
|
||||
- 拷贝 CherryUSB 源码到工程目录下,并按需添加源文件和头文件路径,其中 `usbh_core.c` 、 `usb_hc_xxx.c` 以及 **osal** 目录下源文件(根据不同的 os 选择对应的源文件)为必须添加项。而 `usb_hc_xxx.c` 是芯片所对应的 USB IP dcd 部分驱动,如果不知道自己芯片属于那个 USB IP,参考 **port** 目录下的不同 USB IP 的 readme。如果使用的 USB IP 没有支持,只能自己实现了
|
||||
- 拷贝 `cherryusb_config_template.h` 文件到自己工程目录下,命名为 `usb_config.h`,并添加相应的目录头文件路径
|
||||
- 实现 `usb_hc_low_level_init` 函数(该函数主要负责 USB 时钟、引脚、中断的初始化)。该函数可以放在你想要放的任何参与编译的 c 文件中。如何进行 USB 的时钟、引脚、中断等初始化,请自行根据你使用的芯片原厂提供的源码中进行添加。
|
||||
@@ -49,8 +47,6 @@ USB Host 移植要点
|
||||
|
||||
- 编译使用。各个 class 如何使用,参考 demo 下的 `usb_host.c` 文件
|
||||
|
||||
.. caution:: 如果主从 ip 共用一个中断,设置 `USBD_IRQHandler=USBD_IRQHandler` 、 `USBH_IRQHandler=USBH_IRQHandler` ,然后由真正的中断函数根据主从模式调用这两个函数。
|
||||
|
||||
带 cache 功能的芯片使用注意
|
||||
-------------------------------
|
||||
|
||||
|
||||
@@ -56,24 +56,21 @@
|
||||
|
||||
.. figure:: img/config_file.png
|
||||
|
||||
* 在代码中实现 `usb_hc_low_level_init` 函数,USB 中断中调用 `USBH_IRQHandler`,
|
||||
* 应用中调用 `usbh_alloc_bus` 和 `usbh_initialize`,
|
||||
* 在代码中实现 `usb_hc_low_level_init` 函数,USB 中断中调用 `USBH_IRQHandler`
|
||||
* 调用 `usbh_initialize`
|
||||
* 以上内容我们推荐放在 **board.c** 中,如下代码:
|
||||
|
||||
.. code-block:: C
|
||||
|
||||
struct usbh_bus *usb_otg_hs_bus;
|
||||
|
||||
void OTG_HS_IRQHandler(void)
|
||||
{
|
||||
extern void USBH_IRQHandler(struct usbh_bus *bus);
|
||||
USBH_IRQHandler(usb_otg_hs_bus);
|
||||
extern void USBH_IRQHandler(uint8_t busid);
|
||||
USBH_IRQHandler(0);
|
||||
}
|
||||
|
||||
int usbh_init(void)
|
||||
{
|
||||
usb_otg_hs_bus = usbh_alloc_bus(0, USB_OTG_HS_PERIPH_BASE);
|
||||
usbh_initialize(usb_otg_hs_bus);
|
||||
usbh_initialize(0, USB_OTG_HS_PERIPH_BASE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user