summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2026-12-05 17:25:27 +0800
committersakumisu <[email protected]>2026-12-05 21:51:10 +0800
commitc22ccc4649e5f7b1f556fa8b656ab2840732cf92 (patch)
tree096923e0001c9772edd49f87cf0b897496b8b9f3 /docs
parenta3e6e5f6cd5ba87f2b5b7858d441c93594de07a0 (diff)
refactor: change urb ep type from struct usb_endpoint_descriptor to struct usbh_endpoint
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'docs')
-rwxr-xr-xdocs/en/api/api_host.rst4
-rwxr-xr-xdocs/en/api/api_port.rst4
-rwxr-xr-xdocs/en/demo/usbh_hid.rst4
-rwxr-xr-xdocs/en/demo/usbh_vendor.rst16
-rw-r--r--docs/zh/api/api_host.rst4
-rw-r--r--docs/zh/api/api_port.rst6
-rw-r--r--docs/zh/demo/usbh_hid.rst13
-rw-r--r--docs/zh/demo/usbh_vendor.rst16
-rw-r--r--docs/zh/migration.rst7
-rw-r--r--docs/zh/version.rst1
10 files changed, 36 insertions, 39 deletions
diff --git a/docs/en/api/api_host.rst b/docs/en/api/api_host.rst
index 7499d188..50cde55f 100755
--- a/docs/en/api/api_host.rst
+++ b/docs/en/api/api_host.rst
@@ -88,7 +88,7 @@ hubport Structure
struct usbh_hub *parent;
struct usbh_hub *self; /* if this hubport is a hub */
struct usbh_bus *bus;
- struct usb_endpoint_descriptor ep0;
+ struct usbh_endpoint ep0;
struct usbh_urb ep0_urb;
usb_osal_mutex_t mutex;
};
@@ -113,7 +113,7 @@ hub Structure
struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS];
struct usbh_hubport *parent;
struct usbh_bus *bus;
- struct usb_endpoint_descriptor *intin;
+ struct usbh_endpoint *intin;
struct usbh_urb intin_urb;
uint8_t *int_buffer;
struct usb_osal_timer *int_timer;
diff --git a/docs/en/api/api_port.rst b/docs/en/api/api_port.rst
index c520459a..161f8d84 100755
--- a/docs/en/api/api_port.rst
+++ b/docs/en/api/api_port.rst
@@ -209,7 +209,7 @@ Among them, the `urb` structure information is as follows:
usb_slist_t list;
void *hcpriv;
struct usbh_hubport *hport;
- struct usb_endpoint_descriptor *ep;
+ struct usbh_endpoint *ep;
uint8_t data_toggle;
uint32_t interval;
struct usb_setup_packet *setup;
@@ -232,7 +232,7 @@ Among them, the `urb` structure information is as follows:
- **hcpriv** Host controller driver private member
- **hport** The hport used by current URB
-- **ep** The endpoint used by current URB
+- **ep** A pointer to the endpoint used by the URB. Its descriptor is stored in ``ep_desc``.
- **data_toggle** Current data toggle
- **interval** URB transfer interval in microseconds. If interval is greater than 1000us, software timer needs to be used for maintenance
- **setup** Setup request buffer, used by endpoint 0
diff --git a/docs/en/demo/usbh_hid.rst b/docs/en/demo/usbh_hid.rst
index f315144f..07f2efa1 100755
--- a/docs/en/demo/usbh_hid.rst
+++ b/docs/en/demo/usbh_hid.rst
@@ -31,7 +31,7 @@ This section mainly introduces the use of Host HID class.
/* test with only one buffer, if you have more hid class, modify by yourself */
/* Suggest you to use timer for int transfer and use ep interval */
- usbh_int_urb_fill(&hid_class->intin_urb, hid_class->hport, hid_class->intin, hid_buffer, hid_class->intin->wMaxPacketSize, 0, usbh_hid_callback, hid_class);
+ usbh_int_urb_fill(&hid_class->intin_urb, hid_class->hport, hid_class->intin, hid_buffer, hid_class->intin->ep_desc.wMaxPacketSize, 0, usbh_hid_callback, hid_class);
ret = usbh_submit_urb(&hid_class->intin_urb);
if (ret < 0) {
goto delete;
@@ -48,7 +48,7 @@ This section mainly introduces the use of Host HID class.
.. code-block:: C
- hub->int_timer = usb_osal_timer_create("hubint_tim", USBH_GET_URB_INTERVAL(hub->intin->bInterval, hport->speed) / 1000, hub_int_timeout, hub, 0);
+ hub->int_timer = usb_osal_timer_create("hubint_tim", USBH_GET_URB_INTERVAL(hub->intin->ep_desc.bInterval, hport->speed) / 1000, hub_int_timeout, hub, 0);
.. note::
diff --git a/docs/en/demo/usbh_vendor.rst b/docs/en/demo/usbh_vendor.rst
index 09afe1cd..e2289624 100755
--- a/docs/en/demo/usbh_vendor.rst
+++ b/docs/en/demo/usbh_vendor.rst
@@ -31,8 +31,8 @@ This section mainly introduces how to write a vendor host driver.
struct usbh_xxx {
struct usbh_hubport *hport;
- struct usb_endpoint_descriptor *xxxin;
- struct usb_endpoint_descriptor *xxxout;
+ struct usbh_endpoint *xxxin;
+ struct usbh_endpoint *xxxout;
struct usbh_urb xxxin_urb;
struct usbh_urb xxxout_urb;
@@ -44,7 +44,7 @@ This section mainly introduces how to write a vendor host driver.
static int usbh_xxx_connect(struct usbh_hubport *hport, uint8_t intf)
{
- struct usb_endpoint_descriptor *ep_desc;
+ struct usbh_endpoint *ep;
int ret;
struct usbh_xxx *xxx_class = usbh_xxx_class_alloc();
@@ -87,12 +87,12 @@ This section mainly introduces how to write a vendor host driver.
.. code-block:: C
- for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) {
- ep_desc = &hport->config.intf[intf].altsetting[0].ep[i].ep_desc;
- if (ep_desc->bEndpointAddress & 0x80) {
- USBH_EP_INIT(xxx_class->intin, ep_desc);
+ for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) {
+ ep = &hport->config.intf[intf].altsetting[0].ep[i];
+ if (ep->ep_desc.bEndpointAddress & 0x80) {
+ USBH_EP_INIT(xxx_class->intin, ep);
} else {
- USBH_EP_INIT(xxx_class->intout, ep_desc);
+ USBH_EP_INIT(xxx_class->intout, ep);
}
}
diff --git a/docs/zh/api/api_host.rst b/docs/zh/api/api_host.rst
index 665a4803..dccb789b 100644
--- a/docs/zh/api/api_host.rst
+++ b/docs/zh/api/api_host.rst
@@ -88,7 +88,7 @@ hubport 结构体
struct usbh_hub *parent;
struct usbh_hub *self; /* if this hubport is a hub */
struct usbh_bus *bus;
- struct usb_endpoint_descriptor ep0;
+ struct usbh_endpoint ep0;
struct usbh_urb ep0_urb;
usb_osal_mutex_t mutex;
};
@@ -113,7 +113,7 @@ hub 结构体
struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS];
struct usbh_hubport *parent;
struct usbh_bus *bus;
- struct usb_endpoint_descriptor *intin;
+ struct usbh_endpoint *intin;
struct usbh_urb intin_urb;
uint8_t *int_buffer;
struct usb_osal_timer *int_timer;
diff --git a/docs/zh/api/api_port.rst b/docs/zh/api/api_port.rst
index 42d40d4b..daab644c 100644
--- a/docs/zh/api/api_port.rst
+++ b/docs/zh/api/api_port.rst
@@ -209,7 +209,7 @@ usbh_submit_urb
usb_slist_t list;
void *hcpriv;
struct usbh_hubport *hport;
- struct usb_endpoint_descriptor *ep;
+ struct usbh_endpoint *ep;
uint8_t data_toggle;
uint32_t interval;
struct usb_setup_packet *setup;
@@ -232,9 +232,9 @@ usbh_submit_urb
- **hcpriv** 主机控制器驱动私有成员
- **hport** 当前 urb 使用的 hport
-- **ep** 当前 urb 使用的 ep
+- **ep** 指向当前 URB 使用的端点对象,描述符位于 ``ep_desc`` 成员
- **data_toggle** 当前 data toggle
-- **interval** urb 传输间隔,单位 us,根据 ep 中的 bInterval 字段计算(bInterval 从 v1.7.0 开始最大支持全速 255,高速 10,旧版本则全速1,高速1,2,3,4)
+- **interval** urb 传输间隔,单位 us,根据 ``ep->ep_desc.bInterval`` 字段计算(bInterval 从 v1.7.0 开始最大支持全速 255,高速 10,旧版本则全速1,高速1,2,3,4)
- **setup** setup 请求缓冲区,端点0使用
- **transfer_buffer** 传输的数据缓冲区
- **transfer_buffer_length** 传输长度
diff --git a/docs/zh/demo/usbh_hid.rst b/docs/zh/demo/usbh_hid.rst
index bd68325a..b393cc70 100644
--- a/docs/zh/demo/usbh_hid.rst
+++ b/docs/zh/demo/usbh_hid.rst
@@ -31,7 +31,7 @@ HID Host
/* test with only one buffer, if you have more hid class, modify by yourself */
/* Suggest you to use timer for int transfer and use ep interval */
- usbh_int_urb_fill(&hid_class->intin_urb, hid_class->hport, hid_class->intin, hid_buffer, hid_class->intin->wMaxPacketSize, 0, usbh_hid_callback, hid_class);
+ usbh_int_urb_fill(&hid_class->intin_urb, hid_class->hport, hid_class->intin, hid_buffer, hid_class->intin->ep_desc.wMaxPacketSize, 0, usbh_hid_callback, hid_class);
ret = usbh_submit_urb(&hid_class->intin_urb);
if (ret < 0) {
goto delete;
@@ -43,13 +43,4 @@ HID Host
}
- 当然,也可以不使用异步操作,而是使用 timeout 的同步操作。
-- HID 使用的是中断传输,因此正常来说,我们需要根据 **bInterval** 来设置定时器,定时触发中断传输,demo 这里没有使用,如果对时间有精确要求,可以选择使用定时器来触发异步发送。
-- 以 hub 通信为例,采用的是一次性定时器,也可以使用周期性定时器。
-
-.. code-block:: C
-
- hub->int_timer = usb_osal_timer_create("hubint_tim", USBH_GET_URB_INTERVAL(hub->intin->bInterval, hport->speed) / 1000, hub_int_timeout, hub, 0);
-
-.. note::
-
- 这里的 `USBH_GET_URB_INTERVAL` 是一个宏定义,用于根据 binterval 计算 URB 的传输间隔时间, 单位是 us,而定时器最低是 ms ,因此需要除以 1000。对于小于等于 1ms 的不需要使用定时器。 \ No newline at end of file
+- HID 使用的是中断传输,需要根据 **bInterval** 来设置传输间隔。在 v1.7.0 版本之前,超过 1ms 的需要用户自行使用软件定时器处理。 \ No newline at end of file
diff --git a/docs/zh/demo/usbh_vendor.rst b/docs/zh/demo/usbh_vendor.rst
index a0b0bb7b..3a2d94c7 100644
--- a/docs/zh/demo/usbh_vendor.rst
+++ b/docs/zh/demo/usbh_vendor.rst
@@ -31,8 +31,8 @@ Vendor Host 驱动编写
struct usbh_xxx {
struct usbh_hubport *hport;
- struct usb_endpoint_descriptor *xxxin;
- struct usb_endpoint_descriptor *xxxout;
+ struct usbh_endpoint *xxxin;
+ struct usbh_endpoint *xxxout;
struct usbh_urb xxxin_urb;
struct usbh_urb xxxout_urb;
@@ -44,7 +44,7 @@ Vendor Host 驱动编写
static int usbh_xxx_connect(struct usbh_hubport *hport, uint8_t intf)
{
- struct usb_endpoint_descriptor *ep_desc;
+ struct usbh_endpoint *ep;
int ret;
struct usbh_xxx *xxx_class = usbh_xxx_class_alloc();
@@ -87,12 +87,12 @@ Vendor Host 驱动编写
.. code-block:: C
- for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) {
- ep_desc = &hport->config.intf[intf].altsetting[0].ep[i].ep_desc;
- if (ep_desc->bEndpointAddress & 0x80) {
- USBH_EP_INIT(xxx_class->intin, ep_desc);
+ for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) {
+ ep = &hport->config.intf[intf].altsetting[0].ep[i];
+ if (ep->ep_desc.bEndpointAddress & 0x80) {
+ USBH_EP_INIT(xxx_class->intin, ep);
} else {
- USBH_EP_INIT(xxx_class->intout, ep_desc);
+ USBH_EP_INIT(xxx_class->intout, ep);
}
}
diff --git a/docs/zh/migration.rst b/docs/zh/migration.rst
index 4b1df6dc..3c001fb0 100644
--- a/docs/zh/migration.rst
+++ b/docs/zh/migration.rst
@@ -98,4 +98,9 @@ net class 内置线程,应用无需手动创建,因此需要增加 `CONFIG_
video frame 描述符
^^^^^^^^^^^^^^^^^^^^
-VIDEO_VS_FRAME_xxx_DESCRIPTOR_INIT 删除了多个 interval 功能,改成只用一个 interval。 \ No newline at end of file
+VIDEO_VS_FRAME_xxx_DESCRIPTOR_INIT 删除了多个 interval 功能,改成只用一个 interval。
+
+urb ep
+^^^^^^^^^^^^^^^^^^^^
+
+urb ep 参数从 `struct usb_endpoint_descriptor` 改成 `struct usbh_endpoint`。 \ No newline at end of file
diff --git a/docs/zh/version.rst b/docs/zh/version.rst
index aae168b1..bcf24e45 100644
--- a/docs/zh/version.rst
+++ b/docs/zh/version.rst
@@ -222,6 +222,7 @@ v1.7.0
- **设置枚举线程优先级默认为 29,修改所有 USB APP 优先级为 CONFIG_USBHOST_PSC_PRIO - 1,需要大于枚举线程优先级,解决 kill urb 和 submit urb 存在的互斥问题**
- **修复大量安全漏洞和临界问题**
- **修复主机驱动 usbh_submit_urb, usbh_kill_urb, isr,断连之间可能存在的资源竞争问题。统一 xxx_urb_waitup 处理(包含完成,超时,取消)**
+- **修改主机驱动 urb ep 类型,从 struct usb_endpoint_descriptor 改为 struct usbh_endpoint,为后续适配 linux 使用**
- device: **新增 cdc ncm class 驱动**
- device: **新增 tmc class 驱动**
- device: **新增 usb3.0 request 和配置**