SD card interface
USBDevice/USBDevice/USBDescriptor.h@0:22612ae617a0, 2012-10-08 (annotated)
- Committer:
- lharoon
- Date:
- Mon Oct 08 11:14:07 2012 +0000
- Revision:
- 0:22612ae617a0
1st edition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lharoon | 0:22612ae617a0 | 1 | /* USBDescriptor.h */ |
lharoon | 0:22612ae617a0 | 2 | /* Definitions and macros for constructing USB descriptors */ |
lharoon | 0:22612ae617a0 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
lharoon | 0:22612ae617a0 | 4 | |
lharoon | 0:22612ae617a0 | 5 | /* Standard descriptor types */ |
lharoon | 0:22612ae617a0 | 6 | #define DEVICE_DESCRIPTOR (1) |
lharoon | 0:22612ae617a0 | 7 | #define CONFIGURATION_DESCRIPTOR (2) |
lharoon | 0:22612ae617a0 | 8 | #define STRING_DESCRIPTOR (3) |
lharoon | 0:22612ae617a0 | 9 | #define INTERFACE_DESCRIPTOR (4) |
lharoon | 0:22612ae617a0 | 10 | #define ENDPOINT_DESCRIPTOR (5) |
lharoon | 0:22612ae617a0 | 11 | #define QUALIFIER_DESCRIPTOR (6) |
lharoon | 0:22612ae617a0 | 12 | |
lharoon | 0:22612ae617a0 | 13 | /* Standard descriptor lengths */ |
lharoon | 0:22612ae617a0 | 14 | #define DEVICE_DESCRIPTOR_LENGTH (0x12) |
lharoon | 0:22612ae617a0 | 15 | #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09) |
lharoon | 0:22612ae617a0 | 16 | #define INTERFACE_DESCRIPTOR_LENGTH (0x09) |
lharoon | 0:22612ae617a0 | 17 | #define ENDPOINT_DESCRIPTOR_LENGTH (0x07) |
lharoon | 0:22612ae617a0 | 18 | |
lharoon | 0:22612ae617a0 | 19 | |
lharoon | 0:22612ae617a0 | 20 | /*string offset*/ |
lharoon | 0:22612ae617a0 | 21 | #define STRING_OFFSET_LANGID (0) |
lharoon | 0:22612ae617a0 | 22 | #define STRING_OFFSET_IMANUFACTURER (1) |
lharoon | 0:22612ae617a0 | 23 | #define STRING_OFFSET_IPRODUCT (2) |
lharoon | 0:22612ae617a0 | 24 | #define STRING_OFFSET_ISERIAL (3) |
lharoon | 0:22612ae617a0 | 25 | #define STRING_OFFSET_ICONFIGURATION (4) |
lharoon | 0:22612ae617a0 | 26 | #define STRING_OFFSET_IINTERFACE (5) |
lharoon | 0:22612ae617a0 | 27 | |
lharoon | 0:22612ae617a0 | 28 | /* USB Specification Release Number */ |
lharoon | 0:22612ae617a0 | 29 | #define USB_VERSION_2_0 (0x0200) |
lharoon | 0:22612ae617a0 | 30 | |
lharoon | 0:22612ae617a0 | 31 | /* Least/Most significant byte of short integer */ |
lharoon | 0:22612ae617a0 | 32 | #define LSB(n) ((n)&0xff) |
lharoon | 0:22612ae617a0 | 33 | #define MSB(n) (((n)&0xff00)>>8) |
lharoon | 0:22612ae617a0 | 34 | |
lharoon | 0:22612ae617a0 | 35 | /* Convert physical endpoint number to descriptor endpoint number */ |
lharoon | 0:22612ae617a0 | 36 | #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0)) |
lharoon | 0:22612ae617a0 | 37 | |
lharoon | 0:22612ae617a0 | 38 | /* bmAttributes in configuration descriptor */ |
lharoon | 0:22612ae617a0 | 39 | /* C_RESERVED must always be set */ |
lharoon | 0:22612ae617a0 | 40 | #define C_RESERVED (1U<<7) |
lharoon | 0:22612ae617a0 | 41 | #define C_SELF_POWERED (1U<<6) |
lharoon | 0:22612ae617a0 | 42 | #define C_REMOTE_WAKEUP (1U<<5) |
lharoon | 0:22612ae617a0 | 43 | |
lharoon | 0:22612ae617a0 | 44 | /* bMaxPower in configuration descriptor */ |
lharoon | 0:22612ae617a0 | 45 | #define C_POWER(mA) ((mA)/2) |
lharoon | 0:22612ae617a0 | 46 | |
lharoon | 0:22612ae617a0 | 47 | /* bmAttributes in endpoint descriptor */ |
lharoon | 0:22612ae617a0 | 48 | #define E_CONTROL (0x00) |
lharoon | 0:22612ae617a0 | 49 | #define E_ISOCHRONOUS (0x01) |
lharoon | 0:22612ae617a0 | 50 | #define E_BULK (0x02) |
lharoon | 0:22612ae617a0 | 51 | #define E_INTERRUPT (0x03) |
lharoon | 0:22612ae617a0 | 52 | |
lharoon | 0:22612ae617a0 | 53 | /* For isochronous endpoints only: */ |
lharoon | 0:22612ae617a0 | 54 | #define E_NO_SYNCHRONIZATION (0x00) |
lharoon | 0:22612ae617a0 | 55 | #define E_ASYNCHRONOUS (0x04) |
lharoon | 0:22612ae617a0 | 56 | #define E_ADAPTIVE (0x08) |
lharoon | 0:22612ae617a0 | 57 | #define E_SYNCHRONOUS (0x0C) |
lharoon | 0:22612ae617a0 | 58 | #define E_DATA (0x00) |
lharoon | 0:22612ae617a0 | 59 | #define E_FEEDBACK (0x10) |
lharoon | 0:22612ae617a0 | 60 | #define E_IMPLICIT_FEEDBACK (0x20) |