usb.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Koen Zandberg <koen@bergzand.net>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
20 #ifndef USB_H
21 #define USB_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "board.h"
28 
35 /* These can be overridden by boards that should come up with their board
36  * supplier VID/PID pair. Boards should only override this if the RIOT built-in
37  * peripherals are compatible with whatever is usually shipped with that pair
38  * */
39 #ifndef INTERNAL_PERIPHERAL_VID
41 #define INTERNAL_PERIPHERAL_VID (0x1209)
42 #endif
43 #ifndef INTERNAL_PERIPHERAL_PID
45 #define INTERNAL_PERIPHERAL_PID (0x7D00)
46 #endif
47 
48 #if !(defined(CONFIG_USB_VID) && defined(CONFIG_USB_PID))
49 #ifdef USB_H_USER_IS_RIOT_INTERNAL
50 #define CONFIG_USB_VID INTERNAL_PERIPHERAL_VID
51 #define CONFIG_USB_PID INTERNAL_PERIPHERAL_PID
52 #else
53 #error Please configure your vendor and product IDs. For development, you may \
54  set USB_VID=${USB_VID_TESTING} USB_PID=${USB_PID_TESTING}.
55 #endif
56 #endif
57 
64 #ifdef DOXYGEN
65 #define CONFIG_USB_VID
66 #endif
67 
74 #ifdef DOXYGEN
75 #define CONFIG_USB_PID
76 #endif
77 
81 #ifndef CONFIG_USB_MANUF_STR
82 #define CONFIG_USB_MANUF_STR "RIOT-os.org"
83 #endif
84 
88 #ifndef CONFIG_USB_PRODUCT_STR
89 #define CONFIG_USB_PRODUCT_STR RIOT_BOARD
90 #endif
91 
95 #ifndef CONFIG_USB_CONFIGURATION_STR
96 #define CONFIG_USB_CONFIGURATION_STR "USB config"
97 #endif
98 
108 #ifdef DOXYGEN
109 #define CONFIG_USB_SERIAL_STR "RIOT-12345"
110 #endif
111 
121 #if !defined(CONFIG_USB_SERIAL_STR) && !defined(CONFIG_USB_SERIAL_BYTE_LENGTH)
122 #define CONFIG_USB_SERIAL_BYTE_LENGTH 8
123 #endif
124 
131 #ifndef CONFIG_USB_PRODUCT_BCDVERSION
132 #define CONFIG_USB_PRODUCT_BCDVERSION 0x0100
133 #endif
134 
138 #ifndef CONFIG_USB_SPEC_BCDVERSION
139 #if defined(CONFIG_USB_SPEC_BCDVERSION_1_1)
140 #define CONFIG_USB_SPEC_BCDVERSION 0x0110
141 #elif defined(CONFIG_USB_SPEC_BCDVERSION_2_0)
142 #define CONFIG_USB_SPEC_BCDVERSION 0x0200
143 #else
144 #define CONFIG_USB_SPEC_BCDVERSION 0x0200
145 #endif
146 #endif
147 
151 #ifndef CONFIG_USB_SELF_POWERED
152 #define CONFIG_USB_SELF_POWERED (0)
153 #endif
154 
158 #ifndef CONFIG_USB_REM_WAKEUP
159 #define CONFIG_USB_REM_WAKEUP (0)
160 #endif
161 
165 #ifndef CONFIG_USB_MAX_POWER
166 #define CONFIG_USB_MAX_POWER (100)
167 #endif
168 
172 #ifndef CONFIG_USB_DEFAULT_LANGID
173 #define CONFIG_USB_DEFAULT_LANGID 0x0409 /* EN-US */
174 #endif
201 #ifdef DOXYGEN
202 #define USB_H_USER_IS_RIOT_INTERNAL
203 #endif
209 typedef enum {
210  USB_VERSION_1x, /* USB 1.0 or 1.1 device */
211  USB_VERSION_20, /* USB 2.0 device */
212 } usb_version_t;
213 
217 typedef enum {
218  USB_SPEED_LOW, /* Low speed (1.5Mbit/s) */
219  USB_SPEED_FULL, /* Full speed (12Mbit/s) */
220  USB_SPEED_HIGH, /* High speed (480Mbit/s) */
221 } usb_speed_t;
222 
226 typedef enum {
232 } usb_ep_type_t;
233 
237 typedef enum {
240 } usb_ep_dir_t;
241 
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif /* USB_H */
usb_version_t
USB version definitions.
Definition: usb.h:209
usb_ep_dir_t
USB endpoint directions.
Definition: usb.h:237
usb_ep_type_t
USB endpoint types.
Definition: usb.h:226
usb_speed_t
USB speed definitions.
Definition: usb.h:217
@ USB_EP_DIR_OUT
Host out, device in.
Definition: usb.h:238
@ USB_EP_DIR_IN
Host in, device out.
Definition: usb.h:239
@ USB_EP_TYPE_NONE
Unused endpoint
Definition: usb.h:227
@ USB_EP_TYPE_CONTROL
Control type
Definition: usb.h:228
@ USB_EP_TYPE_BULK
Bulk type
Definition: usb.h:230
@ USB_EP_TYPE_INTERRUPT
Interrupt type
Definition: usb.h:229
@ USB_EP_TYPE_ISOCHRONOUS
Isochronous type
Definition: usb.h:231