Skip to content

Commit b335c19

Browse files
jfischer-nonashif
authored andcommitted
doc: move USB documentation to connectivity
Mostly moved and reorganised content to the Connectivity chapter, separated API references. Fill in some gaps in the USB device documentation. Signed-off-by: Johann Fischer <[email protected]>
1 parent 09a9a7e commit b335c19

24 files changed

+748
-473
lines changed

MAINTAINERS.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2619,7 +2619,7 @@ USB:
26192619
- subsys/usb/
26202620
- tests/subsys/usb/
26212621
- tests/drivers/udc/
2622-
- doc/services/usb/
2622+
- doc/connectivity/usb/
26232623
labels:
26242624
- "area: USB"
26252625

doc/connectivity/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ Connectivity
99
bluetooth/index.rst
1010
networking/index.rst
1111
lora_lorawan/index.rst
12+
usb/index.rst
1213
usb_c/index.rst

doc/connectivity/usb/api/hid.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _usb_hid_common:
2+
3+
Human Interface Devices (HID)
4+
#############################
5+
6+
Common USB HID part that can be used outside of USB support, defined in
7+
header file :zephyr_file:`include/zephyr/usb/class/hid.h`.
8+
9+
HID types reference
10+
*******************
11+
12+
.. doxygengroup:: usb_hid_definitions
13+
14+
HID items reference
15+
*******************
16+
17+
.. doxygengroup:: usb_hid_items
18+
19+
HID Mouse and Keyboard report descriptors
20+
*****************************************
21+
22+
The pre-defined Mouse and Keyboard report descriptors can be used by
23+
a HID device implementation or simply as examples.
24+
25+
.. doxygengroup:: usb_hid_mk_report_desc
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. _usb_api:
2+
3+
USB device support APIs
4+
#######################
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
9+
usb_dc.rst
10+
usb_device.rst
11+
usb_device_hid.rst
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. _usb_dc_api:
2+
3+
USB device controller driver API
4+
################################
5+
6+
The USB device controller driver API is described in
7+
:zephyr_file:`include/zephyr/drivers/usb/usb_dc.h` and sometimes referred to
8+
as the ``usb_dc`` API.
9+
10+
This API has some limitations by design, it does not follow :ref:`device_model_api`
11+
and is being replaced by a new UDC driver API.
12+
13+
API reference
14+
*************
15+
16+
.. doxygengroup:: _usb_device_controller_api
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _usb_device_stack_api:
2+
3+
USB device stack API
4+
####################
5+
6+
API reference
7+
*************
8+
9+
There are two ways to transmit data, using the 'low' level read/write API or
10+
the 'high' level transfer API.
11+
12+
Low level API
13+
To transmit data to the host, the class driver should call usb_write().
14+
Upon completion the registered endpoint callback will be called. Before
15+
sending another packet the class driver should wait for the completion of
16+
the previous write. When data is received, the registered endpoint callback
17+
is called. usb_read() should be used for retrieving the received data.
18+
For CDC ACM sample driver this happens via the OUT bulk endpoint handler
19+
(cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data).
20+
21+
High level API
22+
The usb_transfer method can be used to transfer data to/from the host. The
23+
transfer API will automatically split the data transmission into one or more
24+
USB transaction(s), depending endpoint max packet size. The class driver does
25+
not have to implement endpoint callback and should set this callback to the
26+
generic usb_transfer_ep_callback.
27+
28+
.. doxygengroup:: _usb_device_core_api
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. _usb_hid_device:
2+
3+
USB HID Class API
4+
#################
5+
6+
USB device specific part for HID support defined in
7+
:zephyr_file:`include/zephyr/usb/class/usb_hid.h`.
8+
9+
API Reference
10+
*************
11+
12+
.. doxygengroup:: usb_hid_device_api

0 commit comments

Comments
 (0)