These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
USBDEV/USBMassStorage/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 | typedef __packed union { |
frank26080115 | 0:bf7b9fba3924 | 34 | #endif |
frank26080115 | 0:bf7b9fba3924 | 35 | uint16_t W; |
frank26080115 | 0:bf7b9fba3924 | 36 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 37 | __packed struct { |
frank26080115 | 0:bf7b9fba3924 | 38 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 39 | struct __packed { |
frank26080115 | 0:bf7b9fba3924 | 40 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 41 | __packed struct { |
frank26080115 | 0:bf7b9fba3924 | 42 | #endif |
frank26080115 | 0:bf7b9fba3924 | 43 | uint8_t L; |
frank26080115 | 0:bf7b9fba3924 | 44 | uint8_t H; |
frank26080115 | 0:bf7b9fba3924 | 45 | } WB; |
frank26080115 | 0:bf7b9fba3924 | 46 | } WORD_BYTE; |
frank26080115 | 0:bf7b9fba3924 | 47 | |
frank26080115 | 0:bf7b9fba3924 | 48 | |
frank26080115 | 0:bf7b9fba3924 | 49 | /* bmRequestType.Dir */ |
frank26080115 | 0:bf7b9fba3924 | 50 | #define REQUEST_HOST_TO_DEVICE 0 |
frank26080115 | 0:bf7b9fba3924 | 51 | #define REQUEST_DEVICE_TO_HOST 1 |
frank26080115 | 0:bf7b9fba3924 | 52 | |
frank26080115 | 0:bf7b9fba3924 | 53 | /* bmRequestType.Type */ |
frank26080115 | 0:bf7b9fba3924 | 54 | #define REQUEST_STANDARD 0 |
frank26080115 | 0:bf7b9fba3924 | 55 | #define REQUEST_CLASS 1 |
frank26080115 | 0:bf7b9fba3924 | 56 | #define REQUEST_VENDOR 2 |
frank26080115 | 0:bf7b9fba3924 | 57 | #define REQUEST_RESERVED 3 |
frank26080115 | 0:bf7b9fba3924 | 58 | |
frank26080115 | 0:bf7b9fba3924 | 59 | /* bmRequestType.Recipient */ |
frank26080115 | 0:bf7b9fba3924 | 60 | #define REQUEST_TO_DEVICE 0 |
frank26080115 | 0:bf7b9fba3924 | 61 | #define REQUEST_TO_INTERFACE 1 |
frank26080115 | 0:bf7b9fba3924 | 62 | #define REQUEST_TO_ENDPOINT 2 |
frank26080115 | 0:bf7b9fba3924 | 63 | #define REQUEST_TO_OTHER 3 |
frank26080115 | 0:bf7b9fba3924 | 64 | |
frank26080115 | 0:bf7b9fba3924 | 65 | /* bmRequestType Definition */ |
frank26080115 | 0:bf7b9fba3924 | 66 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 67 | typedef __packed union _REQUEST_TYPE { |
frank26080115 | 0:bf7b9fba3924 | 68 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 69 | typedef union __packed _REQUEST_TYPE { |
frank26080115 | 0:bf7b9fba3924 | 70 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 71 | typedef __packed union _REQUEST_TYPE { |
frank26080115 | 0:bf7b9fba3924 | 72 | #endif |
frank26080115 | 0:bf7b9fba3924 | 73 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 74 | __packed struct _BM { |
frank26080115 | 0:bf7b9fba3924 | 75 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 76 | struct __packed _BM { |
frank26080115 | 0:bf7b9fba3924 | 77 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 78 | __packed struct _BM { |
frank26080115 | 0:bf7b9fba3924 | 79 | #endif |
frank26080115 | 0:bf7b9fba3924 | 80 | uint8_t Recipient : 5; |
frank26080115 | 0:bf7b9fba3924 | 81 | uint8_t Type : 2; |
frank26080115 | 0:bf7b9fba3924 | 82 | uint8_t Dir : 1; |
frank26080115 | 0:bf7b9fba3924 | 83 | } BM; |
frank26080115 | 0:bf7b9fba3924 | 84 | uint8_t B; |
frank26080115 | 0:bf7b9fba3924 | 85 | } REQUEST_TYPE; |
frank26080115 | 0:bf7b9fba3924 | 86 | |
frank26080115 | 0:bf7b9fba3924 | 87 | /* USB Standard Request Codes */ |
frank26080115 | 0:bf7b9fba3924 | 88 | #define USB_REQUEST_GET_STATUS 0 |
frank26080115 | 0:bf7b9fba3924 | 89 | #define USB_REQUEST_CLEAR_FEATURE 1 |
frank26080115 | 0:bf7b9fba3924 | 90 | #define USB_REQUEST_SET_FEATURE 3 |
frank26080115 | 0:bf7b9fba3924 | 91 | #define USB_REQUEST_SET_ADDRESS 5 |
frank26080115 | 0:bf7b9fba3924 | 92 | #define USB_REQUEST_GET_DESCRIPTOR 6 |
frank26080115 | 0:bf7b9fba3924 | 93 | #define USB_REQUEST_SET_DESCRIPTOR 7 |
frank26080115 | 0:bf7b9fba3924 | 94 | #define USB_REQUEST_GET_CONFIGURATION 8 |
frank26080115 | 0:bf7b9fba3924 | 95 | #define USB_REQUEST_SET_CONFIGURATION 9 |
frank26080115 | 0:bf7b9fba3924 | 96 | #define USB_REQUEST_GET_INTERFACE 10 |
frank26080115 | 0:bf7b9fba3924 | 97 | #define USB_REQUEST_SET_INTERFACE 11 |
frank26080115 | 0:bf7b9fba3924 | 98 | #define USB_REQUEST_SYNC_FRAME 12 |
frank26080115 | 0:bf7b9fba3924 | 99 | |
frank26080115 | 0:bf7b9fba3924 | 100 | /* USB GET_STATUS Bit Values */ |
frank26080115 | 0:bf7b9fba3924 | 101 | #define USB_GETSTATUS_SELF_POWERED 0x01 |
frank26080115 | 0:bf7b9fba3924 | 102 | #define USB_GETSTATUS_REMOTE_WAKEUP 0x02 |
frank26080115 | 0:bf7b9fba3924 | 103 | #define USB_GETSTATUS_ENDPOINT_STALL 0x01 |
frank26080115 | 0:bf7b9fba3924 | 104 | |
frank26080115 | 0:bf7b9fba3924 | 105 | /* USB Standard Feature selectors */ |
frank26080115 | 0:bf7b9fba3924 | 106 | #define USB_FEATURE_ENDPOINT_STALL 0 |
frank26080115 | 0:bf7b9fba3924 | 107 | #define USB_FEATURE_REMOTE_WAKEUP 1 |
frank26080115 | 0:bf7b9fba3924 | 108 | |
frank26080115 | 0:bf7b9fba3924 | 109 | /* USB Default Control Pipe Setup Packet */ |
frank26080115 | 0:bf7b9fba3924 | 110 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 111 | typedef __packed struct _USB_SETUP_PACKET { |
frank26080115 | 0:bf7b9fba3924 | 112 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 113 | typedef struct __packed _USB_SETUP_PACKET { |
frank26080115 | 0:bf7b9fba3924 | 114 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 115 | typedef __packed struct _USB_SETUP_PACKET { |
frank26080115 | 0:bf7b9fba3924 | 116 | #endif |
frank26080115 | 0:bf7b9fba3924 | 117 | REQUEST_TYPE bmRequestType; |
frank26080115 | 0:bf7b9fba3924 | 118 | uint8_t bRequest; |
frank26080115 | 0:bf7b9fba3924 | 119 | WORD_BYTE wValue; |
frank26080115 | 0:bf7b9fba3924 | 120 | WORD_BYTE wIndex; |
frank26080115 | 0:bf7b9fba3924 | 121 | uint16_t wLength; |
frank26080115 | 0:bf7b9fba3924 | 122 | } USB_SETUP_PACKET; |
frank26080115 | 0:bf7b9fba3924 | 123 | |
frank26080115 | 0:bf7b9fba3924 | 124 | |
frank26080115 | 0:bf7b9fba3924 | 125 | /* USB Descriptor Types */ |
frank26080115 | 0:bf7b9fba3924 | 126 | #define USB_DEVICE_DESCRIPTOR_TYPE 1 |
frank26080115 | 0:bf7b9fba3924 | 127 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 |
frank26080115 | 0:bf7b9fba3924 | 128 | #define USB_STRING_DESCRIPTOR_TYPE 3 |
frank26080115 | 0:bf7b9fba3924 | 129 | #define USB_INTERFACE_DESCRIPTOR_TYPE 4 |
frank26080115 | 0:bf7b9fba3924 | 130 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 5 |
frank26080115 | 0:bf7b9fba3924 | 131 | #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6 |
frank26080115 | 0:bf7b9fba3924 | 132 | #define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7 |
frank26080115 | 0:bf7b9fba3924 | 133 | #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8 |
frank26080115 | 0:bf7b9fba3924 | 134 | #define USB_OTG_DESCRIPTOR_TYPE 9 |
frank26080115 | 0:bf7b9fba3924 | 135 | #define USB_DEBUG_DESCRIPTOR_TYPE 10 |
frank26080115 | 0:bf7b9fba3924 | 136 | #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11 |
frank26080115 | 0:bf7b9fba3924 | 137 | |
frank26080115 | 0:bf7b9fba3924 | 138 | /* USB Device Classes */ |
frank26080115 | 0:bf7b9fba3924 | 139 | #define USB_DEVICE_CLASS_RESERVED 0x00 |
frank26080115 | 0:bf7b9fba3924 | 140 | #define USB_DEVICE_CLASS_AUDIO 0x01 |
frank26080115 | 0:bf7b9fba3924 | 141 | #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 |
frank26080115 | 0:bf7b9fba3924 | 142 | #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 |
frank26080115 | 0:bf7b9fba3924 | 143 | #define USB_DEVICE_CLASS_MONITOR 0x04 |
frank26080115 | 0:bf7b9fba3924 | 144 | #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 |
frank26080115 | 0:bf7b9fba3924 | 145 | #define USB_DEVICE_CLASS_POWER 0x06 |
frank26080115 | 0:bf7b9fba3924 | 146 | #define USB_DEVICE_CLASS_PRINTER 0x07 |
frank26080115 | 0:bf7b9fba3924 | 147 | #define USB_DEVICE_CLASS_STORAGE 0x08 |
frank26080115 | 0:bf7b9fba3924 | 148 | #define USB_DEVICE_CLASS_HUB 0x09 |
frank26080115 | 0:bf7b9fba3924 | 149 | #define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF |
frank26080115 | 0:bf7b9fba3924 | 150 | #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF |
frank26080115 | 0:bf7b9fba3924 | 151 | |
frank26080115 | 0:bf7b9fba3924 | 152 | /* bmAttributes in Configuration Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 153 | #define USB_CONFIG_POWERED_MASK 0xC0 |
frank26080115 | 0:bf7b9fba3924 | 154 | #define USB_CONFIG_BUS_POWERED 0x80 |
frank26080115 | 0:bf7b9fba3924 | 155 | #define USB_CONFIG_SELF_POWERED 0xC0 |
frank26080115 | 0:bf7b9fba3924 | 156 | #define USB_CONFIG_REMOTE_WAKEUP 0x20 |
frank26080115 | 0:bf7b9fba3924 | 157 | |
frank26080115 | 0:bf7b9fba3924 | 158 | /* bMaxPower in Configuration Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 159 | #define USB_CONFIG_POWER_MA(mA) ((mA)/2) |
frank26080115 | 0:bf7b9fba3924 | 160 | |
frank26080115 | 0:bf7b9fba3924 | 161 | /* bEndpointAddress in Endpoint Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 162 | #define USB_ENDPOINT_DIRECTION_MASK 0x80 |
frank26080115 | 0:bf7b9fba3924 | 163 | #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) |
frank26080115 | 0:bf7b9fba3924 | 164 | #define USB_ENDPOINT_IN(addr) ((addr) | 0x80) |
frank26080115 | 0:bf7b9fba3924 | 165 | |
frank26080115 | 0:bf7b9fba3924 | 166 | /* bmAttributes in Endpoint Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 167 | #define USB_ENDPOINT_TYPE_MASK 0x03 |
frank26080115 | 0:bf7b9fba3924 | 168 | #define USB_ENDPOINT_TYPE_CONTROL 0x00 |
frank26080115 | 0:bf7b9fba3924 | 169 | #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 |
frank26080115 | 0:bf7b9fba3924 | 170 | #define USB_ENDPOINT_TYPE_BULK 0x02 |
frank26080115 | 0:bf7b9fba3924 | 171 | #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 |
frank26080115 | 0:bf7b9fba3924 | 172 | #define USB_ENDPOINT_SYNC_MASK 0x0C |
frank26080115 | 0:bf7b9fba3924 | 173 | #define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00 |
frank26080115 | 0:bf7b9fba3924 | 174 | #define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04 |
frank26080115 | 0:bf7b9fba3924 | 175 | #define USB_ENDPOINT_SYNC_ADAPTIVE 0x08 |
frank26080115 | 0:bf7b9fba3924 | 176 | #define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C |
frank26080115 | 0:bf7b9fba3924 | 177 | #define USB_ENDPOINT_USAGE_MASK 0x30 |
frank26080115 | 0:bf7b9fba3924 | 178 | #define USB_ENDPOINT_USAGE_DATA 0x00 |
frank26080115 | 0:bf7b9fba3924 | 179 | #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 |
frank26080115 | 0:bf7b9fba3924 | 180 | #define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20 |
frank26080115 | 0:bf7b9fba3924 | 181 | #define USB_ENDPOINT_USAGE_RESERVED 0x30 |
frank26080115 | 0:bf7b9fba3924 | 182 | |
frank26080115 | 0:bf7b9fba3924 | 183 | /* USB Standard Device Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 184 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 185 | typedef __packed struct _USB_DEVICE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 186 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 187 | typedef struct __packed _USB_DEVICE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 188 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 189 | typedef __packed struct _USB_DEVICE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 190 | #endif |
frank26080115 | 0:bf7b9fba3924 | 191 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 192 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 193 | uint16_t bcdUSB; |
frank26080115 | 0:bf7b9fba3924 | 194 | uint8_t bDeviceClass; |
frank26080115 | 0:bf7b9fba3924 | 195 | uint8_t bDeviceSubClass; |
frank26080115 | 0:bf7b9fba3924 | 196 | uint8_t bDeviceProtocol; |
frank26080115 | 0:bf7b9fba3924 | 197 | uint8_t bMaxPacketSize0; |
frank26080115 | 0:bf7b9fba3924 | 198 | uint16_t idVendor; |
frank26080115 | 0:bf7b9fba3924 | 199 | uint16_t idProduct; |
frank26080115 | 0:bf7b9fba3924 | 200 | uint16_t bcdDevice; |
frank26080115 | 0:bf7b9fba3924 | 201 | uint8_t iManufacturer; |
frank26080115 | 0:bf7b9fba3924 | 202 | uint8_t iProduct; |
frank26080115 | 0:bf7b9fba3924 | 203 | uint8_t iSerialNumber; |
frank26080115 | 0:bf7b9fba3924 | 204 | uint8_t bNumConfigurations; |
frank26080115 | 0:bf7b9fba3924 | 205 | } USB_DEVICE_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 206 | |
frank26080115 | 0:bf7b9fba3924 | 207 | /* USB 2.0 Device Qualifier Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 208 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 209 | typedef __packed struct _USB_DEVICE_QUALIFIER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 210 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 211 | typedef struct __packed _USB_DEVICE_QUALIFIER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 212 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 213 | typedef __packed struct _USB_DEVICE_QUALIFIER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 214 | #endif |
frank26080115 | 0:bf7b9fba3924 | 215 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 216 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 217 | uint16_t bcdUSB; |
frank26080115 | 0:bf7b9fba3924 | 218 | uint8_t bDeviceClass; |
frank26080115 | 0:bf7b9fba3924 | 219 | uint8_t bDeviceSubClass; |
frank26080115 | 0:bf7b9fba3924 | 220 | uint8_t bDeviceProtocol; |
frank26080115 | 0:bf7b9fba3924 | 221 | uint8_t bMaxPacketSize0; |
frank26080115 | 0:bf7b9fba3924 | 222 | uint8_t bNumConfigurations; |
frank26080115 | 0:bf7b9fba3924 | 223 | uint8_t bReserved; |
frank26080115 | 0:bf7b9fba3924 | 224 | } USB_DEVICE_QUALIFIER_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 225 | |
frank26080115 | 0:bf7b9fba3924 | 226 | /* USB Standard Configuration Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 227 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 228 | typedef __packed struct _USB_CONFIGURATION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 229 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 230 | typedef struct __packed _USB_CONFIGURATION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 231 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 232 | typedef __packed struct _USB_CONFIGURATION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 233 | #endif |
frank26080115 | 0:bf7b9fba3924 | 234 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 235 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 236 | uint16_t wTotalLength; |
frank26080115 | 0:bf7b9fba3924 | 237 | uint8_t bNumInterfaces; |
frank26080115 | 0:bf7b9fba3924 | 238 | uint8_t bConfigurationValue; |
frank26080115 | 0:bf7b9fba3924 | 239 | uint8_t iConfiguration; |
frank26080115 | 0:bf7b9fba3924 | 240 | uint8_t bmAttributes; |
frank26080115 | 0:bf7b9fba3924 | 241 | uint8_t bMaxPower; |
frank26080115 | 0:bf7b9fba3924 | 242 | } USB_CONFIGURATION_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 243 | |
frank26080115 | 0:bf7b9fba3924 | 244 | /* USB Standard Interface Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 245 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 246 | typedef __packed struct _USB_INTERFACE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 247 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 248 | typedef struct __packed _USB_INTERFACE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 249 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 250 | typedef __packed struct _USB_INTERFACE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 251 | #endif |
frank26080115 | 0:bf7b9fba3924 | 252 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 253 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 254 | uint8_t bInterfaceNumber; |
frank26080115 | 0:bf7b9fba3924 | 255 | uint8_t bAlternateSetting; |
frank26080115 | 0:bf7b9fba3924 | 256 | uint8_t bNumEndpoints; |
frank26080115 | 0:bf7b9fba3924 | 257 | uint8_t bInterfaceClass; |
frank26080115 | 0:bf7b9fba3924 | 258 | uint8_t bInterfaceSubClass; |
frank26080115 | 0:bf7b9fba3924 | 259 | uint8_t bInterfaceProtocol; |
frank26080115 | 0:bf7b9fba3924 | 260 | uint8_t iInterface; |
frank26080115 | 0:bf7b9fba3924 | 261 | } USB_INTERFACE_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 262 | |
frank26080115 | 0:bf7b9fba3924 | 263 | /* USB Standard Endpoint Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 264 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 265 | typedef __packed struct _USB_ENDPOINT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 266 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 267 | typedef struct __packed _USB_ENDPOINT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 268 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 269 | typedef __packed struct _USB_ENDPOINT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 270 | #endif |
frank26080115 | 0:bf7b9fba3924 | 271 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 272 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 273 | uint8_t bEndpointAddress; |
frank26080115 | 0:bf7b9fba3924 | 274 | uint8_t bmAttributes; |
frank26080115 | 0:bf7b9fba3924 | 275 | uint16_t wMaxPacketSize; |
frank26080115 | 0:bf7b9fba3924 | 276 | uint8_t bInterval; |
frank26080115 | 0:bf7b9fba3924 | 277 | } USB_ENDPOINT_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 278 | |
frank26080115 | 0:bf7b9fba3924 | 279 | /* USB String Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 280 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 281 | typedef __packed struct _USB_STRING_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 282 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 283 | typedef struct __packed _USB_STRING_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 284 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 285 | typedef __packed struct _USB_STRING_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 286 | #endif |
frank26080115 | 0:bf7b9fba3924 | 287 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 288 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 289 | uint16_t bString/*[]*/; |
frank26080115 | 0:bf7b9fba3924 | 290 | } USB_STRING_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 291 | |
frank26080115 | 0:bf7b9fba3924 | 292 | /* USB Common Descriptor */ |
frank26080115 | 0:bf7b9fba3924 | 293 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 294 | typedef __packed struct _USB_COMMON_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 295 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 296 | typedef struct __packed _USB_COMMON_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 297 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 298 | typedef __packed struct _USB_COMMON_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 299 | #endif |
frank26080115 | 0:bf7b9fba3924 | 300 | uint8_t bLength; |
frank26080115 | 0:bf7b9fba3924 | 301 | uint8_t bDescriptorType; |
frank26080115 | 0:bf7b9fba3924 | 302 | } USB_COMMON_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 303 | |
frank26080115 | 0:bf7b9fba3924 | 304 | |
frank26080115 | 0:bf7b9fba3924 | 305 | #endif /* __USB_H__ */ |