Skip to content

Commit 798cdae

Browse files
finikorgnashif
authored andcommitted
doc: Using doxygen comments from the code for USB Core
Instead of documenting in rst, pull the API from USB Device Core Layer header. Fixes: #5702 Signed-off-by: Andrei Emeltchenko <[email protected]>
1 parent ce6de82 commit 798cdae

File tree

1 file changed

+4
-118
lines changed

1 file changed

+4
-118
lines changed

doc/subsystems/usb/usb.rst

Lines changed: 4 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -55,124 +55,10 @@ functionalities:
5555
* Uses the APIs provided by the device controller drivers to interact with
5656
the USB device controller.
5757

58-
Structures
59-
==========
60-
61-
.. code-block:: c
62-
63-
typedef void (*usb_status_callback)(enum usb_dc_status_code status_code);
64-
65-
Callback function signature for the device status.
66-
67-
.. code-block:: c
68-
69-
typedef void (*usb_ep_callback)(u8_t ep,
70-
enum usb_dc_ep_cb_status_code cb_status);
71-
72-
Callback function signature for the USB Endpoint.
73-
74-
.. code-block:: c
75-
76-
typedef int (*usb_request_handler) (struct usb_setup_packet *setup,
77-
int *transfer_len, u8_t **payload_data);
78-
79-
Callback function signature for class specific requests. For host to device
80-
direction the 'len' and 'payload_data' contain the length of the received data
81-
and the pointer to the received data respectively. For device to host class
82-
requests, 'len' and 'payload_data' should be set by the callback function
83-
with the length and the address of the data to be transmitted buffer
84-
respectively.
85-
86-
.. code-block:: c
87-
88-
struct usb_ep_cfg_data {
89-
usb_ep_callback ep_cb;
90-
u8_t ep_addr;
91-
};
92-
93-
This structure contains configuration for a certain endpoint.
94-
* ep_cb: callback function for notification of data received and available
95-
to application or transmit done, NULL if callback not required by
96-
application code.
97-
* ep_addr: endpoint address. The number associated with the EP in the device
98-
configuration structure.
99-
100-
.. code-block:: c
101-
102-
struct usb_interface_cfg_data {
103-
usb_request_handler class_handler;
104-
usb_request_handler custom_handler;
105-
u8_t *payload_data;
106-
};
107-
108-
This structure contains USB interface configuration.
109-
* class_handler: handler for USB Class specific Control (EP 0)
110-
communications.
111-
* custom_handler: the custom request handler gets a first
112-
chance at handling the request before it is handed over to the
113-
'chapter 9' request handler.
114-
* payload_data: this data area, allocated by the application, is used to
115-
store class specific command data and must be large enough to store the
116-
largest payload associated with the largest supported Class' command set.
117-
118-
.. code-block:: c
119-
120-
struct usb_cfg_data {
121-
const u8_t *usb_device_description;
122-
usb_status_callback cb_usb_status;
123-
struct usb_interface_cfg_data interface;
124-
u8_t num_endpoints;
125-
struct usb_ep_cfg_data *endpoint;
126-
};
127-
128-
This structure contains USB device configuration.
129-
* usb_device_description: USB device description, see
130-
http://www.beyondlogic.org/usbnutshell/usb5.shtml#DeviceDescriptors
131-
* cb_usb_status: callback to be notified on USB connection status change
132-
* interface: USB class handlers and storage space.
133-
* num_endpoints: number of individual endpoints in the device configuration
134-
* endpoint: pointer to an array of endpoint configuration structures
135-
(usb_cfg_data) of length equal to the number of EP associated with the
136-
device description, not including control endpoints.
137-
138-
The class drivers instantiates this with given parameters using the
139-
"usb_set_config" function.
140-
141-
APIs
142-
====
143-
144-
:c:func:`usb_set_config()`
145-
This function configures USB device.
146-
147-
:c:func:`usb_deconfig()`
148-
This function returns the USB device back to it's initial state
149-
150-
:c:func:`usb_enable()`
151-
This function enable USB for host/device connection. Upon success, the USB
152-
module is no longer clock gated in hardware, it is now capable of
153-
transmitting and receiving on the USB bus and of generating interrupts.
154-
155-
:c:func:`usb_disable()`
156-
This function disables the USB device. Upon success, the USB module clock
157-
is gated in hardware and it is no longer capable of generating interrupts.
158-
159-
:c:func:`usb_write()`
160-
write data to the specified endpoint. The supplied usb_ep_callback will be
161-
called when transmission is done.
162-
163-
:c:func:`usb_read()`
164-
This function is called by the endpoint handler function after an OUT
165-
interrupt has been received for that EP. The application must only call
166-
this function through the supplied usb_ep_callback function.
167-
168-
:c:func:`usb_transfer()`
169-
This asynchronous function starts a usb transfer from/to a specified buffer.
170-
A callback can be provided and will be called on transfer completion.
171-
This function can be used in IRQ context.
172-
173-
:c:func:`usb_transfer_sync()`
174-
This function is the synchronous version of the usb_transfer function,
175-
waiting for transfer completion before returning.
58+
USB Device Core Layer API
59+
=========================
60+
.. doxygengroup:: _usb_device_core_api
61+
:project: Zephyr
17662

17763
USB device class drivers
17864
************************

0 commit comments

Comments
 (0)