Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/

Fork of STM32_USBDevice by Bradley Scott

Committer:
Troels Nilsson
Date:
Wed Jul 25 14:04:48 2018 +0200
Revision:
79:d28244984385
Parent:
54:461d954eee6b
Merge feature_WebUSB into default

Who changed what in which revision?

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