]> begriffs open source - cmsis/blob - CMSIS/Driver/Include/Driver_USB.h
CMSIS Driver: Updated NAND API V2.3.0 (extended ARM_NAND_ECC_INFO structure)
[cmsis] / CMSIS / Driver / Include / Driver_USB.h
1 /*
2  * Copyright (c) 2013-2017 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:        2. Feb 2017
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               (0)
41 #define ARM_USB_ROLE_HOST               (1)
42 #define ARM_USB_ROLE_DEVICE             (2)
43
44 /* USB Pins */
45 #define ARM_USB_PIN_DP                  (1 << 0) ///< USB D+ pin
46 #define ARM_USB_PIN_DM                  (1 << 1) ///< USB D- pin
47 #define ARM_USB_PIN_VBUS                (1 << 2) ///< USB VBUS pin
48 #define ARM_USB_PIN_OC                  (1 << 3) ///< USB OverCurrent pin
49 #define ARM_USB_PIN_ID                  (1 << 4) ///< USB ID pin
50
51 /* USB Speed */
52 #define ARM_USB_SPEED_LOW               (0)      ///< Low-speed USB
53 #define ARM_USB_SPEED_FULL              (1)      ///< Full-speed USB
54 #define ARM_USB_SPEED_HIGH              (2)      ///< High-speed USB
55
56 /* USB PID Types */
57 #define ARM_USB_PID_OUT                 (1)
58 #define ARM_USB_PID_IN                  (9)
59 #define ARM_USB_PID_SOF                 (5)
60 #define ARM_USB_PID_SETUP               (13)
61 #define ARM_USB_PID_DATA0               (3)
62 #define ARM_USB_PID_DATA1               (11)
63 #define ARM_USB_PID_DATA2               (7)
64 #define ARM_USB_PID_MDATA               (15)
65 #define ARM_USB_PID_ACK                 (2)
66 #define ARM_USB_PID_NAK                 (10)
67 #define ARM_USB_PID_STALL               (14)
68 #define ARM_USB_PID_NYET                (6)
69 #define ARM_USB_PID_PRE                 (12)
70 #define ARM_USB_PID_ERR                 (12)
71 #define ARM_USB_PID_SPLIT               (8)
72 #define ARM_USB_PID_PING                (4)
73 #define ARM_USB_PID_RESERVED            (0)
74
75 /* USB Endpoint Address (bEndpointAddress) */
76 #define ARM_USB_ENDPOINT_NUMBER_MASK    (0x0F)
77 #define ARM_USB_ENDPOINT_DIRECTION_MASK (0x80)
78
79 /* USB Endpoint Type */
80 #define ARM_USB_ENDPOINT_CONTROL        (0)      ///< Control Endpoint
81 #define ARM_USB_ENDPOINT_ISOCHRONOUS    (1)      ///< Isochronous Endpoint
82 #define ARM_USB_ENDPOINT_BULK           (2)      ///< Bulk Endpoint
83 #define ARM_USB_ENDPOINT_INTERRUPT      (3)      ///< Interrupt Endpoint
84
85 /* USB Endpoint Maximum Packet Size (wMaxPacketSize) */
86 #define ARM_USB_ENDPOINT_MAX_PACKET_SIZE_MASK           (0x07FF)
87 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_MASK   (0x1800)
88 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_1      (0x0000)
89 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_2      (0x0800)
90 #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_3      (0x1000)
91
92 #endif /* DRIVER_USB_H_ */