Base station firmware

Committer:
Perijah
Date:
Tue May 24 13:16:55 2016 +0000
Revision:
0:ecc3925d3f8c
Base station firmware

Who changed what in which revision?

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