JIAWEI ZHANG / Mbed 2 deprecated ele350ku

Dependencies:   mbed

Dependents:   Exercise8_1-2-3

Fork of ele350 by JIAWEI ZHANG

Committer:
GGHHHH
Date:
Tue Feb 23 16:16:34 2016 +0000
Revision:
65:9dbee72e3e6e
Parent:
60:868f113092d5
ok

Who changed what in which revision?

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