works!

Dependencies:   mbed

Committer:
mjoun
Date:
Fri Feb 21 20:40:56 2020 +0000
Revision:
1:6e512faaa17c
works

Who changed what in which revision?

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