| 
    Zephyr Project API
    3.4.0
    
   A Scalable Open Source RTOS 
   | 
 
New USB device controller (UDC) driver API. More...
#include <zephyr/kernel.h>#include <zephyr/device.h>#include <zephyr/net/buf.h>#include <zephyr/sys/atomic.h>#include <zephyr/usb/usb_ch9.h>Go to the source code of this file.
Data Structures | |
| struct | udc_device_caps | 
| struct | udc_ep_caps | 
| struct | udc_ep_stat | 
| struct | udc_ep_config | 
| struct | udc_event | 
| struct | udc_buf_info | 
| struct | udc_api | 
| UDC driver API This is the mandatory API any USB device controller driver needs to expose with exception of: device_speed() used by udc_device_speed(), not required for FS only devices.  More... | |
| struct | udc_data | 
Macros | |
| #define | UDC_STATUS_INITIALIZED 0 | 
| #define | UDC_STATUS_ENABLED 1 | 
| #define | UDC_STATUS_SUSPENDED 2 | 
Typedefs | |
| typedef int(* | udc_event_cb_t) (const struct device *dev, const struct udc_event *const event) | 
| Callback to submit UDC event to higher layer.  More... | |
Enumerations | |
| enum | udc_mps0 { UDC_MPS0_8 , UDC_MPS0_16 , UDC_MPS0_32 , UDC_MPS0_64 } | 
| Maximum packet size of control endpoint supported by the controller.  More... | |
| enum | udc_bus_speed { UDC_BUS_UNKNOWN , UDC_BUS_SPEED_FS , UDC_BUS_SPEED_HS , UDC_BUS_SPEED_SS } | 
| USB device actual speed.  More... | |
| enum | udc_event_type {  UDC_EVT_VBUS_READY , UDC_EVT_VBUS_REMOVED , UDC_EVT_RESUME , UDC_EVT_SUSPEND , UDC_EVT_RESET , UDC_EVT_SOF , UDC_EVT_EP_REQUEST , UDC_EVT_ERROR }  | 
| USB device controller event types.  More... | |
Functions | |
| static bool | udc_is_initialized (const struct device *dev) | 
| Checks whether the controller is initialized.  More... | |
| static bool | udc_is_enabled (const struct device *dev) | 
| Checks whether the controller is enabled.  More... | |
| static bool | udc_is_suspended (const struct device *dev) | 
| Checks whether the controller is suspended.  More... | |
| int | udc_init (const struct device *dev, udc_event_cb_t event_cb) | 
| Initialize USB device controller.  More... | |
| int | udc_enable (const struct device *dev) | 
| Enable USB device controller.  More... | |
| int | udc_disable (const struct device *dev) | 
| Disable USB device controller.  More... | |
| int | udc_shutdown (const struct device *dev) | 
| Poweroff USB device controller.  More... | |
| static struct udc_device_caps | udc_caps (const struct device *dev) | 
| Get USB device controller capabilities.  More... | |
| enum udc_bus_speed | udc_device_speed (const struct device *dev) | 
| Get actual USB device speed.  More... | |
| static int | udc_set_address (const struct device *dev, const uint8_t addr) | 
| Set USB device address.  More... | |
| static int | udc_host_wakeup (const struct device *dev) | 
| Initiate host wakeup procedure.  More... | |
| int | udc_ep_try_config (const struct device *dev, const uint8_t ep, const uint8_t attributes, uint16_t *const mps, const uint8_t interval) | 
| Try an endpoint configuration.  More... | |
| int | udc_ep_enable (const struct device *dev, const uint8_t ep, const uint8_t attributes, const uint16_t mps, const uint8_t interval) | 
| Configure and enable endpoint.  More... | |
| int | udc_ep_disable (const struct device *dev, const uint8_t ep) | 
| Disable endpoint.  More... | |
| int | udc_ep_set_halt (const struct device *dev, const uint8_t ep) | 
| Halt endpoint.  More... | |
| int | udc_ep_clear_halt (const struct device *dev, const uint8_t ep) | 
| Clear endpoint halt.  More... | |
| int | udc_ep_enqueue (const struct device *dev, struct net_buf *const buf) | 
| Queue USB device controller request.  More... | |
| int | udc_ep_dequeue (const struct device *dev, const uint8_t ep) | 
| Remove all USB device controller requests from endpoint queue.  More... | |
| struct net_buf * | udc_ep_buf_alloc (const struct device *dev, const uint8_t ep, const size_t size) | 
| Allocate UDC request buffer.  More... | |
| int | udc_ep_buf_free (const struct device *dev, struct net_buf *const buf) | 
| Free UDC request buffer.  More... | |
| static void | udc_ep_buf_set_zlp (struct net_buf *const buf) | 
| Set ZLP flag in requests metadata.  More... | |
| static struct udc_buf_info * | udc_get_buf_info (const struct net_buf *const buf) | 
| Get requests metadata.  More... | |
New USB device controller (UDC) driver API.
| #define UDC_STATUS_ENABLED 1 | 
Controller is enabled and all API functions are available, controller is recognizable by host.
| #define UDC_STATUS_INITIALIZED 0 | 
Controller is initialized by udc_init() and can generate the VBUS events, if capable, but shall not be recognizable by host.
| #define UDC_STATUS_SUSPENDED 2 | 
Controller is suspended by the host
| udc_event_cb_t | 
Callback to submit UDC event to higher layer.
At the higher level, the event is to be inserted into a message queue. (TBD) Maybe it is better to provide a pointer to k_msgq passed during initialization.
| [in] | dev | Pointer to device struct of the driver instance | 
| [in] | event | Point to event structure | 
| enum udc_bus_speed | 
| enum udc_event_type | 
USB device controller event types.
| enum udc_mps0 |