Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
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
#else
57
#if CONFIG_USB_VID == INTERNAL_PERIPHERAL_VID && \
58
CONFIG_USB_PID == INTERNAL_PERIPHERAL_PID
59
#error Please configure your vendor and product IDs differently than the \
60
INTERNAL_PERIPHERAL_* settings. For development, you may set \
61
USB_VID=${USB_VID_TESTING} \
62
USB_PID=${USB_PID_TESTING}.
63
#endif
64
#endif
/* !(defined(CONFIG_USB_VID) && defined(CONFIG_USB_PID)) */
65
72
#ifdef DOXYGEN
73
#define CONFIG_USB_VID
74
#endif
75
82
#ifdef DOXYGEN
83
#define CONFIG_USB_PID
84
#endif
85
89
#ifndef CONFIG_USB_MANUF_STR
90
#define CONFIG_USB_MANUF_STR "RIOT-os.org"
91
#endif
92
96
#ifndef CONFIG_USB_PRODUCT_STR
97
#define CONFIG_USB_PRODUCT_STR RIOT_BOARD
98
#endif
99
103
#ifndef CONFIG_USB_CONFIGURATION_STR
104
#define CONFIG_USB_CONFIGURATION_STR "USB config"
105
#endif
106
116
#ifdef DOXYGEN
117
#define CONFIG_USB_SERIAL_STR "RIOT-12345"
118
#endif
119
129
#if !defined(CONFIG_USB_SERIAL_STR) && !defined(CONFIG_USB_SERIAL_BYTE_LENGTH)
130
#define CONFIG_USB_SERIAL_BYTE_LENGTH 8
131
#endif
132
139
#ifndef CONFIG_USB_PRODUCT_BCDVERSION
140
#define CONFIG_USB_PRODUCT_BCDVERSION 0x0100
141
#endif
142
146
#ifndef CONFIG_USB_SPEC_BCDVERSION
147
#if defined(CONFIG_USB_SPEC_BCDVERSION_1_1)
148
#define CONFIG_USB_SPEC_BCDVERSION 0x0110
149
#elif defined(CONFIG_USB_SPEC_BCDVERSION_2_0)
150
#define CONFIG_USB_SPEC_BCDVERSION 0x0200
151
#else
152
#define CONFIG_USB_SPEC_BCDVERSION 0x0200
153
#endif
154
#endif
155
159
#ifndef CONFIG_USB_SELF_POWERED
160
#define CONFIG_USB_SELF_POWERED (0)
161
#endif
162
166
#ifndef CONFIG_USB_REM_WAKEUP
167
#define CONFIG_USB_REM_WAKEUP (0)
168
#endif
169
173
#ifndef CONFIG_USB_MAX_POWER
174
#define CONFIG_USB_MAX_POWER (100)
175
#endif
176
180
#ifndef CONFIG_USB_DEFAULT_LANGID
181
#define CONFIG_USB_DEFAULT_LANGID 0x0409
/* EN-US */
182
#endif
209
#ifdef DOXYGEN
210
#define USB_H_USER_IS_RIOT_INTERNAL
211
#endif
217
typedef
enum
{
218
USB_VERSION_1x,
/* USB 1.0 or 1.1 device */
219
USB_VERSION_20,
/* USB 2.0 device */
220
}
usb_version_t
;
221
225
typedef
enum
{
226
USB_SPEED_LOW,
/* Low speed (1.5Mbit/s) */
227
USB_SPEED_FULL,
/* Full speed (12Mbit/s) */
228
USB_SPEED_HIGH,
/* High speed (480Mbit/s) */
229
}
usb_speed_t
;
230
234
typedef
enum
{
235
USB_EP_TYPE_NONE
= 0,
236
USB_EP_TYPE_CONTROL
,
237
USB_EP_TYPE_INTERRUPT
,
238
USB_EP_TYPE_BULK
,
239
USB_EP_TYPE_ISOCHRONOUS
,
240
}
usb_ep_type_t
;
241
245
typedef
enum
{
246
USB_EP_DIR_OUT
,
247
USB_EP_DIR_IN
,
248
}
usb_ep_dir_t
;
249
253
#define USB_ENDPOINT_INTERRUPT_FS_MAX_SIZE (64)
254
258
#define USB_ENDPOINT_INTERRUPT_HS_MAX_SIZE (1024)
259
263
#define USB_ENDPOINT_BULK_FS_MAX_SIZE (64)
264
268
#define USB_ENDPOINT_BULK_HS_MAX_SIZE (512)
269
270
#ifdef __cplusplus
271
}
272
#endif
273
274
#endif
/* USB_H */
usb_version_t
usb_version_t
USB version definitions.
Definition
usb.h:217
usb_ep_dir_t
usb_ep_dir_t
USB endpoint directions.
Definition
usb.h:245
usb_ep_type_t
usb_ep_type_t
USB endpoint types.
Definition
usb.h:234
usb_speed_t
usb_speed_t
USB speed definitions.
Definition
usb.h:225
USB_EP_DIR_OUT
@ USB_EP_DIR_OUT
Host out, device in.
Definition
usb.h:246
USB_EP_DIR_IN
@ USB_EP_DIR_IN
Host in, device out.
Definition
usb.h:247
USB_EP_TYPE_NONE
@ USB_EP_TYPE_NONE
Unused endpoint
Definition
usb.h:235
USB_EP_TYPE_CONTROL
@ USB_EP_TYPE_CONTROL
Control type
Definition
usb.h:236
USB_EP_TYPE_BULK
@ USB_EP_TYPE_BULK
Bulk type
Definition
usb.h:238
USB_EP_TYPE_INTERRUPT
@ USB_EP_TYPE_INTERRUPT
Interrupt type
Definition
usb.h:237
USB_EP_TYPE_ISOCHRONOUS
@ USB_EP_TYPE_ISOCHRONOUS
Isochronous type
Definition
usb.h:239
Generated on Thu Nov 21 2024 09:55:58 by
1.9.8