A copy of the mbed USBDevice with USBSerial library

Dependents:   STM32L0_LoRa Smartage STM32L0_LoRa Turtle_RadioShuttle

Committer:
Helmut Tschemernjak
Date:
Sun Feb 24 14:52:33 2019 +0100
Revision:
8:961423d1da74
Parent:
0:a3ea811f80f2
Added sleep manager support to avoids sleeps while a USB CDC
connection is active

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Helmut64 0:a3ea811f80f2 1 /* mbed Microcontroller Library
Helmut64 0:a3ea811f80f2 2 * Copyright (c) 2015-2016 Nuvoton
Helmut64 0:a3ea811f80f2 3 *
Helmut64 0:a3ea811f80f2 4 * Licensed under the Apache License, Version 2.0 (the "License");
Helmut64 0:a3ea811f80f2 5 * you may not use this file except in compliance with the License.
Helmut64 0:a3ea811f80f2 6 * You may obtain a copy of the License at
Helmut64 0:a3ea811f80f2 7 *
Helmut64 0:a3ea811f80f2 8 * http://www.apache.org/licenses/LICENSE-2.0
Helmut64 0:a3ea811f80f2 9 *
Helmut64 0:a3ea811f80f2 10 * Unless required by applicable law or agreed to in writing, software
Helmut64 0:a3ea811f80f2 11 * distributed under the License is distributed on an "AS IS" BASIS,
Helmut64 0:a3ea811f80f2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Helmut64 0:a3ea811f80f2 13 * See the License for the specific language governing permissions and
Helmut64 0:a3ea811f80f2 14 * limitations under the License.
Helmut64 0:a3ea811f80f2 15 */
Helmut64 0:a3ea811f80f2 16 #define NU_MAX_EPX_BUFSIZE 4096
Helmut64 0:a3ea811f80f2 17 #define NU_EP2EPL(ep) ((ep) >> 1)
Helmut64 0:a3ea811f80f2 18 #define NU_EP2EPH(ep) (((ep) >> 1) + 1)
Helmut64 0:a3ea811f80f2 19 #define NU_EPL2EPH(ep) ((ep) + 1)
Helmut64 0:a3ea811f80f2 20 #define NU_EPH2EPL(ep) ((ep) - 1)
Helmut64 0:a3ea811f80f2 21 #define NU_EP_DIR_Pos 0
Helmut64 0:a3ea811f80f2 22 #define NU_EP_DIR_Msk (1 << NU_EP_DIR_Pos)
Helmut64 0:a3ea811f80f2 23 #define NU_EP_DIR_OUT 0
Helmut64 0:a3ea811f80f2 24 #define NU_EP_DIR_IN 1
Helmut64 0:a3ea811f80f2 25
Helmut64 0:a3ea811f80f2 26 #define NU_EP_TYPE(ep) (((ep) & NU_EP_TYPE_Msk) >> NU_EP_TYPE_Pos)
Helmut64 0:a3ea811f80f2 27 #define NU_EP_NUM(ep) (((ep) & NU_EP_NUM_Msk) >> NU_EP_NUM_Pos)
Helmut64 0:a3ea811f80f2 28 #define NU_EP_DIR(ep) (((ep) & NU_EP_DIR_Msk) >> NU_EP_DIR_Pos)
Helmut64 0:a3ea811f80f2 29 #define NU_EP_NUM_DIR(ep) ((NU_EP_NUM(ep) << 1) | NU_EP_DIR(ep))
Helmut64 0:a3ea811f80f2 30
Helmut64 0:a3ea811f80f2 31 #define NUMBER_OF_PHYSICAL_ENDPOINTS 8
Helmut64 0:a3ea811f80f2 32 #define EP0OUT (0)
Helmut64 0:a3ea811f80f2 33 #define EP0IN (1)
Helmut64 0:a3ea811f80f2 34 #define EP1OUT (2)
Helmut64 0:a3ea811f80f2 35 #define EP1IN (3)
Helmut64 0:a3ea811f80f2 36 #define EP2OUT (4)
Helmut64 0:a3ea811f80f2 37 #define EP2IN (5)
Helmut64 0:a3ea811f80f2 38 #define EP3OUT (6)
Helmut64 0:a3ea811f80f2 39 #define EP3IN (7)
Helmut64 0:a3ea811f80f2 40 #define EP4OUT (8)
Helmut64 0:a3ea811f80f2 41 #define EP4IN (9)
Helmut64 0:a3ea811f80f2 42 #define EP5OUT (10)
Helmut64 0:a3ea811f80f2 43 #define EP5IN (11)
Helmut64 0:a3ea811f80f2 44 #define EP6OUT (12)
Helmut64 0:a3ea811f80f2 45 #define EP6IN (13)
Helmut64 0:a3ea811f80f2 46
Helmut64 0:a3ea811f80f2 47 /* Maximum Packet sizes */
Helmut64 0:a3ea811f80f2 48 #define MAX_PACKET_SIZE_EP0 64
Helmut64 0:a3ea811f80f2 49 #define MAX_PACKET_SIZE_EP1 64
Helmut64 0:a3ea811f80f2 50 #define MAX_PACKET_SIZE_EP2 64
Helmut64 0:a3ea811f80f2 51 #define MAX_PACKET_SIZE_EP3 0x60
Helmut64 0:a3ea811f80f2 52 #define MAX_PACKET_SIZE_EP4 64
Helmut64 0:a3ea811f80f2 53 #define MAX_PACKET_SIZE_EP5 64
Helmut64 0:a3ea811f80f2 54 #define MAX_PACKET_SIZE_EP6 64
Helmut64 0:a3ea811f80f2 55 #define MAX_PACKET_SIZE_EP7 64
Helmut64 0:a3ea811f80f2 56
Helmut64 0:a3ea811f80f2 57 /* Generic endpoints - intended to be portable accross devices */
Helmut64 0:a3ea811f80f2 58 /* and be suitable for simple USB devices. */
Helmut64 0:a3ea811f80f2 59
Helmut64 0:a3ea811f80f2 60 /* Bulk endpoints */
Helmut64 0:a3ea811f80f2 61 #define EPBULK_OUT EP5OUT
Helmut64 0:a3ea811f80f2 62 #define EPBULK_IN EP6IN
Helmut64 0:a3ea811f80f2 63 #define EPBULK_OUT_callback EP5_OUT_callback
Helmut64 0:a3ea811f80f2 64 #define EPBULK_IN_callback EP6_IN_callback
Helmut64 0:a3ea811f80f2 65 /* Interrupt endpoints */
Helmut64 0:a3ea811f80f2 66 #define EPINT_OUT EP1OUT
Helmut64 0:a3ea811f80f2 67 #define EPINT_IN EP2IN
Helmut64 0:a3ea811f80f2 68 #define EPINT_OUT_callback EP1_OUT_callback
Helmut64 0:a3ea811f80f2 69 #define EPINT_IN_callback EP2_IN_callback
Helmut64 0:a3ea811f80f2 70 /* Isochronous endpoints */
Helmut64 0:a3ea811f80f2 71 #define EPISO_OUT EP3OUT
Helmut64 0:a3ea811f80f2 72 #define EPISO_IN EP4IN
Helmut64 0:a3ea811f80f2 73 #define EPISO_OUT_callback EP3_OUT_callback
Helmut64 0:a3ea811f80f2 74 #define EPISO_IN_callback EP4_IN_callback
Helmut64 0:a3ea811f80f2 75
Helmut64 0:a3ea811f80f2 76 #define MAX_PACKET_SIZE_EPBULK 64
Helmut64 0:a3ea811f80f2 77 #define MAX_PACKET_SIZE_EPINT 64
Helmut64 0:a3ea811f80f2 78 #define MAX_PACKET_SIZE_EPISO 1023
Helmut64 0:a3ea811f80f2 79