USB device stack

Dependents:   USBMSD_step1 USBMSD_step1_5 picossd_step1_2cs

Committer:
muraguchi
Date:
Wed Sep 15 16:31:51 2021 +0000
Revision:
73:72808bd55ce2
Parent:
71:53949e6131f6
AirioBase + 2 chip PicoSSD board

Who changed what in which revision?

UserRevisionLine numberNew 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_EPL2EPH(ep) ((ep) + 1)
Kojto 71:53949e6131f6 20 #define NU_EPH2EPL(ep) ((ep) - 1)
Kojto 71:53949e6131f6 21 #define NU_EP_DIR_Pos 0
Kojto 71:53949e6131f6 22 #define NU_EP_DIR_Msk (1 << NU_EP_DIR_Pos)
Kojto 71:53949e6131f6 23 #define NU_EP_DIR_OUT 0
Kojto 71:53949e6131f6 24 #define NU_EP_DIR_IN 1
Kojto 71:53949e6131f6 25
Kojto 71:53949e6131f6 26 #define NU_EP_TYPE(ep) (((ep) & NU_EP_TYPE_Msk) >> NU_EP_TYPE_Pos)
Kojto 71:53949e6131f6 27 #define NU_EP_NUM(ep) (((ep) & NU_EP_NUM_Msk) >> NU_EP_NUM_Pos)
Kojto 71:53949e6131f6 28 #define NU_EP_DIR(ep) (((ep) & NU_EP_DIR_Msk) >> NU_EP_DIR_Pos)
Kojto 71:53949e6131f6 29 #define NU_EP_NUM_DIR(ep) ((NU_EP_NUM(ep) << 1) | NU_EP_DIR(ep))
Kojto 71:53949e6131f6 30
Kojto 71:53949e6131f6 31 #define NUMBER_OF_PHYSICAL_ENDPOINTS 8
Kojto 71:53949e6131f6 32 #define EP0OUT (0)
Kojto 71:53949e6131f6 33 #define EP0IN (1)
Kojto 71:53949e6131f6 34 #define EP1OUT (2)
Kojto 71:53949e6131f6 35 #define EP1IN (3)
Kojto 71:53949e6131f6 36 #define EP2OUT (4)
Kojto 71:53949e6131f6 37 #define EP2IN (5)
Kojto 71:53949e6131f6 38 #define EP3OUT (6)
Kojto 71:53949e6131f6 39 #define EP3IN (7)
Kojto 71:53949e6131f6 40 #define EP4OUT (8)
Kojto 71:53949e6131f6 41 #define EP4IN (9)
Kojto 71:53949e6131f6 42 #define EP5OUT (10)
Kojto 71:53949e6131f6 43 #define EP5IN (11)
Kojto 71:53949e6131f6 44 #define EP6OUT (12)
Kojto 71:53949e6131f6 45 #define EP6IN (13)
Kojto 71:53949e6131f6 46
Kojto 71:53949e6131f6 47 /* Maximum Packet sizes */
Kojto 71:53949e6131f6 48 #define MAX_PACKET_SIZE_EP0 64
Kojto 71:53949e6131f6 49 #define MAX_PACKET_SIZE_EP1 64
Kojto 71:53949e6131f6 50 #define MAX_PACKET_SIZE_EP2 64
Kojto 71:53949e6131f6 51 #define MAX_PACKET_SIZE_EP3 0x60
Kojto 71:53949e6131f6 52 #define MAX_PACKET_SIZE_EP4 64
Kojto 71:53949e6131f6 53 #define MAX_PACKET_SIZE_EP5 64
Kojto 71:53949e6131f6 54 #define MAX_PACKET_SIZE_EP6 64
Kojto 71:53949e6131f6 55 #define MAX_PACKET_SIZE_EP7 64
Kojto 71:53949e6131f6 56
Kojto 71:53949e6131f6 57 /* Generic endpoints - intended to be portable accross devices */
Kojto 71:53949e6131f6 58 /* and be suitable for simple USB devices. */
Kojto 71:53949e6131f6 59
Kojto 71:53949e6131f6 60 /* Bulk endpoints */
Kojto 71:53949e6131f6 61 #define EPBULK_OUT EP5OUT
Kojto 71:53949e6131f6 62 #define EPBULK_IN EP6IN
Kojto 71:53949e6131f6 63 #define EPBULK_OUT_callback EP5_OUT_callback
Kojto 71:53949e6131f6 64 #define EPBULK_IN_callback EP6_IN_callback
Kojto 71:53949e6131f6 65 /* Interrupt endpoints */
Kojto 71:53949e6131f6 66 #define EPINT_OUT EP1OUT
Kojto 71:53949e6131f6 67 #define EPINT_IN EP2IN
Kojto 71:53949e6131f6 68 #define EPINT_OUT_callback EP1_OUT_callback
Kojto 71:53949e6131f6 69 #define EPINT_IN_callback EP2_IN_callback
Kojto 71:53949e6131f6 70 /* Isochronous endpoints */
Kojto 71:53949e6131f6 71 #define EPISO_OUT EP3OUT
Kojto 71:53949e6131f6 72 #define EPISO_IN EP4IN
Kojto 71:53949e6131f6 73 #define EPISO_OUT_callback EP3_OUT_callback
Kojto 71:53949e6131f6 74 #define EPISO_IN_callback EP4_IN_callback
Kojto 71:53949e6131f6 75
Kojto 71:53949e6131f6 76 #define MAX_PACKET_SIZE_EPBULK 64
Kojto 71:53949e6131f6 77 #define MAX_PACKET_SIZE_EPINT 64
Kojto 71:53949e6131f6 78 #define MAX_PACKET_SIZE_EPISO 1023
Kojto 71:53949e6131f6 79