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