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 
33 #if !(defined(CONFIG_USB_VID) && defined(CONFIG_USB_PID))
34 #ifdef USB_H_USER_IS_RIOT_INTERNAL
35 /* Reserved for RIOT standard peripherals as per http://pid.codes/1209/7D00/ */
36 #define CONFIG_USB_VID (0x1209)
37 #define CONFIG_USB_PID (0x7D00)
38 #else
39 #error Please configure your vendor and product IDs. For development, you may \
40  set CONFIG_USB_VID=0x1209 CONFIG_USB_PID=0x7D01.
41 #endif
42 #endif
43 
50 #ifdef DOXYGEN
51 #define CONFIG_USB_VID
52 #endif
53 
60 #ifdef DOXYGEN
61 #define CONFIG_USB_PID
62 #endif
63 
67 #ifndef CONFIG_USB_MANUF_STR
68 #define CONFIG_USB_MANUF_STR "RIOT-os.org"
69 #endif
70 
74 #ifndef CONFIG_USB_PRODUCT_STR
75 #define CONFIG_USB_PRODUCT_STR "USB device"
76 #endif
77 
81 #ifndef CONFIG_USB_CONFIGURATION_STR
82 #define CONFIG_USB_CONFIGURATION_STR "USB config"
83 #endif
84 
91 #ifndef CONFIG_USB_PRODUCT_BCDVERSION
92 #define CONFIG_USB_PRODUCT_BCDVERSION 0x0100
93 #endif
94 
98 #ifndef CONFIG_USB_SPEC_BCDVERSION
99 #if defined(CONFIG_USB_SPEC_BCDVERSION_1_1)
100 #define CONFIG_USB_SPEC_BCDVERSION 0x0110
101 #elif defined(CONFIG_USB_SPEC_BCDVERSION_2_0)
102 #define CONFIG_USB_SPEC_BCDVERSION 0x0200
103 #else
104 #define CONFIG_USB_SPEC_BCDVERSION 0x0200
105 #endif
106 #endif
107 
111 #ifndef CONFIG_USB_SELF_POWERED
112 #define CONFIG_USB_SELF_POWERED (0)
113 #endif
114 
118 #ifndef CONFIG_USB_MAX_POWER
119 #define CONFIG_USB_MAX_POWER (100)
120 #endif
121 
125 #ifndef CONFIG_USB_DEFAULT_LANGID
126 #define CONFIG_USB_DEFAULT_LANGID 0x0409 /* EN-US */
127 #endif
128 
154 #ifdef DOXYGEN
155 #define USB_H_USER_IS_RIOT_INTERNAL
156 #endif
157 
162 typedef enum {
163  USB_VERSION_1x, /* USB 1.0 or 1.1 device */
164  USB_VERSION_20, /* USB 2.0 device */
165 } usb_version_t;
166 
170 typedef enum {
171  USB_SPEED_LOW, /* Low speed (1.5Mbit/s) */
172  USB_SPEED_FULL, /* Full speed (12Mbit/s) */
173  USB_SPEED_HIGH, /* High speed (480Mbit/s) */
174 } usb_speed_t;
175 
179 typedef enum {
185 } usb_ep_type_t;
186 
190 typedef enum {
193 } usb_ep_dir_t;
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif /* USB_H */
200 
usb_ep_type_t
USB endpoint types.
Definition: usb.h:179
Bulk type.
Definition: usb.h:183
Host out, device in.
Definition: usb.h:191
Unused endpoint.
Definition: usb.h:180
Interrupt type.
Definition: usb.h:182
Isochronous type.
Definition: usb.h:184
usb_ep_dir_t
USB endpoint directions.
Definition: usb.h:190
Control type.
Definition: usb.h:181
usb_speed_t
USB speed definitions.
Definition: usb.h:170
usb_version_t
USB version definitions.
Definition: usb.h:162
Host in, device out.
Definition: usb.h:192