1 /* 2 * Copyright (c) 2013-2020 ARM Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the License); you may 7 * not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * $Date: 24. January 2020 19 * $Revision: V2.0 20 * 21 * Project: USB Driver common definitions 22 */ 23 24 /* History: 25 * Version 2.0 26 * Version 1.10 27 * Namespace prefix ARM_ added 28 * Version 1.01 29 * Added PID Types 30 * Version 1.00 31 * Initial release 32 */ 33 34 #ifndef DRIVER_USB_H_ 35 #define DRIVER_USB_H_ 36 37 #include "Driver_Common.h" 38 39 /* USB Role */ 40 #define ARM_USB_ROLE_NONE (0U) 41 #define ARM_USB_ROLE_HOST (1U) 42 #define ARM_USB_ROLE_DEVICE (2U) 43 44 /* USB Pins */ 45 #define ARM_USB_PIN_DP (1U << 0) ///< USB D+ pin 46 #define ARM_USB_PIN_DM (1U << 1) ///< USB D- pin 47 #define ARM_USB_PIN_VBUS (1U << 2) ///< USB VBUS pin 48 #define ARM_USB_PIN_OC (1U << 3) ///< USB OverCurrent pin 49 #define ARM_USB_PIN_ID (1U << 4) ///< USB ID pin 50 51 /* USB Speed */ 52 #define ARM_USB_SPEED_LOW (0U) ///< Low-speed USB 53 #define ARM_USB_SPEED_FULL (1U) ///< Full-speed USB 54 #define ARM_USB_SPEED_HIGH (2U) ///< High-speed USB 55 56 /* USB PID Types */ 57 #define ARM_USB_PID_OUT (1U) 58 #define ARM_USB_PID_IN (9U) 59 #define ARM_USB_PID_SOF (5U) 60 #define ARM_USB_PID_SETUP (13U) 61 #define ARM_USB_PID_DATA0 (3U) 62 #define ARM_USB_PID_DATA1 (11U) 63 #define ARM_USB_PID_DATA2 (7U) 64 #define ARM_USB_PID_MDATA (15U) 65 #define ARM_USB_PID_ACK (2U) 66 #define ARM_USB_PID_NAK (10U) 67 #define ARM_USB_PID_STALL (14U) 68 #define ARM_USB_PID_NYET (6U) 69 #define ARM_USB_PID_PRE (12U) 70 #define ARM_USB_PID_ERR (12U) 71 #define ARM_USB_PID_SPLIT (8U) 72 #define ARM_USB_PID_PING (4U) 73 #define ARM_USB_PID_RESERVED (0U) 74 75 /* USB Endpoint Address (bEndpointAddress) */ 76 #define ARM_USB_ENDPOINT_NUMBER_MASK (0x0FU) 77 #define ARM_USB_ENDPOINT_DIRECTION_MASK (0x80U) 78 79 /* USB Endpoint Type */ 80 #define ARM_USB_ENDPOINT_CONTROL (0U) ///< Control Endpoint 81 #define ARM_USB_ENDPOINT_ISOCHRONOUS (1U) ///< Isochronous Endpoint 82 #define ARM_USB_ENDPOINT_BULK (2U) ///< Bulk Endpoint 83 #define ARM_USB_ENDPOINT_INTERRUPT (3U) ///< Interrupt Endpoint 84 85 /* USB Endpoint Maximum Packet Size (wMaxPacketSize) */ 86 #define ARM_USB_ENDPOINT_MAX_PACKET_SIZE_MASK (0x07FFU) 87 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_MASK (0x1800U) 88 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_1 (0x0000U) 89 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_2 (0x0800U) 90 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_3 (0x1000U) 91 92 #endif /* DRIVER_USB_H_ */ 93