USB device stack that isn't working
Fork of USBDevice by
targets/TARGET_NUVOTON/TARGET_NUC472/USBEndpoints_NUC472.h@71:53949e6131f6, 2017-07-27 (annotated)
- Committer:
- Kojto
- Date:
- Thu Jul 27 12:14:04 2017 +0100
- Revision:
- 71:53949e6131f6
Update libraries
Fixes the previous commmit, as some devices were not copied. USBDevice contains
now targets directory with all targets implementations
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 71:53949e6131f6 | 1 | /* mbed Microcontroller Library |
Kojto | 71:53949e6131f6 | 2 | * Copyright (c) 2015-2016 Nuvoton |
Kojto | 71:53949e6131f6 | 3 | * |
Kojto | 71:53949e6131f6 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Kojto | 71:53949e6131f6 | 5 | * you may not use this file except in compliance with the License. |
Kojto | 71:53949e6131f6 | 6 | * You may obtain a copy of the License at |
Kojto | 71:53949e6131f6 | 7 | * |
Kojto | 71:53949e6131f6 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Kojto | 71:53949e6131f6 | 9 | * |
Kojto | 71:53949e6131f6 | 10 | * Unless required by applicable law or agreed to in writing, software |
Kojto | 71:53949e6131f6 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Kojto | 71:53949e6131f6 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Kojto | 71:53949e6131f6 | 13 | * See the License for the specific language governing permissions and |
Kojto | 71:53949e6131f6 | 14 | * limitations under the License. |
Kojto | 71:53949e6131f6 | 15 | */ |
Kojto | 71:53949e6131f6 | 16 | #define NU_MAX_EPX_BUFSIZE 4096 |
Kojto | 71:53949e6131f6 | 17 | #define NU_EP2EPL(ep) ((ep) >> 1) |
Kojto | 71:53949e6131f6 | 18 | #define NU_EP2EPH(ep) (((ep) >> 1) - 1) |
Kojto | 71:53949e6131f6 | 19 | #define NU_EPX2EP(ep) ((ep == CEP) ? EP0OUT : ((ep) - EPA + EP1OUT)) |
Kojto | 71:53949e6131f6 | 20 | #define NU_EPL2EPH(ep) ((ep) - 1) |
Kojto | 71:53949e6131f6 | 21 | #define NU_EPH2EPL(ep) ((ep) + 1) |
Kojto | 71:53949e6131f6 | 22 | #define NU_EP_DIR_Pos 0 |
Kojto | 71:53949e6131f6 | 23 | #define NU_EP_DIR_Msk (1 << NU_EP_DIR_Pos) |
Kojto | 71:53949e6131f6 | 24 | #define NU_EP_DIR_OUT 0 |
Kojto | 71:53949e6131f6 | 25 | #define NU_EP_DIR_IN 1 |
Kojto | 71:53949e6131f6 | 26 | |
Kojto | 71:53949e6131f6 | 27 | #define NU_EP_TYPE(ep) (((ep) & NU_EP_TYPE_Msk) >> NU_EP_TYPE_Pos) |
Kojto | 71:53949e6131f6 | 28 | #define NU_EP_NUM(ep) (((ep) & NU_EP_NUM_Msk) >> NU_EP_NUM_Pos) |
Kojto | 71:53949e6131f6 | 29 | #define NU_EP_DIR(ep) (((ep) & NU_EP_DIR_Msk) >> NU_EP_DIR_Pos) |
Kojto | 71:53949e6131f6 | 30 | #define NU_EP_NUM_DIR(ep) ((NU_EP_NUM(ep) << 1) | NU_EP_DIR(ep)) |
Kojto | 71:53949e6131f6 | 31 | |
Kojto | 71:53949e6131f6 | 32 | #define NUMBER_OF_PHYSICAL_ENDPOINTS 12 |
Kojto | 71:53949e6131f6 | 33 | |
Kojto | 71:53949e6131f6 | 34 | #define EP0OUT (0) |
Kojto | 71:53949e6131f6 | 35 | #define EP0IN (1) |
Kojto | 71:53949e6131f6 | 36 | #define EP1OUT (2) |
Kojto | 71:53949e6131f6 | 37 | #define EP1IN (3) |
Kojto | 71:53949e6131f6 | 38 | #define EP2OUT (4) |
Kojto | 71:53949e6131f6 | 39 | #define EP2IN (5) |
Kojto | 71:53949e6131f6 | 40 | #define EP3OUT (6) |
Kojto | 71:53949e6131f6 | 41 | #define EP3IN (7) |
Kojto | 71:53949e6131f6 | 42 | #define EP4OUT (8) |
Kojto | 71:53949e6131f6 | 43 | #define EP4IN (9) |
Kojto | 71:53949e6131f6 | 44 | #define EP5OUT (10) |
Kojto | 71:53949e6131f6 | 45 | #define EP5IN (11) |
Kojto | 71:53949e6131f6 | 46 | #define EP6OUT (12) |
Kojto | 71:53949e6131f6 | 47 | #define EP6IN (13) |
Kojto | 71:53949e6131f6 | 48 | |
Kojto | 71:53949e6131f6 | 49 | /* Maximum Packet sizes */ |
Kojto | 71:53949e6131f6 | 50 | #define MAX_PACKET_SIZE_EP0 64 |
Kojto | 71:53949e6131f6 | 51 | #define MAX_PACKET_SIZE_EP1 64 |
Kojto | 71:53949e6131f6 | 52 | #define MAX_PACKET_SIZE_EP2 64 |
Kojto | 71:53949e6131f6 | 53 | #define MAX_PACKET_SIZE_EP3 0x60 |
Kojto | 71:53949e6131f6 | 54 | #define MAX_PACKET_SIZE_EP4 64 |
Kojto | 71:53949e6131f6 | 55 | #define MAX_PACKET_SIZE_EP5 64 |
Kojto | 71:53949e6131f6 | 56 | #define MAX_PACKET_SIZE_EP6 64 |
Kojto | 71:53949e6131f6 | 57 | #define MAX_PACKET_SIZE_EP7 64 |
Kojto | 71:53949e6131f6 | 58 | #define MAX_PACKET_SIZE_EP8 64 |
Kojto | 71:53949e6131f6 | 59 | #define MAX_PACKET_SIZE_EP9 64 |
Kojto | 71:53949e6131f6 | 60 | #define MAX_PACKET_SIZE_EP10 64 |
Kojto | 71:53949e6131f6 | 61 | #define MAX_PACKET_SIZE_EP11 64 |
Kojto | 71:53949e6131f6 | 62 | |
Kojto | 71:53949e6131f6 | 63 | /* Generic endpoints - intended to be portable accross devices */ |
Kojto | 71:53949e6131f6 | 64 | /* and be suitable for simple USB devices. */ |
Kojto | 71:53949e6131f6 | 65 | |
Kojto | 71:53949e6131f6 | 66 | /* Bulk endpoints */ |
Kojto | 71:53949e6131f6 | 67 | #define EPBULK_OUT EP5OUT |
Kojto | 71:53949e6131f6 | 68 | #define EPBULK_IN EP6IN |
Kojto | 71:53949e6131f6 | 69 | #define EPBULK_OUT_callback EP5_OUT_callback |
Kojto | 71:53949e6131f6 | 70 | #define EPBULK_IN_callback EP6_IN_callback |
Kojto | 71:53949e6131f6 | 71 | /* Interrupt endpoints */ |
Kojto | 71:53949e6131f6 | 72 | #define EPINT_OUT EP1OUT |
Kojto | 71:53949e6131f6 | 73 | #define EPINT_IN EP2IN |
Kojto | 71:53949e6131f6 | 74 | #define EPINT_OUT_callback EP1_OUT_callback |
Kojto | 71:53949e6131f6 | 75 | #define EPINT_IN_callback EP2_IN_callback |
Kojto | 71:53949e6131f6 | 76 | /* Isochronous endpoints */ |
Kojto | 71:53949e6131f6 | 77 | #define EPISO_OUT EP3OUT |
Kojto | 71:53949e6131f6 | 78 | #define EPISO_IN EP4IN |
Kojto | 71:53949e6131f6 | 79 | #define EPISO_OUT_callback EP3_OUT_callback |
Kojto | 71:53949e6131f6 | 80 | #define EPISO_IN_callback EP4_IN_callback |
Kojto | 71:53949e6131f6 | 81 | |
Kojto | 71:53949e6131f6 | 82 | #define MAX_PACKET_SIZE_EPBULK 64 |
Kojto | 71:53949e6131f6 | 83 | #define MAX_PACKET_SIZE_EPINT 64 |
Kojto | 71:53949e6131f6 | 84 | #define MAX_PACKET_SIZE_EPISO 1023 |
Kojto | 71:53949e6131f6 | 85 | |
Kojto | 71:53949e6131f6 | 86 | #define USBD_GET_EP_MAX_PAYLOAD(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAMPS + (uint32_t)((ep)*0x28)))) |
Kojto | 71:53949e6131f6 | 87 | #define USBD_GET_EP_DATA_COUNT(ep) ((*((__IO uint32_t *) ((uint32_t)&USBD->EPADATCNT + (uint32_t)((ep)*0x28)))) & 0xFFFFF) |
Kojto | 71:53949e6131f6 | 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) |
Kojto | 71:53949e6131f6 | 89 | #define USBD_GET_EP_INT_EN(ep) (*((__IO uint32_t *) ((uint32_t)&USBD->EPAINTEN + (uint32_t)((ep)*0x28)))) |