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