16 TRN_USB_DT_DEVICE = 0x1,
17 TRN_USB_DT_CONFIGURATION = 0x2,
18 TRN_USB_DT_STRING = 0x3,
19 TRN_USB_DT_INTERFACE = 0x4,
20 TRN_USB_DT_ENDPOINT = 0x5,
22 TRN_USB_DT_DEVICE_CAPABILITY = 0x10
23 } trn_usb_descriptor_type_t;
26 TRN_USB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1,
27 TRN_USB_BT_USB_2_0_EXTENSION = 2,
28 TRN_USB_BT_SS_USB_DEVICE_CAPABILITY = 3,
29 TRN_USB_BT_CONTAINER_ID = 4,
33 TRN_USB_ENDPOINT_OUT = 0x00,
34 TRN_USB_ENDPOINT_IN = 0x80,
35 } trn_usb_endpoint_direction_t;
38 TRN_USB_TRANSFER_TYPE_CONTROL = 0x0,
39 TRN_USB_TRANSFER_TYPE_ISOCHRONOUS = 0x1,
40 TRN_USB_TRANSFER_TYPE_BULK = 0x2,
41 TRN_USB_TRANSFER_TYPE_INTERRUPT = 0x3,
42 } trn_usb_transfer_type_t;
47 uint8_t bDescriptorType;
52 uint8_t bDescriptorType;
55 uint8_t bDeviceSubClass;
56 uint8_t bDeviceProtocol;
57 uint8_t bMaxPacketSize;
61 uint8_t iManufacturer;
63 uint8_t iSerialNumber;
64 uint8_t bNumConfigurations;
65 } usb_device_descriptor_t;
69 uint8_t bDescriptorType;
70 uint16_t wTotalLength;
71 uint8_t bNumInterfaces;
72 uint8_t bConfigurationValue;
73 uint8_t iConfiguration;
76 } usb_configuration_descriptor_t;
80 uint8_t bDescriptorType;
81 uint8_t bInterfaceNumber;
82 uint8_t bAlternateSetting;
83 uint8_t bNumEndpoints;
84 uint8_t bInterfaceClass;
85 uint8_t bInterfaceSubClass;
86 uint8_t bInterfaceProtocol;
88 } usb_interface_descriptor_t;
92 uint8_t bDescriptorType;
93 uint8_t bEndpointAddress;
95 uint16_t wMaxPacketSize;
97 } usb_endpoint_descriptor_t;
101 uint8_t bDescriptorType;
103 trn_char16_t bString[0x40];
104 uint16_t wLANGID[0x40];
106 } usb_string_descriptor_t;
110 uint8_t bDescriptorType;
111 uint8_t bDevCapabilityType;
112 uint8_t dev_capability_data[0];
113 } usb_bos_dev_capability_descriptor_t;
117 uint8_t bDescriptorType;
118 uint16_t wTotalLength;
119 usb_bos_dev_capability_descriptor_t capabilities[0];
120 } usb_bos_descriptor_t;
126 char manufacturer[0x20];
128 char serial_number[0x20];
132 USB_DS_STATE_INITIAL = 0,
133 USB_DS_STATE_INIT_STARTING = 6,
134 USB_DS_STATE_INIT2 = 3,
135 USB_DS_STATE_INIT3 = 4,
136 USB_DS_STATE_INITIALIZED = 5,
138 USB_DS_STATE_MAX = 0xFFFFFFFF
180 extern uint8_t _usb_next_in_ep_number;
181 extern uint8_t _usb_next_out_ep_number;
185 result_t _usb_ds_500_append_configuration_data(
usb_ds_interface_t *interface, uint32_t speed_mode, usb_descriptor_t *descriptor);
void usb_ds_finalize()
Finalize USB as device services.
Definition: graphic_buffer_queue.h:83
uint32_t result_t
Function result.
Definition: types.h:51
handle_t revent_h
revent handle
Definition: types.h:47
String encoding functions Based on https://github.com/nothings/stb.
Definition: interface.h:20
result_t usb_ds_get_state_change_event(revent_h *evt)
Get state change event.
result_t usb_ds_get_state(usb_ds_state_t *state)
Get state.
result_t usb_ds_init(uint32_t complex_id, usb_device_data_t *data)
Initialize USB-as-device services.
result_t usb_ds_get_interface(usb_interface_descriptor_t *descriptor, const char *name, usb_ds_interface_t *out)
Open a new USB interface.