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 /*******************************************************************************
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 2 * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 3 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 4 * Permission is hereby granted, free of charge, to any person obtaining a
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 5 * copy of this software and associated documentation files (the "Software"),
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 6 * to deal in the Software without restriction, including without limitation
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 8 * and/or sell copies of the Software, and to permit persons to whom the
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 9 * Software is furnished to do so, subject to the following conditions:
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 10 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 11 * The above copyright notice and this permission notice shall be included
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 12 * in all copies or substantial portions of the Software.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 13 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 20 * OTHER DEALINGS IN THE SOFTWARE.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 21 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 22 * Except as contained in this notice, the name of Maxim Integrated
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 24 * Products, Inc. Branding Policy.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 25 *
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 26 * The mere transfer of this software does not imply any licenses
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 27 * of trade secrets, proprietary technology, copyrights, patents,
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 28 * trademarks, maskwork rights, or any other form of intellectual
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 30 * ownership rights.
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 31 *******************************************************************************
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 32 */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 33
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 34 #define NUMBER_OF_LOGICAL_ENDPOINTS (8)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 35 #define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 36
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 37 #define DIR_OUT 0x00
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 38 #define DIR_IN 0x01
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 39 #define EP_NUM(ep) (ep >> 1)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 40 #define IN_EP(ep) (ep & DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 41 #define OUT_EP(ep) (!(ep & DIR_IN))
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 42
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 43 /* Define physical endpoint numbers */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 44
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 45 /* Endpoint No. */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 46 /* ---------------- */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 47 #define EP0OUT ((0 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 48 #define EP0IN ((0 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 49 #define EP1OUT ((1 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 50 #define EP1IN ((1 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 51 #define EP2OUT ((2 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 52 #define EP2IN ((2 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 53 #define EP3OUT ((3 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 54 #define EP3IN ((3 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 55 #define EP4OUT ((4 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 56 #define EP4IN ((4 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 57 #define EP5OUT ((5 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 58 #define EP5IN ((5 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 59 #define EP6OUT ((6 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 60 #define EP6IN ((6 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 61 #define EP7OUT ((7 << 1) | DIR_OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 62 #define EP7IN ((7 << 1) | DIR_IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 63
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 64 /* Maximum Packet sizes */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 65
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 66 #define MAX_PACKET_SIZE_EP0 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 67 #define MAX_PACKET_SIZE_EP1 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 68 #define MAX_PACKET_SIZE_EP2 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 69 #define MAX_PACKET_SIZE_EP3 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 70 #define MAX_PACKET_SIZE_EP4 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 71 #define MAX_PACKET_SIZE_EP5 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 72 #define MAX_PACKET_SIZE_EP6 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 73 #define MAX_PACKET_SIZE_EP7 (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 74
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 75 /* Generic endpoints - intended to be portable accross devices */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 76 /* and be suitable for simple USB devices. */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 77
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 78 /* Bulk endpoints */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 79 #define EPBULK_OUT (EP1OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 80 #define EPBULK_IN (EP2IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 81 #define EPBULK_OUT_callback EP1_OUT_callback
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 82 #define EPBULK_IN_callback EP2_IN_callback
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 83 /* Interrupt endpoints */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 84 #define EPINT_OUT (EP3OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 85 #define EPINT_IN (EP4IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 86 #define EPINT_OUT_callback EP3_OUT_callback
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 87 #define EPINT_IN_callback EP4_IN_callback
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 88 /* Isochronous endpoints */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 89 /* NOT SUPPORTED - use invalid endpoint number to prevent built errors */
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 90 #define EPISO_OUT (EP0OUT)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 91 #define EPISO_IN (EP0IN)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 92
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 93 #define MAX_PACKET_SIZE_EPBULK (64)
frq08711@LMECWL0871.LME.ST.COM 1:2a3ae13b45ef 94 #define MAX_PACKET_SIZE_EPINT (64)