41 lines
1.3 KiB
ReStructuredText
41 lines
1.3 KiB
ReStructuredText
.. _usb_api:
|
|
|
|
USB subsystem API
|
|
#################
|
|
|
|
.. contents::
|
|
:depth: 2
|
|
:local:
|
|
:backlinks: top
|
|
|
|
There are two ways to transmit data, using the 'low' level read/write API or
|
|
the 'high' level transfer API.
|
|
|
|
Low level API
|
|
To transmit data to the host, the class driver should call usb_write().
|
|
Upon completion the registered endpoint callback will be called. Before
|
|
sending another packet the class driver should wait for the completion of
|
|
the previous write. When data is received, the registered endpoint callback
|
|
is called. usb_read() should be used for retrieving the received data.
|
|
For CDC ACM sample driver this happens via the OUT bulk endpoint handler
|
|
(cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data).
|
|
|
|
High level API
|
|
The usb_transfer method can be used to transfer data to/from the host. The
|
|
transfer API will automatically split the data transmission into one or more
|
|
USB transaction(s), depending endpoint max packet size. The class driver does
|
|
not have to implement endpoint callback and should set this callback to the
|
|
generic usb_transfer_ep_callback.
|
|
|
|
USB Device Controller API
|
|
*************************
|
|
|
|
.. doxygengroup:: _usb_device_controller_api
|
|
:project: Zephyr
|
|
|
|
USB Device Core Layer API
|
|
*************************
|
|
|
|
.. doxygengroup:: _usb_device_core_api
|
|
:project: Zephyr
|