A copy of the mbed USBDevice with USBSerial library
Dependents: STM32L0_LoRa Smartage STM32L0_LoRa Turtle_RadioShuttle
targets/TARGET_NUVOTON/TARGET_NUC472/USBEndpoints_NUC472.h@8:961423d1da74, 2019-02-24 (annotated)
- 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?
User | Revision | Line number | New 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_EPX2EP(ep) ((ep == CEP) ? EP0OUT : ((ep) - EPA + EP1OUT)) |
Helmut64 | 0:a3ea811f80f2 | 20 | #define NU_EPL2EPH(ep) ((ep) - 1) |
Helmut64 | 0:a3ea811f80f2 | 21 | #define NU_EPH2EPL(ep) ((ep) + 1) |
Helmut64 | 0:a3ea811f80f2 | 22 | #define NU_EP_DIR_Pos 0 |
Helmut64 | 0:a3ea811f80f2 | 23 | #define NU_EP_DIR_Msk (1 << NU_EP_DIR_Pos) |
Helmut64 | 0:a3ea811f80f2 | 24 | #define NU_EP_DIR_OUT 0 |
Helmut64 | 0:a3ea811f80f2 | 25 | #define NU_EP_DIR_IN 1 |
Helmut64 | 0:a3ea811f80f2 | 26 | |
Helmut64 | 0:a3ea811f80f2 | 27 | #define NU_EP_TYPE(ep) (((ep) & NU_EP_TYPE_Msk) >> NU_EP_TYPE_Pos) |
Helmut64 | 0:a3ea811f80f2 | 28 | #define NU_EP_NUM(ep) (((ep) & NU_EP_NUM_Msk) >> NU_EP_NUM_Pos) |
Helmut64 | 0:a3ea811f80f2 | 29 | #define NU_EP_DIR(ep) (((ep) & NU_EP_DIR_Msk) >> NU_EP_DIR_Pos) |
Helmut64 | 0:a3ea811f80f2 | 30 | #define NU_EP_NUM_DIR(ep) ((NU_EP_NUM(ep) << 1) | NU_EP_DIR(ep)) |
Helmut64 | 0:a3ea811f80f2 | 31 | |
Helmut64 | 0:a3ea811f80f2 | 32 | #define NUMBER_OF_PHYSICAL_ENDPOINTS 12 |
Helmut64 | 0:a3ea811f80f2 | 33 | |
Helmut64 | 0:a3ea811f80f2 | 34 | #define EP0OUT (0) |
Helmut64 | 0:a3ea811f80f2 | 35 | #define EP0IN (1) |
Helmut64 | 0:a3ea811f80f2 | 36 | #define EP1OUT (2) |
Helmut64 | 0:a3ea811f80f2 | 37 | #define EP1IN (3) |
Helmut64 | 0:a3ea811f80f2 | 38 | #define EP2OUT (4) |
Helmut64 | 0:a3ea811f80f2 | 39 | #define EP2IN (5) |
Helmut64 | 0:a3ea811f80f2 | 40 | #define EP3OUT (6) |
Helmut64 | 0:a3ea811f80f2 | 41 | #define EP3IN (7) |
Helmut64 | 0:a3ea811f80f2 | 42 | #define EP4OUT (8) |
Helmut64 | 0:a3ea811f80f2 | 43 | #define EP4IN (9) |
Helmut64 | 0:a3ea811f80f2 | 44 | #define EP5OUT (10) |
Helmut64 | 0:a3ea811f80f2 | 45 | #define EP5IN (11) |
Helmut64 | 0:a3ea811f80f2 | 46 | #define EP6OUT (12) |
Helmut64 | 0:a3ea811f80f2 | 47 | #define EP6IN (13) |
Helmut64 | 0:a3ea811f80f2 | 48 | |
Helmut64 | 0:a3ea811f80f2 | 49 | /* Maximum Packet sizes */ |
Helmut64 | 0:a3ea811f80f2 | 50 | #define MAX_PACKET_SIZE_EP0 64 |
Helmut64 | 0:a3ea811f80f2 | 51 | #define MAX_PACKET_SIZE_EP1 64 |
Helmut64 | 0:a3ea811f80f2 | 52 | #define MAX_PACKET_SIZE_EP2 64 |
Helmut64 | 0:a3ea811f80f2 | 53 | #define MAX_PACKET_SIZE_EP3 0x60 |
Helmut64 | 0:a3ea811f80f2 | 54 | #define MAX_PACKET_SIZE_EP4 64 |
Helmut64 | 0:a3ea811f80f2 | 55 | #define MAX_PACKET_SIZE_EP5 64 |
Helmut64 | 0:a3ea811f80f2 | 56 | #define MAX_PACKET_SIZE_EP6 64 |
Helmut64 | 0:a3ea811f80f2 | 57 | #define MAX_PACKET_SIZE_EP7 64 |
Helmut64 | 0:a3ea811f80f2 | 58 | #define MAX_PACKET_SIZE_EP8 64 |
Helmut64 | 0:a3ea811f80f2 | 59 | #define MAX_PACKET_SIZE_EP9 64 |
Helmut64 | 0:a3ea811f80f2 | 60 | #define MAX_PACKET_SIZE_EP10 64 |
Helmut64 | 0:a3ea811f80f2 | 61 | #define MAX_PACKET_SIZE_EP11 64 |
Helmut64 | 0:a3ea811f80f2 | 62 | |
Helmut64 | 0:a3ea811f80f2 | 63 | /* Generic endpoints - intended to be portable accross devices */ |
Helmut64 | 0:a3ea811f80f2 | 64 | /* and be suitable for simple USB devices. */ |
Helmut64 | 0:a3ea811f80f2 | 65 | |
Helmut64 | 0:a3ea811f80f2 | 66 | /* Bulk endpoints */ |
Helmut64 | 0:a3ea811f80f2 | 67 | #define EPBULK_OUT EP5OUT |
Helmut64 | 0:a3ea811f80f2 | 68 | #define EPBULK_IN EP6IN |
Helmut64 | 0:a3ea811f80f2 | 69 | #define EPBULK_OUT_callback EP5_OUT_callback |
Helmut64 | 0:a3ea811f80f2 | 70 | #define EPBULK_IN_callback EP6_IN_callback |
Helmut64 | 0:a3ea811f80f2 | 71 | /* Interrupt endpoints */ |
Helmut64 | 0:a3ea811f80f2 | 72 | #define EPINT_OUT EP1OUT |
Helmut64 | 0:a3ea811f80f2 | 73 | #define EPINT_IN EP2IN |
Helmut64 | 0:a3ea811f80f2 | 74 | #define EPINT_OUT_callback EP1_OUT_callback |
Helmut64 | 0:a3ea811f80f2 | 75 | #define EPINT_IN_callback EP2_IN_callback |
Helmut64 | 0:a3ea811f80f2 | 76 | /* Isochronous endpoints */ |
Helmut64 | 0:a3ea811f80f2 | 77 | #define EPISO_OUT EP3OUT |
Helmut64 | 0:a3ea811f80f2 | 78 | #define EPISO_IN EP4IN |
Helmut64 | 0:a3ea811f80f2 | 79 | #define EPISO_OUT_callback EP3_OUT_callback |
Helmut64 | 0:a3ea811f80f2 | 80 | #define EPISO_IN_callback EP4_IN_callback |
Helmut64 | 0:a3ea811f80f2 | 81 | |
Helmut64 | 0:a3ea811f80f2 | 82 | #define MAX_PACKET_SIZE_EPBULK 64 |
Helmut64 | 0:a3ea811f80f2 | 83 | #define MAX_PACKET_SIZE_EPINT 64 |
Helmut64 | 0:a3ea811f80f2 | 84 | #define MAX_PACKET_SIZE_EPISO 1023 |
Helmut64 | 0:a3ea811f80f2 | 85 | |
Helmut64 | 0:a3ea811f80f2 | 86 | #define USBD_GET_EP_MAX_PAYLOAD(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAMPS + (uint32_t)((ep)*0x28)))) |
Helmut64 | 0:a3ea811f80f2 | 87 | #define USBD_GET_EP_DATA_COUNT(ep) ((*((__IO uint32_t *) ((uint32_t)&USBD->EPADATCNT + (uint32_t)((ep)*0x28)))) & 0xFFFFF) |
Helmut64 | 0:a3ea811f80f2 | 88 | #define USBD_SET_EP_SHORT_PACKET(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPARSPCTL + (uint32_t)((ep)*0x28))) = (*((__IO uint32_t *) ((uint32_t)&USBD->EPARSPCTL + (uint32_t)((ep)*0x28)))) & 0x10 | 0x40) |
Helmut64 | 0:a3ea811f80f2 | 89 | #define USBD_GET_EP_INT_EN(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAINTEN + (uint32_t)((ep)*0x28)))) |