These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
USBDEV/USBHID/usb.h@0:bf7b9fba3924, 2011-03-20 (annotated)
- Committer:
- frank26080115
- Date:
- Sun Mar 20 05:38:56 2011 +0000
- Revision:
- 0:bf7b9fba3924
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frank26080115 | 0:bf7b9fba3924 | 1 | /*---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 2 | * U S B - K e r n e l |
frank26080115 | 0:bf7b9fba3924 | 3 | *---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 4 | * Name: USB.H |
frank26080115 | 0:bf7b9fba3924 | 5 | * Purpose: USB Definitions |
frank26080115 | 0:bf7b9fba3924 | 6 | * Version: V1.10 |
frank26080115 | 0:bf7b9fba3924 | 7 | *---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 8 | * This software is supplied "AS IS" without any warranties, express, |
frank26080115 | 0:bf7b9fba3924 | 9 | * implied or statutory, including but not limited to the implied |
frank26080115 | 0:bf7b9fba3924 | 10 | * warranties of fitness for purpose, satisfactory quality and |
frank26080115 | 0:bf7b9fba3924 | 11 | * noninfringement. Keil extends you a royalty-free right to reproduce |
frank26080115 | 0:bf7b9fba3924 | 12 | * and distribute executable files created using this software for use |
frank26080115 | 0:bf7b9fba3924 | 13 | * on NXP Semiconductors LPC family microcontroller devices only. Nothing |
frank26080115 | 0:bf7b9fba3924 | 14 | * else gives you the right to use this software. |
frank26080115 | 0:bf7b9fba3924 | 15 | * |
frank26080115 | 0:bf7b9fba3924 | 16 | * Copyright (c) 2005-2009 Keil Software. |
frank26080115 | 0:bf7b9fba3924 | 17 | *---------------------------------------------------------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 18 | |
frank26080115 | 0:bf7b9fba3924 | 19 | #ifndef __USB_H__ |
frank26080115 | 0:bf7b9fba3924 | 20 | #define __USB_H__ |
frank26080115 | 0:bf7b9fba3924 | 21 | |
frank26080115 | 0:bf7b9fba3924 | 22 | |
frank26080115 | 0:bf7b9fba3924 | 23 | #if defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 24 | #define __packed __attribute__((__packed__)) |
frank26080115 | 0:bf7b9fba3924 | 25 | #endif |
frank26080115 | 0:bf7b9fba3924 | 26 | |
frank26080115 | 0:bf7b9fba3924 | 27 | |
frank26080115 | 0:bf7b9fba3924 | 28 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 29 | typedef __packed union { |
frank26080115 | 0:bf7b9fba3924 | 30 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 31 | typedef union __packed { |
frank26080115 | 0:bf7b9fba3924 | 32 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 33 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 34 | typedef union { |
frank26080115 | 0:bf7b9fba3924 | 35 | #endif |
frank26080115 | 0:bf7b9fba3924 | 36 | uint16_t W; |
frank26080115 | 0:bf7b9fba3924 | 37 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 38 | __packed struct { |
frank26080115 | 0:bf7b9fba3924 | 39 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 40 | struct __packed { |
frank26080115 | 0:bf7b9fba3924 | 41 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 42 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 43 | struct { |
frank26080115 | 0:bf7b9fba3924 | 44 | #endif |
frank26080115 | 0:bf7b9fba3924 | 45 | uint8_t L; |
frank26080115 | 0:bf7b9fba3924 | 46 | uint8_t H; |
frank26080115 | 0:bf7b9fba3924 | 47 | } WB; |
frank26080115 | 0:bf7b9fba3924 | 48 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 49 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 50 | #endif |
frank26080115 | 0:bf7b9fba3924 | 51 | } WORD_BYTE; |
frank26080115 | 0:bf7b9fba3924 | 52 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 53 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 54 | #endif |
frank26080115 | 0:bf7b9fba3924 | 55 | |
frank26080115 | 0:bf7b9fba3924 | 56 | /* bmRequestType.Dir */ |
frank26080115 | 0:bf7b9fba3924 | 57 | #define REQUEST_HOST_TO_DEVICE 0 |
frank26080115 | 0:bf7b9fba3924 | 58 | #define REQUEST_DEVICE_TO_HOST 1 |
frank26080115 | 0:bf7b9fba3924 | 59 | |
frank26080115 | 0:bf7b9fba3924 | 60 | /* bmRequestType.Type */ |
frank26080115 | 0:bf7b9fba3924 | 61 | #define REQUEST_STANDARD 0 |
frank26080115 | 0:bf7b9fba3924 | 62 | #define REQUEST_CLASS 1 |
frank26080115 | 0:bf7b9fba3924 | 63 | #define REQUEST_VENDOR 2 |
frank26080115 | 0:bf7b9fba3924 | 64 | #define REQUEST_RESERVED 3 |
frank26080115 | 0:bf7b9fba3924 | 65 | |
frank26080115 | 0:bf7b9fba3924 | 66 | /* bmRequestType.Recipient */ |
frank26080115 | 0:bf7b9fba3924 | 67 | #define REQUEST_TO_DEVICE 0 |
frank26080115 | 0:bf7b9fba3924 | 68 | #define REQUEST_TO_INTERFACE 1 |
frank26080115 | 0:bf7b9fba3924 | 69 | #define REQUEST_TO_ENDPOINT 2 |
frank26080115 | 0:bf7b9fba3924 | 70 | #define REQUEST_TO_OTHER 3 |
frank26080115 | 0:bf7b9fba3924 | 71 | |
frank26080115 | 0:bf7b9fba3924 | 72 | /* bmRequestType Definition */ |
frank26080115 | 0:bf7b9fba3924 | 73 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 74 | typedef __packed union _REQUEST_TYPE { |
frank26080115 | 0:bf7b9fba3924 | 75 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 76 | typedef union __packed _REQUEST_TYPE { |
frank26080115 | 0:bf7b9fba3924 | 77 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 78 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 79 | typedef union _REQUEST_TYPE { |
frank26080115 | 0:bf7b9fba3924 | 80 | #endif |
frank26080115 | 0:bf7b9fba3924 | 81 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 82 | __packed struct _BM { |
frank26080115 | 0:bf7b9fba3924 | 83 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 84 | struct __packed _BM { |
frank26080115 | 0:bf7b9fba3924 | 85 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 86 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 87 | struct _BM { |
frank26080115 | 0:bf7b9fba3924 | 88 | #endif |
frank26080115 | 0:bf7b9fba3924 | 89 | uint8_t Recipient : 5; |
frank26080115 | 0:bf7b9fba3924 | 90 | uint8_t Type : 2; |
frank26080115 | 0:bf7b9fba3924 | 91 | uint8_t Dir : 1; |
frank26080115 | 0:bf7b9fba3924 | 92 | } BM; |
frank26080115 | 0:bf7b9fba3924 | 93 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 94 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 95 | #endif |
frank26080115 | 0:bf7b9fba3924 | 96 | uint8_t B; |
frank26080115 | 0:bf7b9fba3924 | 97 | } REQUEST_TYPE; |
frank26080115 | 0:bf7b9fba3924 | 98 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 99 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 100 | #endif |
frank26080115 | 0:bf7b9fba3924 | 101 | |
frank26080115 | 0:bf7b9fba3924 | 102 | /* USB Standard Request Codes */ |
frank26080115 | 0:bf7b9fba3924 | 103 | #define USB_REQUEST_GET_STATUS 0 |
frank26080115 | 0:bf7b9fba3924 | 104 | #define USB_REQUEST_CLEAR_FEATURE 1 |
frank26080115 | 0:bf7b9fba3924 | 105 | #define USB_REQUEST_SET_FEATURE 3 |
frank26080115 | 0:bf7b9fba3924 | 106 | #define USB_REQUEST_SET_ADDRESS 5 |
frank26080115 | 0:bf7b9fba3924 | 107 | #define USB_REQUEST_GET_DESCRIPTOR 6 |
frank26080115 | 0:bf7b9fba3924 | 108 | #define USB_REQUEST_SET_DESCRIPTOR 7 |
frank26080115 | 0:bf7b9fba3924 | 109 | #define USB_REQUEST_GET_CONFIGURATION 8 |
frank26080115 | 0:bf7b9fba3924 | 110 | #define USB_REQUEST_SET_CONFIGURATION 9 |
frank26080115 | 0:bf7b9fba3924 | 111 | #define USB_REQUEST_GET_INTERFACE 10 |
frank26080115 | 0:bf7b9fba3924 | 112 | #define USB_REQUEST_SET_INTERFACE 11 |
frank26080115 | 0:bf7b9fba3924 | 113 | #define USB_REQUEST_SYNC_FRAME 12 |
frank26080115 | 0:bf7b9fba3924 | 114 | |
frank26080115 | 0:bf7b9fba3924 | 115 | /* USB GET_STATUS Bit Values */ |
frank26080115 | 0:bf7b9fba3924 | 116 | #define USB_GETSTATUS_SELF_POWERED 0x01 |
frank26080115 | 0:bf7b9fba3924 | 117 | #define USB_GETSTATUS_REMOTE_WAKEUP 0x02 |
frank26080115 | 0:bf7b9fba3924 | 118 | #define USB_GETSTATUS_ENDPOINT_STALL 0x01 |
frank26080115 | 0:bf7b9fba3924 | 119 | |
frank26080115 | 0:bf7b9fba3924 | 120 | /* USB Standard Feature selectors */ |
frank26080115 | 0:bf7b9fba3924 | 121 | #define USB_FEATURE_ENDPOINT_STALL 0 |
frank26080115 | 0:bf7b9fba3924 | 122 | #define USB_FEATURE_REMOTE_WAKEUP 1 |
frank26080115 | 0:bf7b9fba3924 | 123 | |
frank26080115 | 0:bf7b9fba3924 | 124 | /* USB Default Control Pipe Setup Packet */ |
frank26080115 | 0:bf7b9fba3924 | 125 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 126 | typedef __packed struct _USB_SETUP_PACKET { |
frank26080115 | 0:bf7b9fba3924 | 127 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 128 | typedef struct __packed _USB_SETUP_PACKET { |
frank26080115 | 0:bf7b9fba3924 | 129 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 130 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 131 | typedef struct _USB_SETUP_PACKET { |
frank26080115 | 0:bf7b9fba3924 | 132 | #endif |
frank26080115 | 0:bf7b9fba3924 | 133 | REQUEST_TYPE bmRequestType; |
frank26080115 | 0:bf7b9fba3924 | 134 | uint8_t bRequest; |
frank26080115 | 0:bf7b9fba3924 | 135 | WORD_BYTE wValue; |
frank26080115 | 0:bf7b9fba3924 | 136 | WORD_BYTE wIndex; |
frank26080115 | 0:bf7b9fba3924 | 137 | uint16_t wLength; |
frank26080115 | 0:bf7b9fba3924 | 138 | } USB_SETUP_PACKET; |
frank26080115 | 0:bf7b9fba3924 | 139 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 140 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 141 | #endif |
frank26080115 | 0:bf7b9fba3924 | 142 | |
frank26080115 | 0:bf7b9fba3924 | 143 | /* USB Descriptor Types */ |
frank26080115 | 0:bf7b9fba3924 | 144 | #define USB_DEVICE_DESCRIPTOR_TYPE 1 |
frank26080115 | 0:bf7b9fba3924 | 145 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 |
frank26080115 | 0:bf7b9fba3924 | 146 | #define USB_STRING_DESCRIPTOR_TYPE 3 |
frank26080115 | 0:bf7b9fba3924 | 147 | #define USB_INTERFACE_DESCRIPTOR_TYPE 4 |
frank26080115 | 0:bf7b9fba3924 | 148 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 5 |
frank26080115 | 0:bf7b9fba3924 | 149 | #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6 |
frank26080115 | 0:bf7b9fba3924 | 150 | #define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7 |
frank26080115 | 0:bf7b9fba3924 | 151 | #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8 |
frank26080115 | 0:bf7b9fba3924 | 152 | #define USB_OTG_DESCRIPTOR_TYPE 9 |
frank26080115 | 0:bf7b9fba3924 | 153 | #define USB_DEBUG_DESCRIPTOR_TYPE 10 |
frank26080115 | 0:bf7b9fba3924 | 154 | #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11 |
frank26080115 | 0:bf7b9fba3924 | 155 | |
frank26080115 | 0:bf7b9fba3924 | 156 | /* USB Device Classes */ |
frank26080115 | 0:bf7b9fba3924 | 157 | #define USB_DEVICE_CLASS_RESERVED 0x00 |
frank26080115 | 0:bf7b9fba3924 | 158 | #define USB_DEVICE_CLASS_AUDIO 0x01 |
frank26080115 | 0:bf7b9fba3924 | 159 | #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 |
frank26080115 | 0:bf7b9fba3924 | 160 | #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 |
frank26080115 | 0:bf7b9fba3924 | 161 | #define USB_DEVICE_CLASS_MONITOR 0x04 |
frank26080115 | 0:bf7b9fba3924 | 162 | #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 |
frank26080115 | 0:bf7b9fba3924 | 163 | #define USB_DEVICE_CLASS_POWER 0x06 |
frank26080115 | 0:bf7b9fba3924 | 164 | #define USB_DEVICE_CLASS_PRINTER 0x07 |
frank26080115 | 0:bf7b9fba3924 | 165 | #define USB_DEVICE_CLASS_STORAGE 0x08 |
frank26080115 | 0:bf7b9fba3924 | 166 | #define USB_DEVICE_CLASS_HUB 0x09 |
frank26080115 | 0:bf7b9fba3924 | 167 | #define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF |
frank26080115 | 0:bf7b9fba3924 | 168 | #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF |
frank26080115 | 0:bf7b9fba3924 | 169 | |
frank26080115 | 0:bf7b9fba3924 | 170 | /* bmAttributes in Configuration Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 171 | #define USB_CONFIG_POWERED_MASK 0xC0 |
frank26080115 | 0:bf7b9fba3924 | 172 | #define USB_CONFIG_BUS_POWERED 0x80 |
frank26080115 | 0:bf7b9fba3924 | 173 | #define USB_CONFIG_SELF_POWERED 0xC0 |
frank26080115 | 0:bf7b9fba3924 | 174 | #define USB_CONFIG_REMOTE_WAKEUP 0x20 |
frank26080115 | 0:bf7b9fba3924 | 175 | |
frank26080115 | 0:bf7b9fba3924 | 176 | /* bMaxPower in Configuration Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 177 | #define USB_CONFIG_POWER_MA(mA) ((mA)/2) |
frank26080115 | 0:bf7b9fba3924 | 178 | |
frank26080115 | 0:bf7b9fba3924 | 179 | /* bEndpointAddress in Endpoint Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 180 | #define USB_ENDPOINT_DIRECTION_MASK 0x80 |
frank26080115 | 0:bf7b9fba3924 | 181 | #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) |
frank26080115 | 0:bf7b9fba3924 | 182 | #define USB_ENDPOINT_IN(addr) ((addr) | 0x80) |
frank26080115 | 0:bf7b9fba3924 | 183 | |
frank26080115 | 0:bf7b9fba3924 | 184 | /* bmAttributes in Endpoint Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 185 | #define USB_ENDPOINT_TYPE_MASK 0x03 |
frank26080115 | 0:bf7b9fba3924 | 186 | #define USB_ENDPOINT_TYPE_CONTROL 0x00 |
frank26080115 | 0:bf7b9fba3924 | 187 | #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 |
frank26080115 | 0:bf7b9fba3924 | 188 | #define USB_ENDPOINT_TYPE_BULK 0x02 |
frank26080115 | 0:bf7b9fba3924 | 189 | #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 |
frank26080115 | 0:bf7b9fba3924 | 190 | #define USB_ENDPOINT_SYNC_MASK 0x0C |
frank26080115 | 0:bf7b9fba3924 | 191 | #define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00 |
frank26080115 | 0:bf7b9fba3924 | 192 | #define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04 |
frank26080115 | 0:bf7b9fba3924 | 193 | #define USB_ENDPOINT_SYNC_ADAPTIVE 0x08 |
frank26080115 | 0:bf7b9fba3924 | 194 | #define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C |
frank26080115 | 0:bf7b9fba3924 | 195 | #define USB_ENDPOINT_USAGE_MASK 0x30 |
frank26080115 | 0:bf7b9fba3924 | 196 | #define USB_ENDPOINT_USAGE_DATA 0x00 |
frank26080115 | 0:bf7b9fba3924 | 197 | #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 |
frank26080115 | 0:bf7b9fba3924 | 198 | #define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20 |
frank26080115 | 0:bf7b9fba3924 | 199 | #define USB_ENDPOINT_USAGE_RESERVED 0x30 |
frank26080115 | 0:bf7b9fba3924 | 200 | |
frank26080115 | 0:bf7b9fba3924 | 201 | /* USB Standard Device Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 202 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 203 | typedef __packed struct _USB_DEVICE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 204 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 205 | typedef struct __packed _USB_DEVICE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 206 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 207 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 208 | typedef struct _USB_DEVICE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 209 | #endif |
frank26080115 | 0:bf7b9fba3924 | 210 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 211 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 212 | uint16_t bcdUSB; |
frank26080115 | 0:bf7b9fba3924 | 213 | uint8_t bDeviceClass; |
frank26080115 | 0:bf7b9fba3924 | 214 | uint8_t bDeviceSubClass; |
frank26080115 | 0:bf7b9fba3924 | 215 | uint8_t bDeviceProtocol; |
frank26080115 | 0:bf7b9fba3924 | 216 | uint8_t bMaxPacketSize0; |
frank26080115 | 0:bf7b9fba3924 | 217 | uint16_t idVendor; |
frank26080115 | 0:bf7b9fba3924 | 218 | uint16_t idProduct; |
frank26080115 | 0:bf7b9fba3924 | 219 | uint16_t bcdDevice; |
frank26080115 | 0:bf7b9fba3924 | 220 | uint8_t iManufacturer; |
frank26080115 | 0:bf7b9fba3924 | 221 | uint8_t iProduct; |
frank26080115 | 0:bf7b9fba3924 | 222 | uint8_t iSerialNumber; |
frank26080115 | 0:bf7b9fba3924 | 223 | uint8_t bNumConfigurations; |
frank26080115 | 0:bf7b9fba3924 | 224 | } USB_DEVICE_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 225 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 226 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 227 | #endif |
frank26080115 | 0:bf7b9fba3924 | 228 | |
frank26080115 | 0:bf7b9fba3924 | 229 | /* USB 2.0 Device Qualifier Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 230 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 231 | typedef __packed struct _USB_DEVICE_QUALIFIER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 232 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 233 | typedef struct __packed _USB_DEVICE_QUALIFIER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 234 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 235 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 236 | typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 237 | #endif |
frank26080115 | 0:bf7b9fba3924 | 238 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 239 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 240 | uint16_t bcdUSB; |
frank26080115 | 0:bf7b9fba3924 | 241 | uint8_t bDeviceClass; |
frank26080115 | 0:bf7b9fba3924 | 242 | uint8_t bDeviceSubClass; |
frank26080115 | 0:bf7b9fba3924 | 243 | uint8_t bDeviceProtocol; |
frank26080115 | 0:bf7b9fba3924 | 244 | uint8_t bMaxPacketSize0; |
frank26080115 | 0:bf7b9fba3924 | 245 | uint8_t bNumConfigurations; |
frank26080115 | 0:bf7b9fba3924 | 246 | uint8_t bReserved; |
frank26080115 | 0:bf7b9fba3924 | 247 | } USB_DEVICE_QUALIFIER_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 248 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 249 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 250 | #endif |
frank26080115 | 0:bf7b9fba3924 | 251 | |
frank26080115 | 0:bf7b9fba3924 | 252 | /* USB Standard Configuration Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 253 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 254 | typedef __packed struct _USB_CONFIGURATION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 255 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 256 | typedef struct __packed _USB_CONFIGURATION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 257 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 258 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 259 | typedef struct _USB_CONFIGURATION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 260 | #endif |
frank26080115 | 0:bf7b9fba3924 | 261 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 262 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 263 | uint16_t wTotalLength; |
frank26080115 | 0:bf7b9fba3924 | 264 | uint8_t bNumInterfaces; |
frank26080115 | 0:bf7b9fba3924 | 265 | uint8_t bConfigurationValue; |
frank26080115 | 0:bf7b9fba3924 | 266 | uint8_t iConfiguration; |
frank26080115 | 0:bf7b9fba3924 | 267 | uint8_t bmAttributes; |
frank26080115 | 0:bf7b9fba3924 | 268 | uint8_t bMaxPower; |
frank26080115 | 0:bf7b9fba3924 | 269 | } USB_CONFIGURATION_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 270 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 271 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 272 | #endif |
frank26080115 | 0:bf7b9fba3924 | 273 | |
frank26080115 | 0:bf7b9fba3924 | 274 | /* USB Standard Interface Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 275 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 276 | typedef __packed struct _USB_INTERFACE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 277 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 278 | typedef struct __packed _USB_INTERFACE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 279 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 280 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 281 | typedef struct _USB_INTERFACE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 282 | #endif |
frank26080115 | 0:bf7b9fba3924 | 283 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 284 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 285 | uint8_t bInterfaceNumber; |
frank26080115 | 0:bf7b9fba3924 | 286 | uint8_t bAlternateSetting; |
frank26080115 | 0:bf7b9fba3924 | 287 | uint8_t bNumEndpoints; |
frank26080115 | 0:bf7b9fba3924 | 288 | uint8_t bInterfaceClass; |
frank26080115 | 0:bf7b9fba3924 | 289 | uint8_t bInterfaceSubClass; |
frank26080115 | 0:bf7b9fba3924 | 290 | uint8_t bInterfaceProtocol; |
frank26080115 | 0:bf7b9fba3924 | 291 | uint8_t iInterface; |
frank26080115 | 0:bf7b9fba3924 | 292 | } USB_INTERFACE_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 293 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 294 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 295 | #endif |
frank26080115 | 0:bf7b9fba3924 | 296 | |
frank26080115 | 0:bf7b9fba3924 | 297 | /* USB Standard Endpoint Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 298 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 299 | typedef __packed struct _USB_ENDPOINT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 300 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 301 | typedef struct __packed _USB_ENDPOINT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 302 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 303 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 304 | typedef struct _USB_ENDPOINT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 305 | #endif |
frank26080115 | 0:bf7b9fba3924 | 306 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 307 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 308 | uint8_t bEndpointAddress; |
frank26080115 | 0:bf7b9fba3924 | 309 | uint8_t bmAttributes; |
frank26080115 | 0:bf7b9fba3924 | 310 | uint16_t wMaxPacketSize; |
frank26080115 | 0:bf7b9fba3924 | 311 | uint8_t bInterval; |
frank26080115 | 0:bf7b9fba3924 | 312 | } USB_ENDPOINT_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 313 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 314 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 315 | #endif |
frank26080115 | 0:bf7b9fba3924 | 316 | |
frank26080115 | 0:bf7b9fba3924 | 317 | /* USB String Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 318 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 319 | typedef __packed struct _USB_STRING_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 320 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 321 | typedef struct __packed _USB_STRING_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 322 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 323 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 324 | typedef struct _USB_STRING_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 325 | #endif |
frank26080115 | 0:bf7b9fba3924 | 326 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 327 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 328 | uint16_t bString/*[]*/; |
frank26080115 | 0:bf7b9fba3924 | 329 | } USB_STRING_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 330 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 331 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 332 | #endif |
frank26080115 | 0:bf7b9fba3924 | 333 | |
frank26080115 | 0:bf7b9fba3924 | 334 | /* USB Common Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 335 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 336 | typedef __packed struct _USB_COMMON_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 337 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 338 | typedef struct __packed _USB_COMMON_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 339 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 340 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 341 | typedef struct _USB_COMMON_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 342 | #endif |
frank26080115 | 0:bf7b9fba3924 | 343 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 344 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 345 | } USB_COMMON_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 346 | #ifdef __IAR_SYSTEMS_ICC__ |
frank26080115 | 0:bf7b9fba3924 | 347 | #pragma pack() |
frank26080115 | 0:bf7b9fba3924 | 348 | #endif |
frank26080115 | 0:bf7b9fba3924 | 349 | |
frank26080115 | 0:bf7b9fba3924 | 350 | #endif /* __USB_H__ */ |