Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
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
40
41
#define INTERNAL_PERIPHERAL_VID (0x1209)
42
#endif
43
#ifndef INTERNAL_PERIPHERAL_PID
44
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 "USB device"
90
#endif
91
95
#ifndef CONFIG_USB_CONFIGURATION_STR
96
#define CONFIG_USB_CONFIGURATION_STR "USB config"
97
#endif
98
105
#ifndef CONFIG_USB_PRODUCT_BCDVERSION
106
#define CONFIG_USB_PRODUCT_BCDVERSION 0x0100
107
#endif
108
112
#ifndef CONFIG_USB_SPEC_BCDVERSION
113
#if defined(CONFIG_USB_SPEC_BCDVERSION_1_1)
114
#define CONFIG_USB_SPEC_BCDVERSION 0x0110
115
#elif defined(CONFIG_USB_SPEC_BCDVERSION_2_0)
116
#define CONFIG_USB_SPEC_BCDVERSION 0x0200
117
#else
118
#define CONFIG_USB_SPEC_BCDVERSION 0x0200
119
#endif
120
#endif
121
125
#ifndef CONFIG_USB_SELF_POWERED
126
#define CONFIG_USB_SELF_POWERED (0)
127
#endif
128
132
#ifndef CONFIG_USB_MAX_POWER
133
#define CONFIG_USB_MAX_POWER (100)
134
#endif
135
139
#ifndef CONFIG_USB_DEFAULT_LANGID
140
#define CONFIG_USB_DEFAULT_LANGID 0x0409
/* EN-US */
141
#endif
142
168
#ifdef DOXYGEN
169
#define USB_H_USER_IS_RIOT_INTERNAL
170
#endif
171
176
typedef
enum
{
177
USB_VERSION_1x,
/* USB 1.0 or 1.1 device */
178
USB_VERSION_20,
/* USB 2.0 device */
179
}
usb_version_t
;
180
184
typedef
enum
{
185
USB_SPEED_LOW,
/* Low speed (1.5Mbit/s) */
186
USB_SPEED_FULL,
/* Full speed (12Mbit/s) */
187
USB_SPEED_HIGH,
/* High speed (480Mbit/s) */
188
}
usb_speed_t
;
189
193
typedef
enum
{
194
USB_EP_TYPE_NONE
= 0,
195
USB_EP_TYPE_CONTROL
,
196
USB_EP_TYPE_INTERRUPT
,
197
USB_EP_TYPE_BULK
,
198
USB_EP_TYPE_ISOCHRONOUS
,
199
}
usb_ep_type_t
;
200
204
typedef
enum
{
205
USB_EP_DIR_OUT
,
206
USB_EP_DIR_IN
,
207
}
usb_ep_dir_t
;
208
209
#ifdef __cplusplus
210
}
211
#endif
212
213
#endif
/* USB_H */
214
usb_ep_dir_t
usb_ep_dir_t
USB endpoint directions.
Definition:
usb.h:204
usb_speed_t
usb_speed_t
USB speed definitions.
Definition:
usb.h:184
usb_version_t
usb_version_t
USB version definitions.
Definition:
usb.h:176
USB_EP_DIR_IN
@ USB_EP_DIR_IN
Host in, device out.
Definition:
usb.h:206
usb_ep_type_t
usb_ep_type_t
USB endpoint types.
Definition:
usb.h:193
USB_EP_DIR_OUT
@ USB_EP_DIR_OUT
Host out, device in.
Definition:
usb.h:205
USB_EP_TYPE_CONTROL
@ USB_EP_TYPE_CONTROL
Control type
Definition:
usb.h:195
USB_EP_TYPE_INTERRUPT
@ USB_EP_TYPE_INTERRUPT
Interrupt type
Definition:
usb.h:196
USB_EP_TYPE_BULK
@ USB_EP_TYPE_BULK
Bulk type
Definition:
usb.h:197
USB_EP_TYPE_NONE
@ USB_EP_TYPE_NONE
Unused endpoint
Definition:
usb.h:194
USB_EP_TYPE_ISOCHRONOUS
@ USB_EP_TYPE_ISOCHRONOUS
Isochronous type
Definition:
usb.h:198
Generated on Tue Nov 24 2020 19:46:52 by
1.8.17