summaryrefslogtreecommitdiff
path: root/docs/en/api
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2026-01-30 22:10:34 +0800
committersakumisu <[email protected]>2026-01-30 23:16:00 +0800
commiteaefb8ed21ed23f732e8b608ed7948e6b71ab0d8 (patch)
tree427acdc61cd9bbe9a03f500bfa604a425ed3b1e4 /docs/en/api
parent76b3720445f5b2396f3cd7dfdbecc277cafc76e7 (diff)
docs: update docs and add english version
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'docs/en/api')
-rwxr-xr-xdocs/en/api/api_config.rst162
-rwxr-xr-xdocs/en/api/api_device.rst503
-rwxr-xr-xdocs/en/api/api_host.rst317
-rwxr-xr-xdocs/en/api/api_port.rst266
-rwxr-xr-xdocs/en/api/img/api_device1.pngbin0 -> 296936 bytes
-rwxr-xr-xdocs/en/api/img/api_host1.pngbin0 -> 43480 bytes
-rwxr-xr-xdocs/en/api/img/api_host2.pngbin0 -> 46429 bytes
7 files changed, 1248 insertions, 0 deletions
diff --git a/docs/en/api/api_config.rst b/docs/en/api/api_config.rst
new file mode 100755
index 00000000..f1fed77a
--- /dev/null
+++ b/docs/en/api/api_config.rst
@@ -0,0 +1,162 @@
+USB CONFIG Description
+=======================================
+
+General CONFIG
+---------------------
+
+CONFIG_USB_PRINTF
+^^^^^^^^^^^^^^^^^^^^
+
+USB log functionality, defaults to redirect to printf. Note that USB log will be used in interrupts, so the redirected API must not block. For example, if using RT-Thread, please change to rt-kprintf
+
+CONFIG_USB_DBG_LEVEL
+^^^^^^^^^^^^^^^^^^^^^^
+
+Controls the log print level
+
+CONFIG_USB_PRINTF_COLOR_ENABLE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Controls log color printing, enabled by default
+
+CONFIG_USB_DCACHE_ENABLE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When not using nocache RAM, enable this macro to ensure data consistency. **When using EHCI, nocache RAM is still required internally**.
+
+CONFIG_USB_ALIGN_SIZE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+USB buffer alignment size, default is 4. IP in DMA mode may have alignment requirements for input buffers, typically 4. If other alignment is needed, please modify this value.
+
+USB_NOCACHE_RAM_SECTION
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If the chip doesn't have cache functionality, this macro is ineffective. If it does, USB input/output buffers must be placed in nocache RAM to ensure data consistency.
+
+Device Protocol Stack CONFIG
+------------------------------
+
+CONFIG_USBDEV_REQUEST_BUFFER_LEN
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Controls the maximum length of control transfer receive and send buffer, default is 512.
+
+CONFIG_USBDEV_SETUP_LOG_PRINT
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Enable or disable setup packet dump information, disabled by default.
+
+CONFIG_USBDEV_DESC_CHECK
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Not implemented yet
+
+CONFIG_USBDEV_TEST_MODE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Enable or disable USB test mode
+
+CONFIG_USBDEV_MSC_MAX_BUFSIZE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Maximum length of MSC cache. Larger cache results in higher USB speed because storage media typically has much higher multi-block read/write speeds than single block, such as SD cards.
+Default 512. For flash, needs to be changed to 4K. Cache size must be a multiple of the storage media's block size.
+
+CONFIG_USBDEV_MSC_MANUFACTURER_STRING
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CONFIG_USBDEV_MSC_PRODUCT_STRING
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CONFIG_USBDEV_MSC_VERSION_STRING
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CONFIG_USBDEV_MSC_POLLING
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Run usbd_msc_sector_read and usbd_msc_sector_write operations in while1, used in bare-metal systems.
+
+CONFIG_USBDEV_MSC_THREAD
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Enable or disable MSC thread, disabled by default. usbd_msc_sector_read and usbd_msc_sector_write are executed in interrupts by default, so if OS is enabled, it's recommended to enable this macro, then usbd_msc_sector_read and usbd_msc_sector_write will execute in threads.
+
+CONFIG_USBDEV_MSC_PRIO
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Priority of MSC read/write thread, default is 4. Lower values mean higher priority.
+
+CONFIG_USBDEV_MSC_STACKSIZE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Stack size of MSC read/write thread, default 2K bytes
+
+CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Maximum receive and send length for RNDIS control transfers. Minimum length determined by RNDIS options list, default should be greater than or equal to 156.
+
+CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Maximum length of RNDIS Ethernet frame, default 1580
+
+CONFIG_USBDEV_RNDIS_VENDOR_ID
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CONFIG_USBDEV_RNDIS_VENDOR_DESC
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+CONFIG_USBDEV_RNDIS_USING_LWIP
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+RNDIS interface with LWIP
+
+Host Protocol Stack CONFIG
+----------------------------
+
+The following parameters determine the maximum number of supported external hubs, interfaces, endpoints per interface, and altsetting counts. Changing these values affects RAM size, it's recommended to adjust according to actual requirements.
+
+.. code-block:: C
+
+ #define CONFIG_USBHOST_MAX_RHPORTS 1
+ #define CONFIG_USBHOST_MAX_EXTHUBS 1
+ #define CONFIG_USBHOST_MAX_EHPORTS 4
+ #define CONFIG_USBHOST_MAX_INTERFACES 6
+ #define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1
+ #define CONFIG_USBHOST_MAX_ENDPOINTS 4
+
+The following parameters determine the maximum number of supported class drivers. Changing these values affects RAM size, it's recommended to adjust according to actual requirements.
+
+.. code-block:: C
+
+ #define CONFIG_USBHOST_MAX_SERIAL_CLASS 4
+ #define CONFIG_USBHOST_MAX_HID_CLASS 4
+ #define CONFIG_USBHOST_MAX_MSC_CLASS 2
+ #define CONFIG_USBHOST_MAX_AUDIO_CLASS 1
+ #define CONFIG_USBHOST_MAX_VIDEO_CLASS 1
+
+CONFIG_USBHOST_PSC_PRIO
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Priority of host plug/unplug thread, default is 0. Lower values mean higher priority.
+
+CONFIG_USBHOST_PSC_STACKSIZE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Stack size of host plug/unplug thread, default 2K bytes
+
+CONFIG_USBHOST_REQUEST_BUFFER_LEN
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Maximum length for control transfer receive or send
+
+CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Timeout for control transfer send or receive, default 500 ms
+
+CONFIG_USBHOST_MSC_TIMEOUT
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Timeout for MSC read/write transfers, default 5s \ No newline at end of file
diff --git a/docs/en/api/api_device.rst b/docs/en/api/api_device.rst
new file mode 100755
index 00000000..f44be9dd
--- /dev/null
+++ b/docs/en/api/api_device.rst
@@ -0,0 +1,503 @@
+Device Protocol Stack
+=======================================
+
+The device protocol stack is mainly responsible for enumeration and driver loading. We won't discuss enumeration here, but for driver loading (i.e., interface driver loading), it mainly relies on the `usbd_add_interface` function to record the passed-in interface driver and save it to the interface array table. When the host makes class requests, it can search the interface table for access.
+After calling `usbd_desc_register`, interface registration and endpoint registration need to be performed according to the following rules:
+
+- Call `usbd_add_interface` as many times as there are interfaces, with parameters filling in the relevant `xxx_init_intf`. If not supported, manually create an intf and fill it in
+- Call `usbd_add_endpoint` as many times as there are endpoints. When interrupts complete, the registered endpoint callback will be called.
+
+Refer to the diagram below:
+
+.. figure:: img/api_device1.png
+
+CORE
+-----------------
+
+Endpoint Structure
+""""""""""""""""""""""""""""""""""""
+
+The endpoint structure is mainly used to register interrupt completion callback functions for different endpoint addresses.
+
+.. code-block:: C
+
+ struct usbd_endpoint {
+ uint8_t ep_addr;
+ usbd_endpoint_callback ep_cb;
+ };
+
+- **ep_addr** Endpoint address (with direction)
+- **ep_cb** Endpoint completion interrupt callback function.
+
+.. note:: To summarize in one sentence: in callback function is equivalent to DMA transmission completion interrupt callback function; out callback function is equivalent to DMA reception completion interrupt callback function
+
+Interface Structure
+""""""""""""""""""""""""""""""""""""
+
+The interface structure is mainly used to register requests other than standard device requests for different class devices, including class device requests, vendor device requests, and custom device requests, as well as related notification callback functions in the protocol stack.
+
+.. code-block:: C
+
+ struct usbd_interface {
+ usbd_request_handler class_interface_handler;
+ usbd_request_handler class_endpoint_handler;
+ usbd_request_handler vendor_handler;
+ usbd_notify_handler notify_handler;
+ const uint8_t *hid_report_descriptor;
+ uint32_t hid_report_descriptor_len;
+ uint8_t intf_num;
+ };
+
+- **class_interface_handler** class setup request callback function, recipient is interface
+- **class_endpoint_handler** class setup request callback function, recipient is endpoint
+- **vendor_handler** vendor setup request callback function
+- **notify_handler** interrupt flag, protocol stack related status callback function
+- **hid_report_descriptor** hid report descriptor
+- **hid_report_descriptor_len** hid report descriptor length
+- **intf_num** current interface offset
+
+usbd_desc_register
+""""""""""""""""""""""""""""""""""""
+
+``usbd_desc_register`` is used to register USB descriptors. Descriptor types include: device descriptor, configuration descriptor (including configuration descriptor, interface descriptor, class descriptor, endpoint descriptor), string descriptor, device qualifier descriptor, other speed descriptor, BOS descriptor, WinUSB descriptor.
+
+.. code-block:: C
+
+ // Enable CONFIG_USBDEV_ADVANCE_DESC
+ void usbd_desc_register(uint8_t busid, const struct usb_descriptor *desc);
+
+ // Disable CONFIG_USBDEV_ADVANCE_DESC
+ void usbd_desc_register(uint8_t busid, const uint8_t *desc);
+ void usbd_msosv1_desc_register(uint8_t busid, struct usb_msosv1_descriptor *desc);
+ void usbd_msosv2_desc_register(uint8_t busid, struct usb_msosv2_descriptor *desc);
+ void usbd_bos_desc_register(uint8_t busid, struct usb_bos_descriptor *desc);
+ void usbd_webusb_desc_register(uint8_t busid, struct usb_webusb_descriptor *desc);
+
+- **desc** Descriptor handle
+
+.. note:: Currently CONFIG_USBDEV_ADVANCE_DESC is enabled by default. If you need to use the old version API, please disable this macro. Starting from v1.6.0, only APIs with CONFIG_USBDEV_ADVANCE_DESC enabled are available
+
+usbd_add_interface
+""""""""""""""""""""""""""""""""""""
+
+``usbd_add_interface`` adds an interface driver. **The addition order must follow the interface order in the descriptor**.
+
+.. code-block:: C
+
+ void usbd_add_interface(uint8_t busid, struct usbd_interface *intf);
+
+- **busid** USB bus ID
+- **intf** Interface driver handle, usually obtained from different class `xxx_init_intf` functions
+
+usbd_add_endpoint
+""""""""""""""""""""""""""""""""""""
+
+``usbd_add_endpoint`` adds an endpoint interrupt completion callback function.
+
+.. code-block:: C
+
+ void usbd_add_endpoint(uint8_t busid, struct usbd_endpoint *ep);
+
+- **busid** USB bus ID
+- **ep** Endpoint handle
+
+usbd_initialize
+""""""""""""""""""""""""""""""""""""
+
+``usbd_initialize`` is used to initialize USB device register configuration, USB clock, interrupts, etc. Note that this function must be called last after registering descriptor APIs. **If using an OS, it must be executed within a thread**.
+
+.. code-block:: C
+
+ int usbd_initialize(uint8_t busid, uintptr_t reg_base, usbd_event_handler_t event_handler);
+
+- **busid** USB bus ID
+- **reg_base** USB device register base address
+- **event_handler** Protocol stack interrupt or status callback function, event events
+- **return** Returns 0 for success, other values indicate failure
+
+Event events include:
+
+.. code-block:: C
+
+ USBD_EVENT_ERROR, /** USB error reported by the controller */
+ USBD_EVENT_RESET, /** USB reset */
+ USBD_EVENT_SOF, /** Start of Frame received */
+ USBD_EVENT_CONNECTED, /** USB connected*/
+ USBD_EVENT_DISCONNECTED, /** USB disconnected */
+ USBD_EVENT_SUSPEND, /** USB connection suspended by the HOST */
+ USBD_EVENT_RESUME, /** USB connection resumed by the HOST */
+
+ /* USB DEVICE STATUS */
+ USBD_EVENT_CONFIGURED, /** USB configuration done */
+ USBD_EVENT_SET_INTERFACE, /** USB interface selected */
+ USBD_EVENT_SET_REMOTE_WAKEUP, /** USB set remote wakeup */
+ USBD_EVENT_CLR_REMOTE_WAKEUP, /** USB clear remote wakeup */
+ USBD_EVENT_INIT, /** USB init done when call usbd_initialize */
+ USBD_EVENT_DEINIT, /** USB deinit done when call usbd_deinitialize */
+ USBD_EVENT_UNKNOWN
+
+.. note:: Most IPs do not support USBD_EVENT_CONNECTED and USBD_EVENT_DISCONNECTED events. Currently only HPM chips support them. For other chips, design your own VBUS detection circuit as an alternative
+
+usbd_deinitialize
+""""""""""""""""""""""""""""""""""""
+
+``usbd_deinitialize`` is used to deinitialize USB device, turn off USB device clock, interrupts, etc.
+
+.. code-block:: C
+
+ int usbd_deinitialize(uint8_t busid);
+
+- **busid** USB bus ID
+- **return** Returns 0 for success, other values indicate failure
+
+CDC ACM
+-----------------
+
+usbd_cdc_acm_init_intf
+""""""""""""""""""""""""""""""""""""
+
+``usbd_cdc_acm_init_intf`` is used to initialize USB CDC ACM class interface and implement related functions for this interface.
+
+- ``cdc_acm_class_interface_request_handler`` is used to handle USB CDC ACM class Setup requests.
+- ``cdc_notify_handler`` is used to handle other USB CDC interrupt callback functions.
+
+.. code-block:: C
+
+ struct usbd_interface *usbd_cdc_acm_init_intf(uint8_t busid, struct usbd_interface *intf);
+
+- **busid** USB bus ID
+- **return** Interface handle
+
+usbd_cdc_acm_set_line_coding
+""""""""""""""""""""""""""""""""""""
+
+``usbd_cdc_acm_set_line_coding`` is used to configure the serial port. If only using USB without serial port, this interface does not need to be implemented by the user and can use the default.
+
+.. code-block:: C
+
+ void usbd_cdc_acm_set_line_coding(uint8_t busid, uint8_t intf, struct cdc_line_coding *line_coding);
+
+- **busid** USB bus ID
+- **intf** Control interface number
+- **line_coding** Serial port configuration
+
+usbd_cdc_acm_get_line_coding
+""""""""""""""""""""""""""""""""""""
+
+``usbd_cdc_acm_get_line_coding`` is used to get serial port configuration. If only using USB without serial port, this interface does not need to be implemented by the user and can use the default.
+
+.. code-block:: C
+
+ void usbd_cdc_acm_get_line_coding(uint8_t busid, uint8_t intf, struct cdc_line_coding *line_coding);
+
+- **busid** USB bus ID
+- **intf** Control interface number
+- **line_coding** Serial port configuration
+
+usbd_cdc_acm_set_dtr
+""""""""""""""""""""""""""""""""""""
+
+``usbd_cdc_acm_set_dtr`` is used to control serial port DTR. If only using USB without serial port, this interface does not need to be implemented by the user and can use the default.
+
+.. code-block:: C
+
+ void usbd_cdc_acm_set_dtr(uint8_t busid, uint8_t intf, bool dtr);
+
+- **busid** USB bus ID
+- **intf** Control interface number
+- **dtr** dtr = 1 means pull low level, 0 means pull high level
+
+usbd_cdc_acm_set_rts
+""""""""""""""""""""""""""""""""""""
+
+``usbd_cdc_acm_set_rts`` is used to control serial port RTS. If only using USB without serial port, this interface does not need to be implemented by the user and can use the default.
+
+.. code-block:: C
+
+ void usbd_cdc_acm_set_rts(uint8_t busid, uint8_t intf, bool rts);
+
+- **busid** USB bus ID
+- **intf** Control interface number
+- **rts** rts = 1 means pull low level, 0 means pull high level
+
+CDC_ACM_DESCRIPTOR_INIT
+""""""""""""""""""""""""""""""""""""
+
+``CDC_ACM_DESCRIPTOR_INIT`` configures the default CDC ACM required descriptors and parameters for user convenience. Total length is `CDC_ACM_DESCRIPTOR_LEN`.
+
+.. code-block:: C
+
+ CDC_ACM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx);
+
+- **bFirstInterface** Indicates the offset of the first interface of this CDC ACM in all interfaces
+- **int_ep** Indicates interrupt endpoint address (with direction)
+- **out_ep** Indicates bulk out endpoint address (with direction)
+- **in_ep** Indicates bulk in endpoint address (with direction)
+- **str_idx** String ID corresponding to control interface
+
+HID
+-----------------
+
+usbd_hid_init_intf
+""""""""""""""""""""""""""""""""""""
+
+``usbd_hid_init_intf`` is used to initialize USB HID class interface and implement related functions for this interface:
+
+- ``hid_class_interface_request_handler`` is used to handle USB HID class Setup requests.
+- ``hid_notify_handler`` is used to handle other USB HID interrupt callback functions.
+
+.. code-block:: C
+
+ struct usbd_interface *usbd_hid_init_intf(uint8_t busid, struct usbd_interface *intf, const uint8_t *desc, uint32_t desc_len);
+
+- **busid** USB bus ID
+- **desc** Report descriptor
+- **desc_len** Report descriptor length
+
+MSC
+-----------------
+
+usbd_msc_init_intf
+""""""""""""""""""""""""""""""""""""
+``usbd_msc_init_intf`` is used to initialize MSC class interface, implement related functions for this interface, and register endpoint callback functions. (Since MSC BOT protocol is fixed, user implementation is not needed, so endpoint callback functions naturally don't need user implementation).
+
+- ``msc_storage_class_interface_request_handler`` is used to handle USB MSC Setup interrupt requests.
+- ``msc_storage_notify_handler`` is used to implement other USB MSC interrupt callback functions.
+
+- ``mass_storage_bulk_out`` is used to handle USB MSC endpoint out interrupts.
+- ``mass_storage_bulk_in`` is used to handle USB MSC endpoint in interrupts.
+
+.. code-block:: C
+
+ struct usbd_interface *usbd_msc_init_intf(uint8_t busid, struct usbd_interface *intf, const uint8_t out_ep, const uint8_t in_ep);
+
+- **busid** USB bus ID
+- **out_ep** out endpoint address
+- **in_ep** in endpoint address
+
+usbd_msc_get_cap
+""""""""""""""""""""""""""""""""""""
+
+``usbd_msc_get_cap`` is used to get the LUN, number of sectors, and sector size of the storage device. Users must implement this function.
+
+.. code-block:: C
+
+ void usbd_msc_get_cap(uint8_t busid, uint8_t lun, uint32_t *block_num, uint16_t *block_size);
+
+- **busid** USB bus ID
+- **lun** Storage logical unit, currently unused, defaults to supporting one
+- **block_num** Number of storage sectors
+- **block_size** Storage sector size
+
+usbd_msc_sector_read
+""""""""""""""""""""""""""""""""""""
+
+``usbd_msc_sector_read`` is used to read data from a storage device starting at a specific sector address. Users must implement this function.
+
+.. code-block:: C
+
+ int usbd_msc_sector_read(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length);
+
+- **busid** USB bus ID
+- **lun** Storage logical unit, currently unused, defaults to supporting one
+- **sector** Sector offset
+- **buffer** Pointer to store read data
+- **length** Read length
+
+
+usbd_msc_sector_write
+""""""""""""""""""""""""""""""""""""
+
+``usbd_msc_sector_write`` is used to write data to a storage device starting at a specific sector. Users must implement this function.
+
+.. code-block:: C
+
+ int usbd_msc_sector_write(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length);
+
+- **busid** USB bus ID
+- **lun** Storage logical unit, currently unused, defaults to supporting one
+- **sector** Sector offset
+- **buffer** Write data pointer
+- **length** Write length
+
+UAC
+-----------------
+
+usbd_audio_init_intf
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_init_intf`` is used to initialize USB Audio class interface and implement related functions for this interface:
+
+- ``audio_class_interface_request_handler`` is used to handle USB Audio Setup interface recipient interrupt requests.
+- ``audio_class_endpoint_request_handler`` is used to handle USB Audio Setup endpoint recipient interrupt requests.
+- ``audio_notify_handler`` is used to implement other USB Audio interrupt callback functions.
+
+.. code-block:: C
+
+ struct usbd_interface *usbd_audio_init_intf(uint8_t busid, struct usbd_interface *intf,
+ uint16_t uac_version,
+ struct audio_entity_info *table,
+ uint8_t num);
+
+- **busid** USB bus ID
+- **intf** Interface handle
+- **uac_version** Audio class version, UAC1.0 or UAC2.0
+- **table** Audio entity information table
+- **num** Audio entity information table length
+
+usbd_audio_open
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_open`` is used to start audio data transmission. Host sends start command callback function.
+
+.. code-block:: C
+
+ void usbd_audio_open(uint8_t intf);
+
+- **intf** Interface number to open
+
+usbd_audio_close
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_close`` is used to stop audio data transmission. Host sends stop command callback function.
+
+.. code-block:: C
+
+ void usbd_audio_close(uint8_t intf);
+
+- **intf** Interface number to close
+
+usbd_audio_set_mute
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_set_mute`` is used to set mute.
+
+.. code-block:: C
+
+ void usbd_audio_set_mute(uint8_t busid, uint8_t ep, uint8_t ch, bool mute);
+
+- **busid** USB bus ID
+- **ep** Endpoint to set mute
+- **ch** Channel to set mute
+- **mute** 1 means mute, 0 means opposite
+
+usbd_audio_set_volume
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_set_volume`` is used to set volume.
+
+.. code-block:: C
+
+ void usbd_audio_set_volume(uint8_t busid, uint8_t ep, uint8_t ch, int volume_db);
+
+- **busid** USB bus ID
+- **ep** Endpoint to set volume
+- **ch** Channel to set volume
+- **volume_db** Volume to set in decibels, range -100dB ~ 0dB
+
+usbd_audio_set_sampling_freq
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_set_sampling_freq`` is used to set the sampling rate of the audio module on the device
+
+.. code-block:: C
+
+ void usbd_audio_set_sampling_freq(uint8_t busid, uint8_t ep, uint32_t sampling_freq);
+
+- **ep** Endpoint to set sampling rate
+- **sampling_freq** Sampling rate to set
+
+usbd_audio_get_sampling_freq_table
+""""""""""""""""""""""""""""""""""""
+
+``usbd_audio_get_sampling_freq_table`` is used to get the list of supported sampling rates. If the function is not implemented, the default sampling rate list is used. UAC2 only.
+
+.. code-block:: C
+
+ void usbd_audio_get_sampling_freq_table(uint8_t busid, uint8_t ep, uint8_t **sampling_freq_table);
+
+- **ep** Endpoint to get sampling rate
+- **sampling_freq_table** Sampling rate list address, format refers to default sampling rate list
+
+UVC
+-----------------
+
+usbd_video_init_intf
+""""""""""""""""""""""""""""""""""""
+
+``usbd_video_init_intf`` is used to initialize USB Video class interface and implement related functions for this interface:
+
+- ``video_class_interface_request_handler`` is used to handle USB Video Setup interrupt requests.
+- ``video_notify_handler`` is used to implement other USB Video interrupt callback functions.
+
+.. code-block:: C
+
+ struct usbd_interface *usbd_video_init_intf(uint8_t busid, struct usbd_interface *intf,
+ uint32_t dwFrameInterval,
+ uint32_t dwMaxVideoFrameSize,
+ uint32_t dwMaxPayloadTransferSize);
+- **busid** USB bus ID
+- **intf** Interface handle
+- **dwFrameInterval** Video frame interval, unit 100ns
+- **dwMaxVideoFrameSize** Maximum video frame size
+- **dwMaxPayloadTransferSize** Maximum payload transfer size
+
+usbd_video_open
+""""""""""""""""""""""""""""""""""""
+
+``usbd_video_open`` is used to start video data transmission.
+
+.. code-block:: C
+
+ void usbd_video_open(uint8_t intf);
+
+- **intf** Interface number to open
+
+usbd_video_close
+""""""""""""""""""""""""""""""""""""
+
+``usbd_video_close`` is used to stop video data transmission.
+
+.. code-block:: C
+
+ void usbd_video_open(uint8_t intf);
+
+- **intf** Interface number to close
+
+usbd_video_stream_start_write
+""""""""""""""""""""""""""""""""""""
+
+``usbd_video_stream_start_write`` is used to start sending one frame of video data stream. Must be used together with `usbd_video_stream_split_transfer`.
+
+.. code-block:: C
+
+ int usbd_video_stream_start_write(uint8_t busid, uint8_t ep, uint8_t *ep_buf, uint8_t *stream_buf, uint32_t stream_len, bool do_copy);
+
+- **busid** USB bus ID
+- **ep** Video data endpoint address
+- **ep_buf** Video data endpoint transfer buffer
+- **stream_buf** One frame video data source buffer
+- **stream_len** One frame video data source buffer size
+- **do_copy** Whether to copy stream_buf data to ep_buf. This parameter is false only when stream_buf is in nocache area and DCACHE_ENABLE is not enabled
+
+usbd_video_stream_split_transfer
+""""""""""""""""""""""""""""""""""""
+
+``usbd_video_stream_split_transfer`` is used to split video data stream transmission. Must be used together with `usbd_video_stream_start_write`.
+
+.. code-block:: C
+
+ int usbd_video_stream_split_transfer(uint8_t busid, uint8_t ep);
+
+- **busid** USB bus ID
+- **ep** Video data endpoint address
+- **return** Returns true when one frame data transmission is complete, false when data transmission is not complete
+
+RNDIS
+-----------------
+
+CDC ECM
+-----------------
+
+MTP
+-----------------
diff --git a/docs/en/api/api_host.rst b/docs/en/api/api_host.rst
new file mode 100755
index 00000000..7499d188
--- /dev/null
+++ b/docs/en/api/api_host.rst
@@ -0,0 +1,317 @@
+Host Protocol Stack
+=======================================
+
+For the naming, classification, and member composition of structures in the host protocol stack, refer to the following two diagrams:
+
+.. figure:: img/api_host1.png
+.. figure:: img/api_host2.png
+
+CORE
+-----------------
+
+CLASS Driver Information Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_class_info {
+ uint8_t match_flags; /* Used for product specific matches; range is inclusive */
+ uint8_t bInterfaceClass; /* Base device class code */
+ uint8_t bInterfaceSubClass; /* Sub-class, depends on base class. Eg. */
+ uint8_t bInterfaceProtocol; /* Protocol, depends on base class. Eg. */
+ const uint16_t (*id_table)[2]; /* List of Vendor/Product ID pairs */
+ const struct usbh_class_driver *class_driver;
+ };
+
+Endpoint Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_endpoint {
+ struct usb_endpoint_descriptor ep_desc;
+ };
+
+Interface Altsetting Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_interface_altsetting {
+ struct usb_interface_descriptor intf_desc;
+ struct usbh_endpoint ep[CONFIG_USBHOST_MAX_ENDPOINTS];
+ };
+
+Interface Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_interface {
+ char devname[CONFIG_USBHOST_DEV_NAMELEN];
+ struct usbh_class_driver *class_driver;
+ void *priv;
+ struct usbh_interface_altsetting altsetting[CONFIG_USBHOST_MAX_INTF_ALTSETTINGS];
+ uint8_t altsetting_num;
+ };
+
+Configuration Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_configuration {
+ struct usb_configuration_descriptor config_desc;
+ struct usbh_interface intf[CONFIG_USBHOST_MAX_INTERFACES];
+ };
+
+hubport Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_hubport {
+ bool connected; /* True: device connected; false: disconnected */
+ uint8_t port; /* Hub port index */
+ uint8_t dev_addr; /* device address */
+ uint8_t speed; /* device speed */
+ uint8_t depth; /* distance from root hub */
+ uint8_t route; /* route string */
+ uint8_t slot_id; /* slot id */
+ struct usb_device_descriptor device_desc;
+ struct usbh_configuration config;
+ const char *iManufacturer;
+ const char *iProduct;
+ const char *iSerialNumber;
+ uint8_t *raw_config_desc;
+ struct usb_setup_packet *setup;
+ 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_urb ep0_urb;
+ usb_osal_mutex_t mutex;
+ };
+
+hub Structure
+""""""""""""""""""""""""""""""""""""
+
+.. code-block:: C
+
+ struct usbh_hub {
+ bool connected;
+ bool is_roothub;
+ uint8_t index;
+ uint8_t hub_addr;
+ uint8_t speed;
+ uint8_t nports;
+ uint8_t powerdelay;
+ uint8_t tt_think;
+ bool ismtt;
+ struct usb_hub_descriptor hub_desc; /* USB 2.0 only */
+ struct usb_hub_ss_descriptor hub_ss_desc; /* USB 3.0 only */
+ struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS];
+ struct usbh_hubport *parent;
+ struct usbh_bus *bus;
+ struct usb_endpoint_descriptor *intin;
+ struct usbh_urb intin_urb;
+ uint8_t *int_buffer;
+ struct usb_osal_timer *int_timer;
+ };
+
+usbh_initialize
+""""""""""""""""""""""""""""""""""""
+
+``usbh_initialize`` is used to initialize the USB host protocol stack, including: initializing the USB host controller, creating roothub device, creating hub detection thread.
+
+.. code-block:: C
+
+ int usbh_initialize(uint8_t busid, uint32_t reg_base, usbh_event_handler_t event_handler);
+
+- **busid** bus id, starting from 0, cannot exceed `CONFIG_USBHOST_MAX_BUS`
+- **reg_base** hcd register base address
+- **event_handler** host event callback function, can be NULL
+- **return** 0 indicates normal, other values indicate error
+
+usbh_find_class_instance
+""""""""""""""""""""""""""""""""""""
+
+``usbh_find_class_instance`` finds the corresponding class structure handle based on the registered class name.
+
+.. code-block:: C
+
+ void *usbh_find_class_instance(const char *devname);
+
+- **devname** class name
+- **return** class structure handle
+
+lsusb
+""""""""""""""""""""""""""""""""""""
+
+``lsusb`` is used to view and operate device information on the hub. Requires shell plugin to use.
+
+.. code-block:: C
+
+ int lsusb(int argc, char **argv);
+
+SERIAL
+-----------------
+
+usbh_serial_open
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_open`` opens a serial device according to the path.
+
+.. code-block:: C
+
+ struct usbh_serial *usbh_serial_open(const char *devname, uint32_t open_flags);
+
+- **devname** serial path
+- **open_flags** open flags, refer to `USBH_SERIAL_OFLAG_*` definitions
+- **return** serial structure handle
+
+usbh_serial_close
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_close`` closes the serial device.
+
+.. code-block:: C
+
+ void usbh_serial_close(struct usbh_serial *serial);
+
+- **serial** serial structure handle
+
+usbh_serial_control
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_control`` configures the serial port.
+
+.. code-block:: C
+
+ int usbh_serial_control(struct usbh_serial *serial, int cmd, void *arg);
+
+- **serial** serial structure handle
+- **cmd** control command, refer to `USBH_SERIAL_CMD_*` definitions
+- **arg** control parameter pointer
+- **return** 0 indicates normal, other values indicate error
+
+usbh_serial_write
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_write`` writes data to the serial port.
+
+.. code-block:: C
+
+ int usbh_serial_write(struct usbh_serial *serial, const void *buffer, uint32_t buflen);
+
+- **serial** serial structure handle
+- **buffer** data buffer pointer
+- **buflen** length of data to write
+- **return** actual length of data written or error code
+
+.. note:: If CONFIG_USB_DCACHE_ENABLE is not enabled, buffer needs to be in nocache area, otherwise it needs to be aligned to CONFIG_USB_ALIGN_SIZE area.
+
+usbh_serial_read
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_read`` reads data from the serial port. **If baud rate is not set, this API is not allowed to be used. After setting baud rate, rx reception will be enabled internally and data will be written to ringbuf**.
+
+.. code-block:: C
+
+ int usbh_serial_read(struct usbh_serial *serial, void *buffer, uint32_t buflen);
+
+- **serial** serial structure handle
+- **buffer** data buffer pointer
+- **buflen** maximum length of data to read
+- **return** actual length of data read or error code
+
+.. note:: Since ringbuffer is used internally, there are no restrictions on user buffer attributes.
+
+usbh_serial_cdc_write_async
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_cdc_write_async`` asynchronously writes data to the serial port. **If baud rate is set, this API is not allowed to be used**.
+
+.. code-block:: C
+
+ int usbh_serial_cdc_write_async(struct usbh_serial *serial, uint8_t *buffer, uint32_t buflen, usbh_complete_callback_t complete, void *arg);
+
+- **serial** serial structure handle
+- **buffer** data buffer pointer
+- **buflen** length of data to send
+- **complete** data write completion callback function
+- **arg** callback function parameter
+- **return** 0 indicates normal, other values indicate error
+
+.. note:: If CONFIG_USB_DCACHE_ENABLE is not enabled, buffer needs to be in nocache area, otherwise it needs to be aligned to CONFIG_USB_ALIGN_SIZE area.
+
+usbh_serial_cdc_read_async
+""""""""""""""""""""""""""""""""""""
+
+``usbh_serial_cdc_read_async`` asynchronously reads data from the serial port. **If baud rate is set, this API is not allowed to be used. After setting baud rate, rx reception will be enabled internally and data will be written to ringbuf**.
+
+.. code-block:: C
+
+ int usbh_serial_cdc_read_async(struct usbh_serial *serial, uint8_t *buffer, uint32_t buflen, usbh_complete_callback_t complete, void *arg);
+
+- **serial** serial structure handle
+- **buffer** data buffer pointer
+- **buflen** maximum length of data to read, up to 16K at a time. Must be a multiple of wMaxPacketSize
+- **complete** data read completion callback function
+- **arg** callback function parameter
+- **return** 0 indicates normal, other values indicate error
+
+.. note:: If CONFIG_USB_DCACHE_ENABLE is not enabled, buffer needs to be in nocache area, otherwise it needs to be aligned to CONFIG_USB_ALIGN_SIZE area.
+
+HID
+-----------------
+
+MSC
+-----------------
+
+usbh_msc_scsi_init
+""""""""""""""""""""""""""""""""""""
+
+``usbh_msc_scsi_init`` initializes msc scsi device. Gets MSC status and capacity information.
+
+.. code-block:: C
+
+ int usbh_msc_scsi_init(struct usbh_msc *msc_class);
+
+- **msc_class** msc structure handle
+- **return** 0 indicates normal, other values indicate error
+
+usbh_msc_scsi_write10
+""""""""""""""""""""""""""""""""""""
+
+``usbh_msc_scsi_write10`` writes data to msc device.
+
+.. code-block:: C
+
+ int usbh_msc_scsi_write10(struct usbh_msc *msc_class, uint32_t start_sector, const uint8_t *buffer, uint32_t nsectors);
+
+- **msc_class** msc structure handle
+- **start_sector** starting sector
+- **buffer** data buffer pointer
+- **nsectors** number of sectors to write
+- **return** returns 0 for normal, other values indicate error
+
+usbh_msc_scsi_read10
+""""""""""""""""""""""""""""""""""""
+
+``usbh_msc_scsi_read10`` reads data from msc device.
+
+.. code-block:: C
+
+ int usbh_msc_scsi_read10(struct usbh_msc *msc_class, uint32_t start_sector, uint8_t *buffer, uint32_t nsectors);
+
+- **msc_class** msc structure handle
+- **start_sector** starting sector
+- **buffer** data buffer pointer
+- **nsectors** number of sectors to read
+- **return** returns 0 for normal, other values indicate error
+
+NETWORK
+-----------------
+
+Already integrated with lwIP protocol stack or other network protocol stacks, use socket API. \ No newline at end of file
diff --git a/docs/en/api/api_port.rst b/docs/en/api/api_port.rst
new file mode 100755
index 00000000..9f5fe5c1
--- /dev/null
+++ b/docs/en/api/api_port.rst
@@ -0,0 +1,266 @@
+Host and Device Drivers
+=======================================
+
+.. note:: Please note that starting from version v1.1, the busid parameter has been added, while everything else remains unchanged, so API documentation is not updated
+
+device controller(dcd)
+-------------------------
+
+usb_dc_init
+""""""""""""""""""""""""""""""""""""
+
+``usb_dc_init`` is used to initialize USB device controller registers, set USB pins, clock, interrupts, etc. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usb_dc_init(void);
+
+- **return** Returns 0 for success, other values indicate error
+
+usb_dc_deinit
+""""""""""""""""""""""""""""""""""""
+
+``usb_dc_deinit`` is used to de-initialize USB device controller registers. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usb_dc_deinit(void);
+
+- **return** Returns 0 for success, other values indicate error
+
+usbd_set_address
+""""""""""""""""""""""""""""""""""""
+
+``usbd_set_address`` sets the device address. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usbd_set_address(const uint8_t addr);
+
+- **addr** Device address
+- **return** Returns 0 for success, other values indicate error
+
+usbd_ep_open
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_open`` sets endpoint properties and enables corresponding endpoint interrupts. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_open(const struct usb_endpoint_descriptor *ep);
+
+- **ep** Endpoint descriptor
+- **return** Returns 0 for success, other values indicate error
+
+usbd_ep_close
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_close`` closes an endpoint. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_close(const uint8_t ep);
+
+- **ep** Endpoint address
+- **return** Returns 0 for success, other values indicate error
+
+usbd_ep_set_stall
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_set_stall`` sets an endpoint to stall state and sends a stall handshake packet. **This function is open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_set_stall(const uint8_t ep);
+
+- **ep** Endpoint address
+- **return** Returns 0 for success, other values indicate error
+
+usbd_ep_clear_stall
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_clear_stall`` clears the stall state of an endpoint. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_clear_stall(const uint8_t ep);
+
+- **ep** Endpoint address
+- **return** Returns 0 for success, other values indicate error
+
+usbd_ep_is_stalled
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_is_stalled`` reads the current stall state of an endpoint. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_is_stalled(const uint8_t ep, uint8_t *stalled);
+
+- **ep** Endpoint address
+- **return** Returns 1 for stalled, 0 for not stalled
+
+usbd_ep_start_write
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_start_write`` starts endpoint transmission. After transmission completion, it will call the registered IN endpoint transfer completion interrupt callback function. This function performs asynchronous transmission. **This function is open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_start_write(const uint8_t ep, const uint8_t *data, uint32_t data_len);
+
+- **ep** IN endpoint address
+- **data** Transmission data buffer
+- **data_len** Transmission length, theoretically unlimited, recommended within 16K bytes
+- **return** Returns 0 for success, other values indicate error
+
+usbd_ep_start_read
+""""""""""""""""""""""""""""""""""""
+
+``usbd_ep_start_read`` starts endpoint reception. After reception completion, it will call the registered OUT endpoint transfer completion interrupt callback function. This function performs asynchronous reception. **This function is open to users**.
+
+.. code-block:: C
+
+ int usbd_ep_start_read(const uint8_t ep, uint8_t *data, uint32_t data_len);
+
+- **ep** OUT endpoint address
+- **data** Reception data buffer
+- **data_len** Reception length, theoretically unlimited, recommended within 16K bytes, and preferably a multiple of maximum packet size
+- **return** Returns 0 for success, other values indicate error
+
+.. note:: After starting reception, transfer completion interrupt will be triggered under two conditions: 1. Last packet is a short packet (less than EP MPS); 2. Total received length equals data_len
+
+.. note:: For bulk transfers, data_len is usually designed as EP MPS. The following three cases can be modified to multiple EP MPS: fixed length; custom protocol with length information (MSC); host manually sends ZLP or short packet (RNDIS)
+
+host controller(hcd)
+------------------------
+
+usb_hc_init
+""""""""""""""""""""""""""""""""""""
+
+``usb_hc_init`` is used to initialize USB host controller registers, set USB pins, clock, interrupts, etc. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usb_hc_init(void);
+
+- **return** Returns 0 for success, other values indicate error
+
+usb_hc_deinit
+""""""""""""""""""""""""""""""""""""
+
+``usb_hc_deinit`` is used to de-initialize USB host controller registers. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usb_hc_deinit(void);
+
+- **return** Returns 0 for success, other values indicate error
+
+usbh_roothub_control
+""""""""""""""""""""""""""""""""""""
+
+``usbh_roothub_control`` is used to send requests to the root hub. **This function is not open to users**.
+
+.. code-block:: C
+
+ int usbh_roothub_control(struct usb_setup_packet *setup, uint8_t *buf);
+
+- **setup** Request
+- **buf** Reception buffer
+- **return** Returns 0 for success, other values indicate error
+
+usbh_submit_urb
+""""""""""""""""""""""""""""""""""""
+
+``usbh_submit_urb`` performs data requests to endpoints at a specific address. **This function is open to users**.
+
+.. code-block:: C
+
+ int usbh_submit_urb(struct usbh_urb *urb);
+
+- **urb** USB request block
+- **return** Returns 0 for success, other values indicate error
+
+Among them, the `urb` structure information is as follows:
+
+.. code-block:: C
+
+ struct usbh_urb {
+ usb_slist_t list;
+ void *hcpriv;
+ struct usbh_hubport *hport;
+ struct usb_endpoint_descriptor *ep;
+ uint8_t data_toggle;
+ uint8_t interval;
+ struct usb_setup_packet *setup;
+ uint8_t *transfer_buffer;
+ uint32_t transfer_buffer_length;
+ int transfer_flags;
+ uint32_t actual_length;
+ uint32_t timeout;
+ int errorcode;
+ uint32_t num_of_iso_packets;
+ uint32_t start_frame;
+ usbh_complete_callback_t complete;
+ void *arg;
+ #if defined(__ICCARM__) || defined(__ICCRISCV__) || defined(__ICCRX__)
+ struct usbh_iso_frame_packet *iso_packet;
+ #else
+ struct usbh_iso_frame_packet iso_packet[0];
+ #endif
+ };
+
+- **hcpriv** Host controller driver private member
+- **hport** The hport used by current URB
+- **ep** The endpoint used by current URB
+- **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
+- **transfer_buffer** Transfer data buffer
+- **transfer_buffer_length** Transfer length
+- **transfer_flags** Flags carried during transfer
+- **actual_length** Actual transfer length
+- **timeout** Transfer timeout. If 0, the function is non-blocking and can be used in interrupts
+- **errorcode** Error code
+- **num_of_iso_packets** Number of ISO frames or microframes
+- **complete** Transfer completion callback function
+- **arg** Parameters carried when transfer completes
+- **iso_packet** ISO data packet
+
+.. note:: If there are no special time requirements for timeout, it must be set to 0xffffffff. In principle, timeout is not allowed. If timeout occurs, generally cannot continue working
+
+`errorcode` can return the following values:
+
+.. code-block:: C
+
+ #define USB_ERR_NOMEM 1
+ #define USB_ERR_INVAL 2
+ #define USB_ERR_NODEV 3
+ #define USB_ERR_NOTCONN 4
+ #define USB_ERR_NOTSUPP 5
+ #define USB_ERR_BUSY 6
+ #define USB_ERR_RANGE 7
+ #define USB_ERR_STALL 8
+ #define USB_ERR_BABBLE 9
+ #define USB_ERR_NAK 10
+ #define USB_ERR_DT 11
+ #define USB_ERR_IO 12
+ #define USB_ERR_SHUTDOWN 13
+ #define USB_ERR_TIMEOUT 14
+
+Among them, the `iso_packet` structure information is as follows:
+
+.. code-block:: C
+
+ struct usbh_iso_frame_packet {
+ uint8_t *transfer_buffer;
+ uint32_t transfer_buffer_length;
+ uint32_t actual_length;
+ int errorcode;
+ };
+
+- **transfer_buffer** Transfer data buffer
+- **transfer_buffer_length** Transfer length
+- **actual_length** Actual transfer length
+- **errorcode** Error code \ No newline at end of file
diff --git a/docs/en/api/img/api_device1.png b/docs/en/api/img/api_device1.png
new file mode 100755
index 00000000..ba218b65
--- /dev/null
+++ b/docs/en/api/img/api_device1.png
Binary files differ
diff --git a/docs/en/api/img/api_host1.png b/docs/en/api/img/api_host1.png
new file mode 100755
index 00000000..82932f50
--- /dev/null
+++ b/docs/en/api/img/api_host1.png
Binary files differ
diff --git a/docs/en/api/img/api_host2.png b/docs/en/api/img/api_host2.png
new file mode 100755
index 00000000..7f6d60b8
--- /dev/null
+++ b/docs/en/api/img/api_host2.png
Binary files differ