USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Committer:
Kojto
Date:
Thu Jul 20 10:14:36 2017 +0100
Revision:
70:2c525a50f1b6
Update libraries (ed9d1da)

Who changed what in which revision?

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