USBDevice for STM support

Dependents:   Nucleo_Usb_JoyMouse Nucleo_usbmouse ELEC350_1-referral-2018-usb-hid USBJoystick_HelloWorld2_wip ... more

This library contains all mbed usb device library (mbed-os\features\unsupported\USBDevice).

Committer:
frq08711@LMECWL0871.LME.ST.COM
Date:
Tue Mar 28 11:00:57 2017 +0200
Branch:
master
Revision:
4:50ec00aa4515
Parent:
1:2a3ae13b45ef
update for 5.4.2

Who changed what in which revision?

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