|
Zephyr Project API 3.5.0
A Scalable Open Source RTOS
|
New experimental USB device stack APIs and structures. More...
#include <zephyr/device.h>#include <zephyr/usb/usb_ch9.h>#include <zephyr/net/buf.h>#include <zephyr/sys/byteorder.h>#include <zephyr/sys/slist.h>#include <zephyr/logging/log.h>#include <zephyr/sys/iterable_sections.h>Go to the source code of this file.
Data Structures | |
| struct | usbd_desc_node |
| Descriptor node. More... | |
| struct | usbd_config_node |
| Device configuration node. More... | |
| struct | usbd_ch9_data |
| USB device support middle layer runtime data. More... | |
| struct | usbd_status |
| USB device support status. More... | |
| struct | usbd_contex |
| USB device support runtime context. More... | |
| struct | usbd_cctx_vendor_req |
| Vendor Requests Table. More... | |
| struct | usbd_class_api |
| USB device support class instance API. More... | |
| struct | usbd_class_data |
| USB device support class data. More... | |
| struct | usbd_class_node |
Macros | |
| #define | USB_BSTRING_LENGTH(s) (sizeof(s) * 2 - 2) |
| #define | USB_STRING_DESCRIPTOR_LENGTH(s) (sizeof(s) * 2) |
| #define | USBD_NUMOF_INTERFACES_MAX 16U |
| #define | USBD_CCTX_REGISTERED 0 |
| USB Class instance registered flag. | |
| #define | USBD_DEVICE_DEFINE(device_name, uhc_dev, vid, pid) |
| #define | USBD_CONFIGURATION_DEFINE(name, attrib, power) |
| #define | USBD_DESC_LANG_DEFINE(name) |
| Create a string descriptor node and language string descriptor. | |
| #define | USBD_DESC_STRING_DEFINE(d_name, d_string, d_utype) |
| #define | USBD_DESC_MANUFACTURER_DEFINE(d_name, d_string) USBD_DESC_STRING_DEFINE(d_name, d_string, USBD_DUT_STRING_MANUFACTURER) |
| Create a string descriptor node and manufacturer string descriptor. | |
| #define | USBD_DESC_PRODUCT_DEFINE(d_name, d_string) USBD_DESC_STRING_DEFINE(d_name, d_string, USBD_DUT_STRING_PRODUCT) |
| Create a string descriptor node and product string descriptor. | |
| #define | USBD_DESC_SERIAL_NUMBER_DEFINE(d_name, d_string) USBD_DESC_STRING_DEFINE(d_name, d_string, USBD_DUT_STRING_SERIAL_NUMBER) |
| Create a string descriptor node and serial number string descriptor. | |
| #define | USBD_DEFINE_CLASS(class_name, class_api, class_data) |
| #define | VENDOR_REQ_DEFINE(_reqs, _len) |
| Helper to declare request table of usbd_cctx_vendor_req. | |
| #define | USBD_VENDOR_REQ(_reqs...) |
| Helper to declare supported vendor requests. | |
Enumerations | |
| enum | usbd_desc_usage_type { USBD_DUT_STRING_LANG , USBD_DUT_STRING_MANUFACTURER , USBD_DUT_STRING_PRODUCT , USBD_DUT_STRING_SERIAL_NUMBER , USBD_DUT_STRING_INTERFACE } |
| enum | usbd_ch9_state { USBD_STATE_DEFAULT = 0 , USBD_STATE_ADDRESS , USBD_STATE_CONFIGURED } |
| USB device support middle layer runtime state. More... | |
Functions | |
| int | usbd_add_descriptor (struct usbd_contex *uds_ctx, struct usbd_desc_node *dn) |
| Add common USB descriptor. | |
| int | usbd_add_configuration (struct usbd_contex *uds_ctx, struct usbd_config_node *cd) |
| Add a USB device configuration. | |
| int | usbd_register_class (struct usbd_contex *uds_ctx, const char *name, uint8_t cfg) |
| Register an USB class instance. | |
| int | usbd_unregister_class (struct usbd_contex *uds_ctx, const char *name, uint8_t cfg) |
| Unregister an USB class instance. | |
| int | usbd_init (struct usbd_contex *uds_ctx) |
| Initialize USB device. | |
| int | usbd_enable (struct usbd_contex *uds_ctx) |
| Enable the USB device support and registered class instances. | |
| int | usbd_disable (struct usbd_contex *uds_ctx) |
| Disable the USB device support. | |
| int | usbd_shutdown (struct usbd_contex *const uds_ctx) |
| Shutdown the USB device support. | |
| int | usbd_ep_set_halt (struct usbd_contex *uds_ctx, uint8_t ep) |
| Halt endpoint. | |
| int | usbd_ep_clear_halt (struct usbd_contex *uds_ctx, uint8_t ep) |
| Clear endpoint halt. | |
| bool | usbd_ep_is_halted (struct usbd_contex *uds_ctx, uint8_t ep) |
| Checks whether the endpoint is halted. | |
| struct net_buf * | usbd_ep_ctrl_buf_alloc (struct usbd_contex *const uds_ctx, const uint8_t ep, const size_t size) |
| Allocate buffer for USB device control request. | |
| struct net_buf * | usbd_ep_buf_alloc (const struct usbd_class_node *const c_nd, const uint8_t ep, const size_t size) |
| Allocate buffer for USB device request. | |
| int | usbd_ep_ctrl_enqueue (struct usbd_contex *const uds_ctx, struct net_buf *const buf) |
| Queue USB device control request. | |
| int | usbd_ep_enqueue (const struct usbd_class_node *const c_nd, struct net_buf *const buf) |
| Queue USB device request. | |
| int | usbd_ep_dequeue (struct usbd_contex *uds_ctx, const uint8_t ep) |
| Remove all USB device controller requests from endpoint queue. | |
| int | usbd_ep_buf_free (struct usbd_contex *uds_ctx, struct net_buf *buf) |
| Free USB device request buffer. | |
| bool | usbd_is_suspended (struct usbd_contex *uds_ctx) |
| Checks whether the USB device controller is suspended. | |
| int | usbd_wakeup_request (struct usbd_contex *uds_ctx) |
| Initiate the USB remote wakeup (TBD) | |
| int | usbd_device_set_bcd (struct usbd_contex *const uds_ctx, const uint16_t bcd) |
| Set USB device descriptor value bcdUSB. | |
| int | usbd_device_set_vid (struct usbd_contex *const uds_ctx, const uint16_t vid) |
| Set USB device descriptor value idVendor. | |
| int | usbd_device_set_pid (struct usbd_contex *const uds_ctx, const uint16_t pid) |
| Set USB device descriptor value idProduct. | |
| int | usbd_device_set_class (struct usbd_contex *const uds_ctx, const uint8_t value) |
| Set USB device descriptor value bDeviceClass. | |
| int | usbd_device_set_subclass (struct usbd_contex *const uds_ctx, const uint8_t value) |
| Set USB device descriptor value bDeviceSubClass. | |
| int | usbd_device_set_proto (struct usbd_contex *const uds_ctx, const uint8_t value) |
| Set USB device descriptor value bDeviceProtocol. | |
| int | usbd_config_attrib_rwup (struct usbd_contex *const uds_ctx, const uint8_t cfg, const bool enable) |
| Setup USB device configuration attribute Remote Wakeup. | |
| int | usbd_config_attrib_self (struct usbd_contex *const uds_ctx, const uint8_t cfg, const bool enable) |
| Setup USB device configuration attribute Self-powered. | |
| int | usbd_config_maxpower (struct usbd_contex *const uds_ctx, const uint8_t cfg, const uint8_t power) |
| Setup USB device configuration power consumption. | |
New experimental USB device stack APIs and structures.
This file contains the USB device stack APIs and structures.