Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
usbd.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef ZEPHYR_INCLUDE_USBD_H_
15#define ZEPHYR_INCLUDE_USBD_H_
16
17#include <zephyr/device.h>
18#include <zephyr/usb/bos.h>
19#include <zephyr/usb/usb_ch9.h>
20#include <zephyr/usb/usbd_msg.h>
21#include <zephyr/net/buf.h>
23#include <zephyr/sys/slist.h>
24#include <zephyr/logging/log.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
38/*
39 * The USB Unicode bString is encoded in UTF16LE, which means it takes up
40 * twice the amount of bytes than the same string encoded in ASCII7.
41 * Use this macro to determine the length of the bString array.
42 *
43 * bString length without null character:
44 * bString_length = (sizeof(initializer_string) - 1) * 2
45 * or:
46 * bString_length = sizeof(initializer_string) * 2 - 2
47 */
48#define USB_BSTRING_LENGTH(s) (sizeof(s) * 2 - 2)
49
50/*
51 * The length of the string descriptor (bLength) is calculated from the
52 * size of the two octets bLength and bDescriptorType plus the
53 * length of the UTF16LE string:
54 *
55 * bLength = 2 + bString_length
56 * bLength = 2 + sizeof(initializer_string) * 2 - 2
57 * bLength = sizeof(initializer_string) * 2
58 * Use this macro to determine the bLength of the string descriptor.
59 */
60#define USB_STRING_DESCRIPTOR_LENGTH(s) (sizeof(s) * 2)
61
65enum usbd_str_desc_utype {
66 USBD_DUT_STRING_LANG,
67 USBD_DUT_STRING_MANUFACTURER,
68 USBD_DUT_STRING_PRODUCT,
69 USBD_DUT_STRING_SERIAL_NUMBER,
70 USBD_DUT_STRING_INTERFACE,
71};
72
73enum usbd_bos_desc_utype {
74 USBD_DUT_BOS_NONE,
75};
85 enum usbd_str_desc_utype utype : 8;
87 unsigned int ascii7 : 1;
89 unsigned int use_hwinfo : 1;
90};
91
97 enum usbd_bos_desc_utype utype : 8;
98};
99
120
137
138/* TODO: Kconfig option USBD_NUMOF_INTERFACES_MAX? */
139#define USBD_NUMOF_INTERFACES_MAX 16U
140
152
153
173
185
191 unsigned int initialized : 1;
193 unsigned int enabled : 1;
195 unsigned int suspended : 1;
197 unsigned int rwup : 1;
200};
201
202struct usbd_context;
203
215typedef void (*usbd_msg_cb_t)(struct usbd_context *const ctx,
216 const struct usbd_msg *const msg);
217
248
258
260#define USBD_CCTX_REGISTERED 0
261
262struct usbd_class_data;
263
269 void (*feature_halt)(struct usbd_class_data *const c_data,
270 uint8_t ep, bool halted);
271
273 void (*update)(struct usbd_class_data *const c_data,
274 uint8_t iface, uint8_t alternate);
275
277 int (*control_to_dev)(struct usbd_class_data *const c_data,
278 const struct usb_setup_packet *const setup,
279 const struct net_buf *const buf);
280
282 int (*control_to_host)(struct usbd_class_data *const c_data,
283 const struct usb_setup_packet *const setup,
284 struct net_buf *const buf);
285
287 int (*request)(struct usbd_class_data *const c_data,
288 struct net_buf *buf, int err);
289
291 void (*suspended)(struct usbd_class_data *const c_data);
292
294 void (*resumed)(struct usbd_class_data *const c_data);
295
297 void (*sof)(struct usbd_class_data *const c_data);
298
300 void (*enable)(struct usbd_class_data *const c_data);
301
303 void (*disable)(struct usbd_class_data *const c_data);
304
306 int (*init)(struct usbd_class_data *const c_data);
307
309 void (*shutdown)(struct usbd_class_data *const c_data);
310
312 void *(*get_desc)(struct usbd_class_data *const c_data,
313 const enum usbd_speed speed);
314};
315
321 const char *name;
325 const struct usbd_class_api *api;
329 void *priv;
330};
331
340struct usbd_class_node {
342 sys_snode_t node;
344 struct usbd_class_data *const c_data;
348 uint32_t ep_assigned;
352 uint32_t ep_active;
354 uint32_t iface_bm;
357};
358
371static inline struct usbd_context *usbd_class_get_ctx(const struct usbd_class_data *const c_data)
372{
373 return c_data->uds_ctx;
374}
375
386static inline void *usbd_class_get_private(const struct usbd_class_data *const c_data)
387{
388 return c_data->priv;
389}
390
411#define USBD_DEVICE_DEFINE(device_name, udc_dev, vid, pid) \
412 static struct usb_device_descriptor \
413 fs_desc_##device_name = { \
414 .bLength = sizeof(struct usb_device_descriptor), \
415 .bDescriptorType = USB_DESC_DEVICE, \
416 .bcdUSB = sys_cpu_to_le16(USB_SRN_2_0), \
417 .bDeviceClass = USB_BCC_MISCELLANEOUS, \
418 .bDeviceSubClass = 2, \
419 .bDeviceProtocol = 1, \
420 .bMaxPacketSize0 = USB_CONTROL_EP_MPS, \
421 .idVendor = vid, \
422 .idProduct = pid, \
423 .bcdDevice = sys_cpu_to_le16(USB_BCD_DRN), \
424 .iManufacturer = 0, \
425 .iProduct = 0, \
426 .iSerialNumber = 0, \
427 .bNumConfigurations = 0, \
428 }; \
429 static struct usb_device_descriptor \
430 hs_desc_##device_name = { \
431 .bLength = sizeof(struct usb_device_descriptor), \
432 .bDescriptorType = USB_DESC_DEVICE, \
433 .bcdUSB = sys_cpu_to_le16(USB_SRN_2_0), \
434 .bDeviceClass = USB_BCC_MISCELLANEOUS, \
435 .bDeviceSubClass = 2, \
436 .bDeviceProtocol = 1, \
437 .bMaxPacketSize0 = 64, \
438 .idVendor = vid, \
439 .idProduct = pid, \
440 .bcdDevice = sys_cpu_to_le16(USB_BCD_DRN), \
441 .iManufacturer = 0, \
442 .iProduct = 0, \
443 .iSerialNumber = 0, \
444 .bNumConfigurations = 0, \
445 }; \
446 static STRUCT_SECTION_ITERABLE(usbd_context, device_name) = { \
447 .name = STRINGIFY(device_name), \
448 .dev = udc_dev, \
449 .fs_desc = &fs_desc_##device_name, \
450 .hs_desc = &hs_desc_##device_name, \
451 }
452
467#define USBD_CONFIGURATION_DEFINE(name, attrib, power) \
468 static struct usb_cfg_descriptor \
469 cfg_desc_##name = { \
470 .bLength = sizeof(struct usb_cfg_descriptor), \
471 .bDescriptorType = USB_DESC_CONFIGURATION, \
472 .wTotalLength = 0, \
473 .bNumInterfaces = 0, \
474 .bConfigurationValue = 1, \
475 .iConfiguration = 0, \
476 .bmAttributes = USB_SCD_RESERVED | (attrib), \
477 .bMaxPower = (power), \
478 }; \
479 BUILD_ASSERT((power) < 256, "Too much power"); \
480 static struct usbd_config_node name = { \
481 .desc = &cfg_desc_##name, \
482 }
483
497#define USBD_DESC_LANG_DEFINE(name) \
498 static uint16_t langid_##name = sys_cpu_to_le16(0x0409); \
499 static struct usbd_desc_node name = { \
500 .bLength = sizeof(struct usb_string_descriptor), \
501 .bDescriptorType = USB_DESC_STRING, \
502 .str = { \
503 .idx = 0, \
504 .utype = USBD_DUT_STRING_LANG, \
505 }, \
506 .ptr = &langid_##name, \
507 }
508
520#define USBD_DESC_STRING_DEFINE(d_name, d_string, d_utype) \
521 static uint8_t ascii_##d_name[USB_BSTRING_LENGTH(d_string)] = d_string; \
522 static struct usbd_desc_node d_name = { \
523 .str = { \
524 .utype = d_utype, \
525 .ascii7 = true, \
526 }, \
527 .bLength = USB_STRING_DESCRIPTOR_LENGTH(d_string), \
528 .bDescriptorType = USB_DESC_STRING, \
529 .ptr = &ascii_##d_name, \
530 }
531
543#define USBD_DESC_MANUFACTURER_DEFINE(d_name, d_string) \
544 USBD_DESC_STRING_DEFINE(d_name, d_string, USBD_DUT_STRING_MANUFACTURER)
545
557#define USBD_DESC_PRODUCT_DEFINE(d_name, d_string) \
558 USBD_DESC_STRING_DEFINE(d_name, d_string, USBD_DUT_STRING_PRODUCT)
559
570#define USBD_DESC_SERIAL_NUMBER_DEFINE(d_name) \
571 static struct usbd_desc_node d_name = { \
572 .str = { \
573 .utype = USBD_DUT_STRING_SERIAL_NUMBER, \
574 .ascii7 = true, \
575 .use_hwinfo = true, \
576 }, \
577 .bDescriptorType = USB_DESC_STRING, \
578 }
579
590#define USBD_DESC_BOS_DEFINE(name, len, subset) \
591 static struct usbd_desc_node name = { \
592 .bos = { \
593 .utype = USBD_DUT_BOS_NONE, \
594 }, \
595 .ptr = subset, \
596 .bLength = len, \
597 .bDescriptorType = USB_DESC_BOS, \
598 }
599
611#define USBD_DEFINE_CLASS(class_name, class_api, class_priv, class_v_reqs) \
612 static struct usbd_class_data class_name = { \
613 .name = STRINGIFY(class_name), \
614 .api = class_api, \
615 .v_reqs = class_v_reqs, \
616 .priv = class_priv, \
617 }; \
618 static STRUCT_SECTION_ITERABLE_ALTERNATE( \
619 usbd_class_fs, usbd_class_node, class_name##_fs) = { \
620 .c_data = &class_name, \
621 }; \
622 static STRUCT_SECTION_ITERABLE_ALTERNATE( \
623 usbd_class_hs, usbd_class_node, class_name##_hs) = { \
624 .c_data = &class_name, \
625 }
626
632#define VENDOR_REQ_DEFINE(_reqs, _len) \
633 { \
634 .reqs = (const uint8_t *)(_reqs), \
635 .len = (_len), \
636 }
637
642#define USBD_VENDOR_REQ(_reqs...) \
643 VENDOR_REQ_DEFINE(((uint8_t []) { _reqs }), \
644 sizeof((uint8_t []) { _reqs }))
645
646
658 struct usbd_desc_node *dn);
659
667uint8_t usbd_str_desc_get_idx(const struct usbd_desc_node *const desc_nd);
668
676void usbd_remove_descriptor(struct usbd_desc_node *const desc_nd);
677
688 const enum usbd_speed speed,
689 struct usbd_config_node *cd);
690
713 const char *name,
714 const enum usbd_speed speed, uint8_t cfg);
715
733 const enum usbd_speed speed, uint8_t cfg);
734
750 const char *name,
751 const enum usbd_speed speed, uint8_t cfg);
752
766 const enum usbd_speed speed, uint8_t cfg);
767
776int usbd_msg_register_cb(struct usbd_context *const uds_ctx,
777 const usbd_msg_cb_t cb);
778
792int usbd_init(struct usbd_context *uds_ctx);
793
803int usbd_enable(struct usbd_context *uds_ctx);
804
814int usbd_disable(struct usbd_context *uds_ctx);
815
825int usbd_shutdown(struct usbd_context *const uds_ctx);
826
835int usbd_ep_set_halt(struct usbd_context *uds_ctx, uint8_t ep);
836
845int usbd_ep_clear_halt(struct usbd_context *uds_ctx, uint8_t ep);
846
855bool usbd_ep_is_halted(struct usbd_context *uds_ctx, uint8_t ep);
856
868struct net_buf *usbd_ep_buf_alloc(const struct usbd_class_data *const c_data,
869 const uint8_t ep, const size_t size);
870
881int usbd_ep_ctrl_enqueue(struct usbd_context *const uds_ctx,
882 struct net_buf *const buf);
883
894int usbd_ep_enqueue(const struct usbd_class_data *const c_data,
895 struct net_buf *const buf);
896
905int usbd_ep_dequeue(struct usbd_context *uds_ctx, const uint8_t ep);
906
917int usbd_ep_buf_free(struct usbd_context *uds_ctx, struct net_buf *buf);
918
926bool usbd_is_suspended(struct usbd_context *uds_ctx);
927
934
942enum usbd_speed usbd_bus_speed(const struct usbd_context *const uds_ctx);
943
951enum usbd_speed usbd_caps_speed(const struct usbd_context *const uds_ctx);
952
962int usbd_device_set_bcd(struct usbd_context *const uds_ctx,
963 const enum usbd_speed speed, const uint16_t bcd);
964
973int usbd_device_set_vid(struct usbd_context *const uds_ctx,
974 const uint16_t vid);
975
984int usbd_device_set_pid(struct usbd_context *const uds_ctx,
985 const uint16_t pid);
986
999 const enum usbd_speed speed,
1000 const uint8_t base_class,
1001 const uint8_t subclass, const uint8_t protocol);
1002
1013int usbd_config_attrib_rwup(struct usbd_context *const uds_ctx,
1014 const enum usbd_speed speed,
1015 const uint8_t cfg, const bool enable);
1016
1027int usbd_config_attrib_self(struct usbd_context *const uds_ctx,
1028 const enum usbd_speed speed,
1029 const uint8_t cfg, const bool enable);
1030
1041int usbd_config_maxpower(struct usbd_context *const uds_ctx,
1042 const enum usbd_speed speed,
1043 const uint8_t cfg, const uint8_t power);
1044
1057bool usbd_can_detect_vbus(struct usbd_context *const uds_ctx);
1058
1063#ifdef __cplusplus
1064}
1065#endif
1066
1067#endif /* ZEPHYR_INCLUDE_USBD_H_ */
long atomic_t
Definition atomic_types.h:15
struct _dnode sys_dnode_t
Doubly-linked list node structure.
Definition dlist.h:54
struct _dnode sys_dlist_t
Doubly-linked list structure.
Definition dlist.h:50
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
int usbd_ep_clear_halt(struct usbd_context *uds_ctx, uint8_t ep)
Clear endpoint halt.
int usbd_device_set_vid(struct usbd_context *const uds_ctx, const uint16_t vid)
Set USB device descriptor value idVendor.
int usbd_ep_dequeue(struct usbd_context *uds_ctx, const uint8_t ep)
Remove all USB device controller requests from endpoint queue.
int usbd_ep_set_halt(struct usbd_context *uds_ctx, uint8_t ep)
Halt endpoint.
int usbd_enable(struct usbd_context *uds_ctx)
Enable the USB device support and registered class instances.
int usbd_unregister_class(struct usbd_context *uds_ctx, const char *name, const enum usbd_speed speed, uint8_t cfg)
Unregister an USB class instance.
int usbd_unregister_all_classes(struct usbd_context *uds_ctx, const enum usbd_speed speed, uint8_t cfg)
Unregister all available USB class instances.
int usbd_config_attrib_rwup(struct usbd_context *const uds_ctx, const enum usbd_speed speed, const uint8_t cfg, const bool enable)
Setup USB device configuration attribute Remote Wakeup.
void(* usbd_msg_cb_t)(struct usbd_context *const ctx, const struct usbd_msg *const msg)
Callback type definition for USB device message delivery.
Definition usbd.h:215
static void * usbd_class_get_private(const struct usbd_class_data *const c_data)
Get class implementation private data.
Definition usbd.h:386
int usbd_msg_register_cb(struct usbd_context *const uds_ctx, const usbd_msg_cb_t cb)
Register USB notification message callback.
usbd_speed
USB device speed.
Definition usbd.h:177
void usbd_remove_descriptor(struct usbd_desc_node *const desc_nd)
Remove USB string descriptor.
int usbd_add_descriptor(struct usbd_context *uds_ctx, struct usbd_desc_node *dn)
Add common USB descriptor.
int usbd_wakeup_request(struct usbd_context *uds_ctx)
Initiate the USB remote wakeup (TBD)
int usbd_shutdown(struct usbd_context *const uds_ctx)
Shutdown the USB device support.
int usbd_register_all_classes(struct usbd_context *uds_ctx, const enum usbd_speed speed, uint8_t cfg)
Register all available USB class instances.
int usbd_device_set_pid(struct usbd_context *const uds_ctx, const uint16_t pid)
Set USB device descriptor value idProduct.
int usbd_register_class(struct usbd_context *uds_ctx, const char *name, const enum usbd_speed speed, uint8_t cfg)
Register an USB class instance.
int usbd_config_maxpower(struct usbd_context *const uds_ctx, const enum usbd_speed speed, const uint8_t cfg, const uint8_t power)
Setup USB device configuration power consumption.
bool usbd_can_detect_vbus(struct usbd_context *const uds_ctx)
Check that the controller can detect the VBUS state change.
int usbd_add_configuration(struct usbd_context *uds_ctx, const enum usbd_speed speed, struct usbd_config_node *cd)
Add a USB device configuration.
bool usbd_is_suspended(struct usbd_context *uds_ctx)
Checks whether the USB device controller is suspended.
struct net_buf * usbd_ep_buf_alloc(const struct usbd_class_data *const c_data, const uint8_t ep, const size_t size)
Allocate buffer for USB device request.
int usbd_init(struct usbd_context *uds_ctx)
Initialize USB device.
int usbd_device_set_code_triple(struct usbd_context *const uds_ctx, const enum usbd_speed speed, const uint8_t base_class, const uint8_t subclass, const uint8_t protocol)
Set USB device descriptor code triple Base Class, SubClass, and Protocol.
int usbd_ep_buf_free(struct usbd_context *uds_ctx, struct net_buf *buf)
Free USB device request buffer.
int usbd_config_attrib_self(struct usbd_context *const uds_ctx, const enum usbd_speed speed, const uint8_t cfg, const bool enable)
Setup USB device configuration attribute Self-powered.
bool usbd_ep_is_halted(struct usbd_context *uds_ctx, uint8_t ep)
Checks whether the endpoint is halted.
usbd_ch9_state
USB device support middle layer runtime state.
Definition usbd.h:147
int usbd_ep_ctrl_enqueue(struct usbd_context *const uds_ctx, struct net_buf *const buf)
Queue USB device control request.
int usbd_disable(struct usbd_context *uds_ctx)
Disable the USB device support.
enum usbd_speed usbd_caps_speed(const struct usbd_context *const uds_ctx)
Get highest speed supported by the controller.
int usbd_ep_enqueue(const struct usbd_class_data *const c_data, struct net_buf *const buf)
Queue USB device request.
uint8_t usbd_str_desc_get_idx(const struct usbd_desc_node *const desc_nd)
Get USB string descriptor index from descriptor node.
int usbd_device_set_bcd(struct usbd_context *const uds_ctx, const enum usbd_speed speed, const uint16_t bcd)
Set USB device descriptor value bcdUSB.
enum usbd_speed usbd_bus_speed(const struct usbd_context *const uds_ctx)
Get actual device speed.
#define USBD_NUMOF_INTERFACES_MAX
Definition usbd.h:139
static struct usbd_context * usbd_class_get_ctx(const struct usbd_class_data *const c_data)
Get the USB device runtime context under which the class is registered.
Definition usbd.h:371
@ USBD_SPEED_SS
Device supports or is connected to a super speed bus.
Definition usbd.h:183
@ USBD_SPEED_FS
Device supports or is connected to a full speed bus.
Definition usbd.h:179
@ USBD_SPEED_HS
Device supports or is connected to a high speed bus
Definition usbd.h:181
@ USBD_STATE_CONFIGURED
Definition usbd.h:150
@ USBD_STATE_DEFAULT
Definition usbd.h:148
@ USBD_STATE_ADDRESS
Definition usbd.h:149
Buffer management.
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
Mutex Structure.
Definition kernel.h:2917
Network buffer representation.
Definition buf.h:1004
uint16_t size
Amount of data that this buffer can store.
Definition buf.h:1036
USB Setup Data packet defined in spec.
Definition usb_ch9.h:40
USBD BOS Device Capability descriptor data.
Definition usbd.h:95
enum usbd_bos_desc_utype utype
Descriptor usage type (not bDescriptorType)
Definition usbd.h:97
Vendor Requests Table.
Definition usbd.h:252
const uint8_t * reqs
Array of vendor requests supported by the class.
Definition usbd.h:254
uint8_t len
Length of the array.
Definition usbd.h:256
USB device support middle layer runtime data.
Definition usbd.h:157
int ctrl_type
Control type, internally used for stage verification.
Definition usbd.h:161
uint8_t configuration
USB device stack selected configuration.
Definition usbd.h:167
uint32_t ep_halt
Halted endpoints bitmap.
Definition usbd.h:165
bool post_status
Post status stage work required, e.g.
Definition usbd.h:169
enum usbd_ch9_state state
Protocol state of the USB device stack.
Definition usbd.h:163
struct usb_setup_packet setup
Setup packet, up-to-date for the respective control request.
Definition usbd.h:159
uint8_t alternate[16U]
Array to track interfaces alternate settings.
Definition usbd.h:171
USB device support class instance API.
Definition usbd.h:267
void(* feature_halt)(struct usbd_class_data *const c_data, uint8_t ep, bool halted)
Feature halt state update handler.
Definition usbd.h:269
void(* update)(struct usbd_class_data *const c_data, uint8_t iface, uint8_t alternate)
Configuration update handler.
Definition usbd.h:273
void(* sof)(struct usbd_class_data *const c_data)
Start of Frame.
Definition usbd.h:297
void(* suspended)(struct usbd_class_data *const c_data)
USB power management handler suspended.
Definition usbd.h:291
void(* shutdown)(struct usbd_class_data *const c_data)
Shutdown of the class implementation.
Definition usbd.h:309
int(* request)(struct usbd_class_data *const c_data, struct net_buf *buf, int err)
Endpoint request completion event handler.
Definition usbd.h:287
int(* init)(struct usbd_class_data *const c_data)
Initialization of the class implementation.
Definition usbd.h:306
int(* control_to_dev)(struct usbd_class_data *const c_data, const struct usb_setup_packet *const setup, const struct net_buf *const buf)
USB control request handler to device.
Definition usbd.h:277
void(* enable)(struct usbd_class_data *const c_data)
Class associated configuration is selected.
Definition usbd.h:300
int(* control_to_host)(struct usbd_class_data *const c_data, const struct usb_setup_packet *const setup, struct net_buf *const buf)
USB control request handler to host.
Definition usbd.h:282
void(* resumed)(struct usbd_class_data *const c_data)
USB power management handler resumed.
Definition usbd.h:294
void(* disable)(struct usbd_class_data *const c_data)
Class associated configuration is disabled.
Definition usbd.h:303
USB device support class data.
Definition usbd.h:319
void * priv
Pointer to private data.
Definition usbd.h:329
struct usbd_context * uds_ctx
Pointer to USB device stack context structure.
Definition usbd.h:323
const struct usbd_cctx_vendor_req * v_reqs
Supported vendor request table, can be NULL.
Definition usbd.h:327
const struct usbd_class_api * api
Pointer to device support class API.
Definition usbd.h:325
const char * name
Name of the USB device class instance.
Definition usbd.h:321
Device configuration node.
Definition usbd.h:129
sys_snode_t node
slist node struct
Definition usbd.h:131
sys_slist_t class_list
List of registered classes (functions)
Definition usbd.h:135
void * desc
Pointer to configuration descriptor.
Definition usbd.h:133
USB device support runtime context.
Definition usbd.h:224
void * fs_desc
Pointer to Full-Speed device descriptor.
Definition usbd.h:244
void * hs_desc
Pointer to High-Speed device descriptor.
Definition usbd.h:246
usbd_msg_cb_t msg_cb
Notification message recipient callback.
Definition usbd.h:232
struct usbd_status status
Status of the USB device support.
Definition usbd.h:242
sys_slist_t hs_configs
slist to manage High-Speed device configurations
Definition usbd.h:240
struct usbd_ch9_data ch9_data
Middle layer runtime data.
Definition usbd.h:234
const struct device * dev
Pointer to UDC device.
Definition usbd.h:230
sys_slist_t fs_configs
slist to manage Full-Speed device configurations
Definition usbd.h:238
struct k_mutex mutex
Access mutex.
Definition usbd.h:228
const char * name
Name of the USB device.
Definition usbd.h:226
sys_dlist_t descriptors
slist to manage descriptors like string, BOS
Definition usbd.h:236
Descriptor node.
Definition usbd.h:106
uint8_t bDescriptorType
Descriptor type.
Definition usbd.h:118
sys_dnode_t node
slist node struct
Definition usbd.h:108
const void *const ptr
Opaque pointer to a descriptor payload.
Definition usbd.h:114
uint8_t bLength
Descriptor size in bytes.
Definition usbd.h:116
struct usbd_str_desc_data str
Definition usbd.h:110
struct usbd_bos_desc_data bos
Definition usbd.h:111
USB device message.
Definition usbd_msg.h:77
USB device support status.
Definition usbd.h:189
unsigned int rwup
USB remote wake-up feature is enabled.
Definition usbd.h:197
unsigned int enabled
USB device support is enabled.
Definition usbd.h:193
enum usbd_speed speed
USB device speed.
Definition usbd.h:199
unsigned int initialized
USB device support is initialized.
Definition usbd.h:191
unsigned int suspended
USB device is suspended.
Definition usbd.h:195
Used internally to keep descriptors in order.
Definition usbd.h:81
uint8_t idx
Descriptor index, required for string descriptors.
Definition usbd.h:83
enum usbd_str_desc_utype utype
Descriptor usage type (not bDescriptorType)
Definition usbd.h:85
unsigned int use_hwinfo
Device stack obtains SerialNumber using the HWINFO API.
Definition usbd.h:89
unsigned int ascii7
The string descriptor is in ASCII7 format.
Definition usbd.h:87
Byte order helpers.
static void msg(uint64_t c64)
Definition main.c:17
USB Chapter 9 structures and definitions.
USB support message types and structure.