Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 /**
Pawel Zarembski 0:01f31e923fe2 2 * @file usb_def.h
Pawel Zarembski 0:01f31e923fe2 3 * @brief USB defines
Pawel Zarembski 0:01f31e923fe2 4 *
Pawel Zarembski 0:01f31e923fe2 5 * DAPLink Interface Firmware
Pawel Zarembski 0:01f31e923fe2 6 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
Pawel Zarembski 0:01f31e923fe2 7 * SPDX-License-Identifier: Apache-2.0
Pawel Zarembski 0:01f31e923fe2 8 *
Pawel Zarembski 0:01f31e923fe2 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Pawel Zarembski 0:01f31e923fe2 10 * not use this file except in compliance with the License.
Pawel Zarembski 0:01f31e923fe2 11 * You may obtain a copy of the License at
Pawel Zarembski 0:01f31e923fe2 12 *
Pawel Zarembski 0:01f31e923fe2 13 * http://www.apache.org/licenses/LICENSE-2.0
Pawel Zarembski 0:01f31e923fe2 14 *
Pawel Zarembski 0:01f31e923fe2 15 * Unless required by applicable law or agreed to in writing, software
Pawel Zarembski 0:01f31e923fe2 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Pawel Zarembski 0:01f31e923fe2 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Pawel Zarembski 0:01f31e923fe2 18 * See the License for the specific language governing permissions and
Pawel Zarembski 0:01f31e923fe2 19 * limitations under the License.
Pawel Zarembski 0:01f31e923fe2 20 */
Pawel Zarembski 0:01f31e923fe2 21
Pawel Zarembski 0:01f31e923fe2 22 #ifndef __USB_DEF_H__
Pawel Zarembski 0:01f31e923fe2 23 #define __USB_DEF_H__
Pawel Zarembski 0:01f31e923fe2 24
Pawel Zarembski 0:01f31e923fe2 25 #pragma anon_unions
Pawel Zarembski 0:01f31e923fe2 26
Pawel Zarembski 0:01f31e923fe2 27 #include <stdint.h>
Pawel Zarembski 0:01f31e923fe2 28 #include <stddef.h>
Pawel Zarembski 0:01f31e923fe2 29
Pawel Zarembski 0:01f31e923fe2 30 #ifndef NULL
Pawel Zarembski 0:01f31e923fe2 31 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 32 #define NULL 0
Pawel Zarembski 0:01f31e923fe2 33 #else
Pawel Zarembski 0:01f31e923fe2 34 #define NULL ((void *) 0)
Pawel Zarembski 0:01f31e923fe2 35 #endif
Pawel Zarembski 0:01f31e923fe2 36 #endif
Pawel Zarembski 0:01f31e923fe2 37
Pawel Zarembski 0:01f31e923fe2 38 #ifndef EOF
Pawel Zarembski 0:01f31e923fe2 39 #define EOF (-1)
Pawel Zarembski 0:01f31e923fe2 40 #endif
Pawel Zarembski 0:01f31e923fe2 41
Pawel Zarembski 0:01f31e923fe2 42 #ifndef __size_t
Pawel Zarembski 0:01f31e923fe2 43 #define __size_t 1
Pawel Zarembski 0:01f31e923fe2 44 typedef unsigned int size_t;
Pawel Zarembski 0:01f31e923fe2 45 #endif
Pawel Zarembski 0:01f31e923fe2 46
Pawel Zarembski 0:01f31e923fe2 47 typedef signed char S8;
Pawel Zarembski 0:01f31e923fe2 48 typedef unsigned char U8;
Pawel Zarembski 0:01f31e923fe2 49 typedef short S16;
Pawel Zarembski 0:01f31e923fe2 50 typedef unsigned short U16;
Pawel Zarembski 0:01f31e923fe2 51 typedef int S32;
Pawel Zarembski 0:01f31e923fe2 52 typedef unsigned int U32;
Pawel Zarembski 0:01f31e923fe2 53 typedef long long S64;
Pawel Zarembski 0:01f31e923fe2 54 typedef unsigned long long U64;
Pawel Zarembski 0:01f31e923fe2 55 typedef unsigned char BIT;
Pawel Zarembski 0:01f31e923fe2 56 typedef unsigned int BOOL;
Pawel Zarembski 0:01f31e923fe2 57
Pawel Zarembski 0:01f31e923fe2 58 #ifndef __TRUE
Pawel Zarembski 0:01f31e923fe2 59 #define __TRUE 1
Pawel Zarembski 0:01f31e923fe2 60 #endif
Pawel Zarembski 0:01f31e923fe2 61 #ifndef __FALSE
Pawel Zarembski 0:01f31e923fe2 62 #define __FALSE 0
Pawel Zarembski 0:01f31e923fe2 63 #endif
Pawel Zarembski 0:01f31e923fe2 64
Pawel Zarembski 0:01f31e923fe2 65
Pawel Zarembski 0:01f31e923fe2 66 /* bmRequestType.Dir */
Pawel Zarembski 0:01f31e923fe2 67 #define REQUEST_HOST_TO_DEVICE 0
Pawel Zarembski 0:01f31e923fe2 68 #define REQUEST_DEVICE_TO_HOST 1
Pawel Zarembski 0:01f31e923fe2 69
Pawel Zarembski 0:01f31e923fe2 70 /* bmRequestType.Type */
Pawel Zarembski 0:01f31e923fe2 71 #define REQUEST_STANDARD 0
Pawel Zarembski 0:01f31e923fe2 72 #define REQUEST_CLASS 1
Pawel Zarembski 0:01f31e923fe2 73 #define REQUEST_VENDOR 2
Pawel Zarembski 0:01f31e923fe2 74 #define REQUEST_RESERVED 3
Pawel Zarembski 0:01f31e923fe2 75
Pawel Zarembski 0:01f31e923fe2 76 /* bmRequestType.Recipient */
Pawel Zarembski 0:01f31e923fe2 77 #define REQUEST_TO_DEVICE 0
Pawel Zarembski 0:01f31e923fe2 78 #define REQUEST_TO_INTERFACE 1
Pawel Zarembski 0:01f31e923fe2 79 #define REQUEST_TO_ENDPOINT 2
Pawel Zarembski 0:01f31e923fe2 80 #define REQUEST_TO_OTHER 3
Pawel Zarembski 0:01f31e923fe2 81
Pawel Zarembski 0:01f31e923fe2 82 /* bmRequestType Definition */
Pawel Zarembski 0:01f31e923fe2 83 typedef __packed struct _REQUEST_TYPE {
Pawel Zarembski 0:01f31e923fe2 84 U8 Recipient : 5; /* D4..0: Recipient */
Pawel Zarembski 0:01f31e923fe2 85 U8 Type : 2; /* D6..5: Type */
Pawel Zarembski 0:01f31e923fe2 86 U8 Dir : 1; /* D7: Data Phase Txsfer Direction */
Pawel Zarembski 0:01f31e923fe2 87 } REQUEST_TYPE;
Pawel Zarembski 0:01f31e923fe2 88
Pawel Zarembski 0:01f31e923fe2 89 /* USB Standard Request Codes */
Pawel Zarembski 0:01f31e923fe2 90 #define USB_REQUEST_GET_STATUS 0
Pawel Zarembski 0:01f31e923fe2 91 #define USB_REQUEST_CLEAR_FEATURE 1
Pawel Zarembski 0:01f31e923fe2 92 #define USB_REQUEST_SET_FEATURE 3
Pawel Zarembski 0:01f31e923fe2 93 #define USB_REQUEST_SET_ADDRESS 5
Pawel Zarembski 0:01f31e923fe2 94 #define USB_REQUEST_GET_DESCRIPTOR 6
Pawel Zarembski 0:01f31e923fe2 95 #define USB_REQUEST_SET_DESCRIPTOR 7
Pawel Zarembski 0:01f31e923fe2 96 #define USB_REQUEST_GET_CONFIGURATION 8
Pawel Zarembski 0:01f31e923fe2 97 #define USB_REQUEST_SET_CONFIGURATION 9
Pawel Zarembski 0:01f31e923fe2 98 #define USB_REQUEST_GET_INTERFACE 10
Pawel Zarembski 0:01f31e923fe2 99 #define USB_REQUEST_SET_INTERFACE 11
Pawel Zarembski 0:01f31e923fe2 100 #define USB_REQUEST_SYNC_FRAME 12
Pawel Zarembski 0:01f31e923fe2 101
Pawel Zarembski 0:01f31e923fe2 102 /* USB GET_STATUS Bit Values */
Pawel Zarembski 0:01f31e923fe2 103 #define USB_GETSTATUS_SELF_POWERED 0x01
Pawel Zarembski 0:01f31e923fe2 104 #define USB_GETSTATUS_REMOTE_WAKEUP 0x02
Pawel Zarembski 0:01f31e923fe2 105 #define USB_GETSTATUS_ENDPOINT_STALL 0x01
Pawel Zarembski 0:01f31e923fe2 106
Pawel Zarembski 0:01f31e923fe2 107 /* USB Standard Feature selectors */
Pawel Zarembski 0:01f31e923fe2 108 #define USB_FEATURE_ENDPOINT_STALL 0
Pawel Zarembski 0:01f31e923fe2 109 #define USB_FEATURE_REMOTE_WAKEUP 1
Pawel Zarembski 0:01f31e923fe2 110
Pawel Zarembski 0:01f31e923fe2 111 /* USB Default Control Pipe Setup Packet */
Pawel Zarembski 0:01f31e923fe2 112 typedef __packed struct _USB_SETUP_PACKET {
Pawel Zarembski 0:01f31e923fe2 113 REQUEST_TYPE bmRequestType; /* bmRequestType */
Pawel Zarembski 0:01f31e923fe2 114 U8 bRequest; /* bRequest */
Pawel Zarembski 0:01f31e923fe2 115 __packed union {
Pawel Zarembski 0:01f31e923fe2 116 U16 wValue; /* wValue */
Pawel Zarembski 0:01f31e923fe2 117 __packed struct {
Pawel Zarembski 0:01f31e923fe2 118 U8 wValueL;
Pawel Zarembski 0:01f31e923fe2 119 U8 wValueH;
Pawel Zarembski 0:01f31e923fe2 120 };
Pawel Zarembski 0:01f31e923fe2 121 };
Pawel Zarembski 0:01f31e923fe2 122 __packed union {
Pawel Zarembski 0:01f31e923fe2 123 U16 wIndex; /* wIndex */
Pawel Zarembski 0:01f31e923fe2 124 __packed struct {
Pawel Zarembski 0:01f31e923fe2 125 U8 wIndexL;
Pawel Zarembski 0:01f31e923fe2 126 U8 wIndexH;
Pawel Zarembski 0:01f31e923fe2 127 };
Pawel Zarembski 0:01f31e923fe2 128 };
Pawel Zarembski 0:01f31e923fe2 129 U16 wLength; /* wLength */
Pawel Zarembski 0:01f31e923fe2 130 } USB_SETUP_PACKET;
Pawel Zarembski 0:01f31e923fe2 131
Pawel Zarembski 0:01f31e923fe2 132
Pawel Zarembski 0:01f31e923fe2 133 /* USB Descriptor Types */
Pawel Zarembski 0:01f31e923fe2 134 #define USB_DEVICE_DESCRIPTOR_TYPE 1
Pawel Zarembski 0:01f31e923fe2 135 #define USB_CONFIGURATION_DESCRIPTOR_TYPE 2
Pawel Zarembski 0:01f31e923fe2 136 #define USB_STRING_DESCRIPTOR_TYPE 3
Pawel Zarembski 0:01f31e923fe2 137 #define USB_INTERFACE_DESCRIPTOR_TYPE 4
Pawel Zarembski 0:01f31e923fe2 138 #define USB_ENDPOINT_DESCRIPTOR_TYPE 5
Pawel Zarembski 0:01f31e923fe2 139 #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6
Pawel Zarembski 0:01f31e923fe2 140 #define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7
Pawel Zarembski 0:01f31e923fe2 141 #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8
Pawel Zarembski 0:01f31e923fe2 142 #define USB_OTG_DESCRIPTOR_TYPE 9
Pawel Zarembski 0:01f31e923fe2 143 #define USB_DEBUG_DESCRIPTOR_TYPE 10
Pawel Zarembski 0:01f31e923fe2 144 #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11
Pawel Zarembski 0:01f31e923fe2 145 #define USB_BINARY_OBJECT_STORE_DESCRIPTOR_TYPE 15
Pawel Zarembski 0:01f31e923fe2 146 #define USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE 16
Pawel Zarembski 0:01f31e923fe2 147
Pawel Zarembski 0:01f31e923fe2 148 /* USB Device Classes */
Pawel Zarembski 0:01f31e923fe2 149 #define USB_DEVICE_CLASS_RESERVED 0x00
Pawel Zarembski 0:01f31e923fe2 150 #define USB_DEVICE_CLASS_AUDIO 0x01
Pawel Zarembski 0:01f31e923fe2 151 #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
Pawel Zarembski 0:01f31e923fe2 152 #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
Pawel Zarembski 0:01f31e923fe2 153 #define USB_DEVICE_CLASS_MONITOR 0x04
Pawel Zarembski 0:01f31e923fe2 154 #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
Pawel Zarembski 0:01f31e923fe2 155 #define USB_DEVICE_CLASS_POWER 0x06
Pawel Zarembski 0:01f31e923fe2 156 #define USB_DEVICE_CLASS_PRINTER 0x07
Pawel Zarembski 0:01f31e923fe2 157 #define USB_DEVICE_CLASS_STORAGE 0x08
Pawel Zarembski 0:01f31e923fe2 158 #define USB_DEVICE_CLASS_HUB 0x09
Pawel Zarembski 0:01f31e923fe2 159 #define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF
Pawel Zarembski 0:01f31e923fe2 160 #define USB_DEVICE_CLASS_APPLICATION_SPECIFIC 0xFE
Pawel Zarembski 0:01f31e923fe2 161 #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
Pawel Zarembski 0:01f31e923fe2 162
Pawel Zarembski 0:01f31e923fe2 163 /* bmAttributes in Configuration Descriptor */
Pawel Zarembski 0:01f31e923fe2 164 #define USB_CONFIG_POWERED_MASK 0x40
Pawel Zarembski 0:01f31e923fe2 165 #define USB_CONFIG_BUS_POWERED 0x80
Pawel Zarembski 0:01f31e923fe2 166 #define USB_CONFIG_SELF_POWERED 0xC0
Pawel Zarembski 0:01f31e923fe2 167 #define USB_CONFIG_REMOTE_WAKEUP 0x20
Pawel Zarembski 0:01f31e923fe2 168
Pawel Zarembski 0:01f31e923fe2 169 /* bMaxPower in Configuration Descriptor */
Pawel Zarembski 0:01f31e923fe2 170 #define USB_CONFIG_POWER_MA(mA) ((mA)/2)
Pawel Zarembski 0:01f31e923fe2 171
Pawel Zarembski 0:01f31e923fe2 172 /* bEndpointAddress in Endpoint Descriptor */
Pawel Zarembski 0:01f31e923fe2 173 #define USB_ENDPOINT_DIRECTION_MASK 0x80
Pawel Zarembski 0:01f31e923fe2 174 #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00)
Pawel Zarembski 0:01f31e923fe2 175 #define USB_ENDPOINT_IN(addr) ((addr) | 0x80)
Pawel Zarembski 0:01f31e923fe2 176
Pawel Zarembski 0:01f31e923fe2 177 /* bmAttributes in Endpoint Descriptor */
Pawel Zarembski 0:01f31e923fe2 178 #define USB_ENDPOINT_TYPE_MASK 0x03
Pawel Zarembski 0:01f31e923fe2 179 #define USB_ENDPOINT_TYPE_CONTROL 0x00
Pawel Zarembski 0:01f31e923fe2 180 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
Pawel Zarembski 0:01f31e923fe2 181 #define USB_ENDPOINT_TYPE_BULK 0x02
Pawel Zarembski 0:01f31e923fe2 182 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
Pawel Zarembski 0:01f31e923fe2 183 #define USB_ENDPOINT_SYNC_MASK 0x0C
Pawel Zarembski 0:01f31e923fe2 184 #define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00
Pawel Zarembski 0:01f31e923fe2 185 #define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04
Pawel Zarembski 0:01f31e923fe2 186 #define USB_ENDPOINT_SYNC_ADAPTIVE 0x08
Pawel Zarembski 0:01f31e923fe2 187 #define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C
Pawel Zarembski 0:01f31e923fe2 188 #define USB_ENDPOINT_USAGE_MASK 0x30
Pawel Zarembski 0:01f31e923fe2 189 #define USB_ENDPOINT_USAGE_DATA 0x00
Pawel Zarembski 0:01f31e923fe2 190 #define USB_ENDPOINT_USAGE_FEEDBACK 0x10
Pawel Zarembski 0:01f31e923fe2 191 #define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20
Pawel Zarembski 0:01f31e923fe2 192 #define USB_ENDPOINT_USAGE_RESERVED 0x30
Pawel Zarembski 0:01f31e923fe2 193
Pawel Zarembski 0:01f31e923fe2 194 /* bDevCapabilityType in Device Capability Descriptor */
Pawel Zarembski 0:01f31e923fe2 195 #define USB_DEVICE_CAPABILITY_WIRELESS_USB 1
Pawel Zarembski 0:01f31e923fe2 196 #define USB_DEVICE_CAPABILITY_USB_2_0_EXTENSION 2
Pawel Zarembski 0:01f31e923fe2 197 #define USB_DEVICE_CAPABILITY_SUPERSPEED_USB 3
Pawel Zarembski 0:01f31e923fe2 198 #define USB_DEVICE_CAPABILITY_CONTAINER_ID 4
Pawel Zarembski 0:01f31e923fe2 199 #define USB_DEVICE_CAPABILITY_PLATFORM 5
Pawel Zarembski 0:01f31e923fe2 200 #define USB_DEVICE_CAPABILITY_POWER_DELIVERY_CAPABILITY 6
Pawel Zarembski 0:01f31e923fe2 201 #define USB_DEVICE_CAPABILITY_BATTERY_INFO_CAPABILITY 7
Pawel Zarembski 0:01f31e923fe2 202 #define USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_CAPABILITY 8
Pawel Zarembski 0:01f31e923fe2 203 #define USB_DEVICE_CAPABILITY_PD_PROVIDER_PORT_CAPABILITY 9
Pawel Zarembski 0:01f31e923fe2 204 #define USB_DEVICE_CAPABILITY_SUPERSPEED_PLUS 10
Pawel Zarembski 0:01f31e923fe2 205 #define USB_DEVICE_CAPABILITY_PRECISION_TIME_MEASUREMENT 11
Pawel Zarembski 0:01f31e923fe2 206 #define USB_DEVICE_CAPABILITY_WIRELESS_USB_EXT 12
Pawel Zarembski 0:01f31e923fe2 207
Pawel Zarembski 0:01f31e923fe2 208 /* USB Standard Device Descriptor */
Pawel Zarembski 0:01f31e923fe2 209 typedef __packed struct _USB_DEVICE_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 210 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 211 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 212 U16 bcdUSB;
Pawel Zarembski 0:01f31e923fe2 213 U8 bDeviceClass;
Pawel Zarembski 0:01f31e923fe2 214 U8 bDeviceSubClass;
Pawel Zarembski 0:01f31e923fe2 215 U8 bDeviceProtocol;
Pawel Zarembski 0:01f31e923fe2 216 U8 bMaxPacketSize0;
Pawel Zarembski 0:01f31e923fe2 217 U16 idVendor;
Pawel Zarembski 0:01f31e923fe2 218 U16 idProduct;
Pawel Zarembski 0:01f31e923fe2 219 U16 bcdDevice;
Pawel Zarembski 0:01f31e923fe2 220 U8 iManufacturer;
Pawel Zarembski 0:01f31e923fe2 221 U8 iProduct;
Pawel Zarembski 0:01f31e923fe2 222 U8 iSerialNumber;
Pawel Zarembski 0:01f31e923fe2 223 U8 bNumConfigurations;
Pawel Zarembski 0:01f31e923fe2 224 } USB_DEVICE_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 225
Pawel Zarembski 0:01f31e923fe2 226 /* USB 2.0 Device Qualifier Descriptor */
Pawel Zarembski 0:01f31e923fe2 227 typedef __packed struct _USB_DEVICE_QUALIFIER_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 228 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 229 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 230 U16 bcdUSB;
Pawel Zarembski 0:01f31e923fe2 231 U8 bDeviceClass;
Pawel Zarembski 0:01f31e923fe2 232 U8 bDeviceSubClass;
Pawel Zarembski 0:01f31e923fe2 233 U8 bDeviceProtocol;
Pawel Zarembski 0:01f31e923fe2 234 U8 bMaxPacketSize0;
Pawel Zarembski 0:01f31e923fe2 235 U8 bNumConfigurations;
Pawel Zarembski 0:01f31e923fe2 236 U8 bReserved;
Pawel Zarembski 0:01f31e923fe2 237 } USB_DEVICE_QUALIFIER_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 238
Pawel Zarembski 0:01f31e923fe2 239 /* USB Standard Configuration Descriptor */
Pawel Zarembski 0:01f31e923fe2 240 typedef __packed struct _USB_CONFIGURATION_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 241 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 242 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 243 U16 wTotalLength;
Pawel Zarembski 0:01f31e923fe2 244 U8 bNumInterfaces;
Pawel Zarembski 0:01f31e923fe2 245 U8 bConfigurationValue;
Pawel Zarembski 0:01f31e923fe2 246 U8 iConfiguration;
Pawel Zarembski 0:01f31e923fe2 247 U8 bmAttributes;
Pawel Zarembski 0:01f31e923fe2 248 U8 bMaxPower;
Pawel Zarembski 0:01f31e923fe2 249 } USB_CONFIGURATION_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 250
Pawel Zarembski 0:01f31e923fe2 251 /* USB Standard Interface Descriptor */
Pawel Zarembski 0:01f31e923fe2 252 typedef __packed struct _USB_INTERFACE_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 253 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 254 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 255 U8 bInterfaceNumber;
Pawel Zarembski 0:01f31e923fe2 256 U8 bAlternateSetting;
Pawel Zarembski 0:01f31e923fe2 257 U8 bNumEndpoints;
Pawel Zarembski 0:01f31e923fe2 258 U8 bInterfaceClass;
Pawel Zarembski 0:01f31e923fe2 259 U8 bInterfaceSubClass;
Pawel Zarembski 0:01f31e923fe2 260 U8 bInterfaceProtocol;
Pawel Zarembski 0:01f31e923fe2 261 U8 iInterface;
Pawel Zarembski 0:01f31e923fe2 262 } USB_INTERFACE_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 263
Pawel Zarembski 0:01f31e923fe2 264 /* USB Standard Endpoint Descriptor */
Pawel Zarembski 0:01f31e923fe2 265 typedef __packed struct _USB_ENDPOINT_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 266 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 267 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 268 U8 bEndpointAddress;
Pawel Zarembski 0:01f31e923fe2 269 U8 bmAttributes;
Pawel Zarembski 0:01f31e923fe2 270 U16 wMaxPacketSize;
Pawel Zarembski 0:01f31e923fe2 271 U8 bInterval;
Pawel Zarembski 0:01f31e923fe2 272 } USB_ENDPOINT_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 273
Pawel Zarembski 0:01f31e923fe2 274 /* USB String Descriptor */
Pawel Zarembski 0:01f31e923fe2 275 typedef __packed struct _USB_STRING_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 276 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 277 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 278 U16 bString/*[]*/;
Pawel Zarembski 0:01f31e923fe2 279 } USB_STRING_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 280
Pawel Zarembski 0:01f31e923fe2 281 /* USB Common Descriptor */
Pawel Zarembski 0:01f31e923fe2 282 typedef __packed struct _USB_COMMON_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 283 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 284 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 285 } USB_COMMON_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 286
Pawel Zarembski 0:01f31e923fe2 287 /* USB Interface Association Descriptor */
Pawel Zarembski 0:01f31e923fe2 288 typedef __packed struct _USB_INTERFACE_ASSOCIATION_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 289 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 290 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 291 U8 bFirstInterface;
Pawel Zarembski 0:01f31e923fe2 292 U8 bInterfaceCount;
Pawel Zarembski 0:01f31e923fe2 293 U8 bFunctionClass;
Pawel Zarembski 0:01f31e923fe2 294 U8 bFunctionSubclass;
Pawel Zarembski 0:01f31e923fe2 295 U8 bFunctionProtocol;
Pawel Zarembski 0:01f31e923fe2 296 U8 iFunction;
Pawel Zarembski 0:01f31e923fe2 297 } USB_INTERFACE_ASSOCIATION_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 298
Pawel Zarembski 0:01f31e923fe2 299 /* USB Binary Object Store Descriptor */
Pawel Zarembski 0:01f31e923fe2 300 typedef __packed struct _USB_BINARY_OBJECT_STORE_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 301 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 302 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 303 U16 wTotalLength;
Pawel Zarembski 0:01f31e923fe2 304 U8 bNumDeviceCaps;
Pawel Zarembski 0:01f31e923fe2 305 } USB_BINARY_OBJECT_STORE_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 306
Pawel Zarembski 0:01f31e923fe2 307 /* Union Functional Descriptor */
Pawel Zarembski 0:01f31e923fe2 308 typedef __packed struct _UNION_FUNCTIONAL_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 309 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 310 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 311 U8 bDescriptorSubtype;
Pawel Zarembski 0:01f31e923fe2 312 U8 bMasterInterface;
Pawel Zarembski 0:01f31e923fe2 313 U8 bSlaveInterface0;
Pawel Zarembski 0:01f31e923fe2 314 } UNION_FUNCTIONAL_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 315
Pawel Zarembski 0:01f31e923fe2 316 typedef __packed struct _WINUSB_FUNCTION_SUBSET_HEADER {
Pawel Zarembski 0:01f31e923fe2 317 U16 wLength;
Pawel Zarembski 0:01f31e923fe2 318 U16 wDescriptorType;
Pawel Zarembski 0:01f31e923fe2 319 U8 bFirstInterface;
Pawel Zarembski 0:01f31e923fe2 320 U8 bReserved;
Pawel Zarembski 0:01f31e923fe2 321 } WINUSB_FUNCTION_SUBSET_HEADER;
Pawel Zarembski 0:01f31e923fe2 322
Pawel Zarembski 0:01f31e923fe2 323 /* USB Device Capability Descriptor */
Pawel Zarembski 0:01f31e923fe2 324 typedef __packed struct _USB_DEVICE_CAPABILITY_DESCRIPTOR {
Pawel Zarembski 0:01f31e923fe2 325 U8 bLength;
Pawel Zarembski 0:01f31e923fe2 326 U8 bDescriptorType;
Pawel Zarembski 0:01f31e923fe2 327 U8 bDevCapabilityType;
Pawel Zarembski 0:01f31e923fe2 328 } USB_DEVICE_CAPABILITY_DESCRIPTOR;
Pawel Zarembski 0:01f31e923fe2 329
Pawel Zarembski 0:01f31e923fe2 330 #endif /* __USB_DEF_H__ */