blablabla

Dependencies:   MAG3110 MMA8451Q SLCD- TSI USBDevice mbed

Committer:
Osator
Date:
Wed Apr 16 12:20:00 2014 +0000
Revision:
0:339b7abfa147
blablabla

Who changed what in which revision?

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