Skip to content

Commit

Permalink
doc: move USB documentation to connectivity
Browse files Browse the repository at this point in the history
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 <johann.fischer@nordicsemi.no>
  • Loading branch information
jfischer-no authored and nashif committed Jun 15, 2023
1 parent 09a9a7e commit b335c19
Show file tree
Hide file tree
Showing 24 changed files with 748 additions and 473 deletions.
2 changes: 1 addition & 1 deletion MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ USB:
- subsys/usb/
- tests/subsys/usb/
- tests/drivers/udc/
- doc/services/usb/
- doc/connectivity/usb/
labels:
- "area: USB"

Expand Down
1 change: 1 addition & 0 deletions doc/connectivity/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Connectivity
bluetooth/index.rst
networking/index.rst
lora_lorawan/index.rst
usb/index.rst
usb_c/index.rst
25 changes: 25 additions & 0 deletions doc/connectivity/usb/api/hid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _usb_hid_common:

Human Interface Devices (HID)
#############################

Common USB HID part that can be used outside of USB support, defined in
header file :zephyr_file:`include/zephyr/usb/class/hid.h`.

HID types reference
*******************

.. doxygengroup:: usb_hid_definitions

HID items reference
*******************

.. doxygengroup:: usb_hid_items

HID Mouse and Keyboard report descriptors
*****************************************

The pre-defined Mouse and Keyboard report descriptors can be used by
a HID device implementation or simply as examples.

.. doxygengroup:: usb_hid_mk_report_desc
11 changes: 11 additions & 0 deletions doc/connectivity/usb/device/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _usb_api:

USB device support APIs
#######################

.. toctree::
:maxdepth: 1

usb_dc.rst
usb_device.rst
usb_device_hid.rst
16 changes: 16 additions & 0 deletions doc/connectivity/usb/device/api/usb_dc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _usb_dc_api:

USB device controller driver API
################################

The USB device controller driver API is described in
:zephyr_file:`include/zephyr/drivers/usb/usb_dc.h` and sometimes referred to
as the ``usb_dc`` API.

This API has some limitations by design, it does not follow :ref:`device_model_api`
and is being replaced by a new UDC driver API.

API reference
*************

.. doxygengroup:: _usb_device_controller_api
28 changes: 28 additions & 0 deletions doc/connectivity/usb/device/api/usb_device.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _usb_device_stack_api:

USB device stack API
####################

API reference
*************

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.

.. doxygengroup:: _usb_device_core_api
12 changes: 12 additions & 0 deletions doc/connectivity/usb/device/api/usb_device_hid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _usb_hid_device:

USB HID Class API
#################

USB device specific part for HID support defined in
:zephyr_file:`include/zephyr/usb/class/usb_hid.h`.

API Reference
*************

.. doxygengroup:: usb_hid_device_api
Loading

0 comments on commit b335c19

Please sign in to comment.