USBMOUSE
Dependents: ESD_Project_USBMouse
USBDevice/USBDescriptor.h@0:78a4faee5b0f, 2015-12-13 (annotated)
- Committer:
- priyankapashte
- Date:
- Sun Dec 13 10:04:36 2015 +0000
- Revision:
- 0:78a4faee5b0f
USBMouse File has been modified;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
priyankapashte | 0:78a4faee5b0f | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
priyankapashte | 0:78a4faee5b0f | 2 | * |
priyankapashte | 0:78a4faee5b0f | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
priyankapashte | 0:78a4faee5b0f | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
priyankapashte | 0:78a4faee5b0f | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
priyankapashte | 0:78a4faee5b0f | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
priyankapashte | 0:78a4faee5b0f | 7 | * Software is furnished to do so, subject to the following conditions: |
priyankapashte | 0:78a4faee5b0f | 8 | * |
priyankapashte | 0:78a4faee5b0f | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
priyankapashte | 0:78a4faee5b0f | 10 | * substantial portions of the Software. |
priyankapashte | 0:78a4faee5b0f | 11 | * |
priyankapashte | 0:78a4faee5b0f | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
priyankapashte | 0:78a4faee5b0f | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
priyankapashte | 0:78a4faee5b0f | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
priyankapashte | 0:78a4faee5b0f | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
priyankapashte | 0:78a4faee5b0f | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
priyankapashte | 0:78a4faee5b0f | 17 | */ |
priyankapashte | 0:78a4faee5b0f | 18 | |
priyankapashte | 0:78a4faee5b0f | 19 | /* Standard descriptor types */ |
priyankapashte | 0:78a4faee5b0f | 20 | #define DEVICE_DESCRIPTOR (1) |
priyankapashte | 0:78a4faee5b0f | 21 | #define CONFIGURATION_DESCRIPTOR (2) |
priyankapashte | 0:78a4faee5b0f | 22 | #define STRING_DESCRIPTOR (3) |
priyankapashte | 0:78a4faee5b0f | 23 | #define INTERFACE_DESCRIPTOR (4) |
priyankapashte | 0:78a4faee5b0f | 24 | #define ENDPOINT_DESCRIPTOR (5) |
priyankapashte | 0:78a4faee5b0f | 25 | #define QUALIFIER_DESCRIPTOR (6) |
priyankapashte | 0:78a4faee5b0f | 26 | |
priyankapashte | 0:78a4faee5b0f | 27 | /* Standard descriptor lengths */ |
priyankapashte | 0:78a4faee5b0f | 28 | #define DEVICE_DESCRIPTOR_LENGTH (0x12) |
priyankapashte | 0:78a4faee5b0f | 29 | #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09) |
priyankapashte | 0:78a4faee5b0f | 30 | #define INTERFACE_DESCRIPTOR_LENGTH (0x09) |
priyankapashte | 0:78a4faee5b0f | 31 | #define ENDPOINT_DESCRIPTOR_LENGTH (0x07) |
priyankapashte | 0:78a4faee5b0f | 32 | |
priyankapashte | 0:78a4faee5b0f | 33 | |
priyankapashte | 0:78a4faee5b0f | 34 | /*string offset*/ |
priyankapashte | 0:78a4faee5b0f | 35 | #define STRING_OFFSET_LANGID (0) |
priyankapashte | 0:78a4faee5b0f | 36 | #define STRING_OFFSET_IMANUFACTURER (1) |
priyankapashte | 0:78a4faee5b0f | 37 | #define STRING_OFFSET_IPRODUCT (2) |
priyankapashte | 0:78a4faee5b0f | 38 | #define STRING_OFFSET_ISERIAL (3) |
priyankapashte | 0:78a4faee5b0f | 39 | #define STRING_OFFSET_ICONFIGURATION (4) |
priyankapashte | 0:78a4faee5b0f | 40 | #define STRING_OFFSET_IINTERFACE (5) |
priyankapashte | 0:78a4faee5b0f | 41 | |
priyankapashte | 0:78a4faee5b0f | 42 | /* USB Specification Release Number */ |
priyankapashte | 0:78a4faee5b0f | 43 | #define USB_VERSION_2_0 (0x0200) |
priyankapashte | 0:78a4faee5b0f | 44 | |
priyankapashte | 0:78a4faee5b0f | 45 | /* Least/Most significant byte of short integer */ |
priyankapashte | 0:78a4faee5b0f | 46 | #define LSB(n) ((n)&0xff) |
priyankapashte | 0:78a4faee5b0f | 47 | #define MSB(n) (((n)&0xff00)>>8) |
priyankapashte | 0:78a4faee5b0f | 48 | |
priyankapashte | 0:78a4faee5b0f | 49 | /* Convert physical endpoint number to descriptor endpoint number */ |
priyankapashte | 0:78a4faee5b0f | 50 | #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0)) |
priyankapashte | 0:78a4faee5b0f | 51 | |
priyankapashte | 0:78a4faee5b0f | 52 | /* bmAttributes in configuration descriptor */ |
priyankapashte | 0:78a4faee5b0f | 53 | /* C_RESERVED must always be set */ |
priyankapashte | 0:78a4faee5b0f | 54 | #define C_RESERVED (1U<<7) |
priyankapashte | 0:78a4faee5b0f | 55 | #define C_SELF_POWERED (1U<<6) |
priyankapashte | 0:78a4faee5b0f | 56 | #define C_REMOTE_WAKEUP (1U<<5) |
priyankapashte | 0:78a4faee5b0f | 57 | |
priyankapashte | 0:78a4faee5b0f | 58 | /* bMaxPower in configuration descriptor */ |
priyankapashte | 0:78a4faee5b0f | 59 | #define C_POWER(mA) ((mA)/2) |
priyankapashte | 0:78a4faee5b0f | 60 | |
priyankapashte | 0:78a4faee5b0f | 61 | /* bmAttributes in endpoint descriptor */ |
priyankapashte | 0:78a4faee5b0f | 62 | #define E_CONTROL (0x00) |
priyankapashte | 0:78a4faee5b0f | 63 | #define E_ISOCHRONOUS (0x01) |
priyankapashte | 0:78a4faee5b0f | 64 | #define E_BULK (0x02) |
priyankapashte | 0:78a4faee5b0f | 65 | #define E_INTERRUPT (0x03) |
priyankapashte | 0:78a4faee5b0f | 66 | |
priyankapashte | 0:78a4faee5b0f | 67 | /* For isochronous endpoints only: */ |
priyankapashte | 0:78a4faee5b0f | 68 | #define E_NO_SYNCHRONIZATION (0x00) |
priyankapashte | 0:78a4faee5b0f | 69 | #define E_ASYNCHRONOUS (0x04) |
priyankapashte | 0:78a4faee5b0f | 70 | #define E_ADAPTIVE (0x08) |
priyankapashte | 0:78a4faee5b0f | 71 | #define E_SYNCHRONOUS (0x0C) |
priyankapashte | 0:78a4faee5b0f | 72 | #define E_DATA (0x00) |
priyankapashte | 0:78a4faee5b0f | 73 | #define E_FEEDBACK (0x10) |
priyankapashte | 0:78a4faee5b0f | 74 | #define E_IMPLICIT_FEEDBACK (0x20) |