aboutsummaryrefslogtreecommitdiff
path: root/lib/vusb/tests/usbconfig.h
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-04-10 12:13:40 +0100
committerAkshay <[email protected]>2022-04-10 12:13:40 +0100
commitdc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch)
tree4ccb8fa5886b66fa9d480edef74236c27f035e16 /lib/vusb/tests/usbconfig.h
Diffstat (limited to 'lib/vusb/tests/usbconfig.h')
-rw-r--r--lib/vusb/tests/usbconfig.h299
1 files changed, 299 insertions, 0 deletions
diff --git a/lib/vusb/tests/usbconfig.h b/lib/vusb/tests/usbconfig.h
new file mode 100644
index 000000000..e079e0661
--- /dev/null
+++ b/lib/vusb/tests/usbconfig.h
@@ -0,0 +1,299 @@
1/* Name: usbconfig.h
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2005-04-01
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 */
9
10#ifndef __usbconfig_h_included__
11#define __usbconfig_h_included__
12
13/*
14General Description:
15This is the config file for tests. It is not updated to the latest set of
16features. Don't use it as a prototype, use usbconfig-prototype.h instead!
17*/
18
19/* ---------------------------- Hardware Config ---------------------------- */
20
21#define USB_CFG_IOPORTNAME D
22#define USB_CFG_DMINUS_BIT 4
23#define USB_CFG_DPLUS_BIT 2
24#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
25#ifdef USE_CRC
26# define USB_CFG_CHECK_CRC 1
27#else
28# define USB_CFG_CHECK_CRC 0
29#endif
30
31
32/* ----------------------- Optional Hardware Config ------------------------ */
33
34/* #define USB_CFG_PULLUP_IOPORTNAME D */
35/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
36 * V+, you can connect and disconnect the device from firmware by calling
37 * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
38 * This constant defines the port on which the pullup resistor is connected.
39 */
40/* #define USB_CFG_PULLUP_BIT 4 */
41/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
42 * above) where the 1.5k pullup resistor is connected. See description
43 * above for details.
44 */
45
46/* --------------------------- Functional Range ---------------------------- */
47
48#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT3
49#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
50#endif
51/* Define this to 1 if you want to compile a version with three endpoints: The
52 * default control endpoint 0, an interrupt-in endpoint 3 (or the number
53 * configured below) and a catch-all default interrupt-in endpoint as above.
54 * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
55 */
56#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT
57#define USB_CFG_HAVE_INTRIN_ENDPOINT USB_CFG_HAVE_INTRIN_ENDPOINT3
58#endif
59/* Define this to 1 if you want to compile a version with two endpoints: The
60 * default control endpoint 0 and an interrupt-in endpoint (any other endpoint
61 * number).
62 */
63#define USB_CFG_EP3_NUMBER 3
64/* If the so-called endpoint 3 is used, it can now be configured to any other
65 * endpoint number (except 0) with this macro. Default if undefined is 3.
66 */
67/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
68/* The above macro defines the startup condition for data toggling on the
69 * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
70 * Since the token is toggled BEFORE sending any data, the first packet is
71 * sent with the oposite value of this configuration!
72 */
73//#define USB_CFG_IMPLEMENT_HALT 0
74/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
75 * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
76 * it is required by the standard. We have made it a config option because it
77 * bloats the code considerably.
78 */
79#define USB_CFG_INTR_POLL_INTERVAL 10
80/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
81 * interval. The value is in milliseconds and must not be less than 10 ms for
82 * low speed devices.
83 */
84#define USB_CFG_IS_SELF_POWERED 0
85/* Define this to 1 if the device has its own power supply. Set it to 0 if the
86 * device is powered from the USB bus.
87 */
88#define USB_CFG_MAX_BUS_POWER 40
89/* Set this variable to the maximum USB bus power consumption of your device.
90 * The value is in milliamperes. [It will be divided by two since USB
91 * communicates power requirements in units of 2 mA.]
92 */
93//#define USB_CFG_IMPLEMENT_FN_WRITE 0
94/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
95 * transfers. Set it to 0 if you don't need it and want to save a couple of
96 * bytes.
97 */
98//#define USB_CFG_IMPLEMENT_FN_READ 0
99/* Set this to 1 if you need to send control replies which are generated
100 * "on the fly" when usbFunctionRead() is called. If you only want to send
101 * data from a static buffer, set it to 0 and return the data from
102 * usbFunctionSetup(). This saves a couple of bytes.
103 */
104//#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
105/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
106 * You must implement the function usbFunctionWriteOut() which receives all
107 * interrupt/bulk data sent to any endpoint other than 0. The endpoint number
108 * can be found in 'usbRxToken'.
109 */
110#define USB_CFG_HAVE_FLOWCONTROL 0
111/* Define this to 1 if you want flowcontrol over USB data. See the definition
112 * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
113 * usbdrv.h.
114 */
115//#define USB_CFG_LONG_TRANSFERS 0
116/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
117 * in a single control-in or control-out transfer. Note that the capability
118 * for long transfers increases the driver size.
119 */
120/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
121/* This macro is a hook if you want to do unconventional things. If it is
122 * defined, it's inserted at the beginning of received message processing.
123 * If you eat the received message and don't want default processing to
124 * proceed, do a return after doing your things. One possible application
125 * (besides debugging) is to flash a status LED on each packet.
126 */
127/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
128/* This macro is a hook if you need to know when an USB RESET occurs. It has
129 * one parameter which distinguishes between the start of RESET state and its
130 * end.
131 */
132/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
133/* This macro (if defined) is executed when a USB SET_ADDRESS request was
134 * received.
135 */
136//#define USB_COUNT_SOF 0
137/* define this macro to 1 if you need the global variable "usbSofCount" which
138 * counts SOF packets. This feature requires that the hardware interrupt is
139 * connected to D- instead of D+.
140 */
141//#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
142/* define this macro to 1 if you want the function usbMeasureFrameLength()
143 * compiled in. This function can be used to calibrate the AVR's RC oscillator.
144 */
145
146/* -------------------------- Device Description --------------------------- */
147
148#define USB_CFG_VENDOR_ID 0xc0, 0x16
149/* USB vendor ID for the device, low byte first. If you have registered your
150 * own Vendor ID, define it here. Otherwise you use one of obdev's free shared
151 * VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
152 */
153#define USB_CFG_DEVICE_ID 0x08, 0x3e /* 1000 dec, "free for lab use" */
154/* This is the ID of the product, low byte first. It is interpreted in the
155 * scope of the vendor ID. If you have registered your own VID with usb.org
156 * or if you have licensed a PID from somebody else, define it here. Otherwise
157 * you use obdev's free shared VID/PID pair. Be sure to read the rules in
158 * USB-IDs-for-free.txt!
159 */
160#define USB_CFG_DEVICE_VERSION 0x00, 0x01
161/* Version number of the device: Minor number first, then major number.
162 */
163#define USB_CFG_VENDOR_NAME 'o', 'b', 'd', 'e', 'v', '.', 'a', 't'
164#define USB_CFG_VENDOR_NAME_LEN 8
165/* These two values define the vendor name returned by the USB device. The name
166 * must be given as a list of characters under single quotes. The characters
167 * are interpreted as Unicode (UTF-16) entities.
168 * If you don't want a vendor name string, undefine these macros.
169 * ALWAYS define a vendor name containing your Internet domain name if you use
170 * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
171 * details.
172 */
173#define USB_CFG_DEVICE_NAME 'T', 'e', 's', 't'
174#define USB_CFG_DEVICE_NAME_LEN 4
175/* Same as above for the device name. If you don't want a device name, undefine
176 * the macros. See the file USB-IDs-for-free.txt before you assign a name if
177 * you use a shared VID/PID.
178 */
179/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
180/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
181/* Same as above for the serial number. If you don't want a serial number,
182 * undefine the macros.
183 * It may be useful to provide the serial number through other means than at
184 * compile time. See the section about descriptor properties below for how
185 * to fine tune control over USB descriptors such as the string descriptor
186 * for the serial number.
187 */
188#define USB_CFG_DEVICE_CLASS 0xff /* set to 0 if deferred to interface */
189#define USB_CFG_DEVICE_SUBCLASS 0
190/* See USB specification if you want to conform to an existing device class.
191 * Class 0xff is "vendor specific".
192 */
193#define USB_CFG_INTERFACE_CLASS 0 /* define class here if not at device level */
194#define USB_CFG_INTERFACE_SUBCLASS 0
195#define USB_CFG_INTERFACE_PROTOCOL 0
196/* See USB specification if you want to conform to an existing device class or
197 * protocol. The following classes must be set at interface level:
198 * HID class is 3, no subclass and protocol required (but may be useful!)
199 * CDC class is 2, use subclass 2 and protocol 1 for ACM
200 */
201/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 42 */
202/* Define this to the length of the HID report descriptor, if you implement
203 * an HID device. Otherwise don't define it or define it to 0.
204 * If you use this define, you must add a PROGMEM character array named
205 * "usbHidReportDescriptor" to your code which contains the report descriptor.
206 * Don't forget to keep the array and this define in sync!
207 */
208
209/* #define USB_PUBLIC static */
210/* Use the define above if you #include usbdrv.c instead of linking against it.
211 * This technique saves a couple of bytes in flash memory.
212 */
213
214/* ------------------- Fine Control over USB Descriptors ------------------- */
215/* If you don't want to use the driver's default USB descriptors, you can
216 * provide our own. These can be provided as (1) fixed length static data in
217 * flash memory, (2) fixed length static data in RAM or (3) dynamically at
218 * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
219 * information about this function.
220 * Descriptor handling is configured through the descriptor's properties. If
221 * no properties are defined or if they are 0, the default descriptor is used.
222 * Possible properties are:
223 * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
224 * at runtime via usbFunctionDescriptor().
225 * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
226 * in static memory is in RAM, not in flash memory.
227 * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
228 * the driver must know the descriptor's length. The descriptor itself is
229 * found at the address of a well known identifier (see below).
230 * List of static descriptor names (must be declared PROGMEM if in flash):
231 * char usbDescriptorDevice[];
232 * char usbDescriptorConfiguration[];
233 * char usbDescriptorHidReport[];
234 * char usbDescriptorString0[];
235 * int usbDescriptorStringVendor[];
236 * int usbDescriptorStringDevice[];
237 * int usbDescriptorStringSerialNumber[];
238 * Other descriptors can't be provided statically, they must be provided
239 * dynamically at runtime.
240 *
241 * Descriptor properties are or-ed or added together, e.g.:
242 * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
243 *
244 * The following descriptors are defined:
245 * USB_CFG_DESCR_PROPS_DEVICE
246 * USB_CFG_DESCR_PROPS_CONFIGURATION
247 * USB_CFG_DESCR_PROPS_STRINGS
248 * USB_CFG_DESCR_PROPS_STRING_0
249 * USB_CFG_DESCR_PROPS_STRING_VENDOR
250 * USB_CFG_DESCR_PROPS_STRING_PRODUCT
251 * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
252 * USB_CFG_DESCR_PROPS_HID
253 * USB_CFG_DESCR_PROPS_HID_REPORT
254 * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
255 *
256 */
257
258#if USE_DYNAMIC_DESCRIPTOR
259#define USB_CFG_DESCR_PROPS_DEVICE USB_PROP_IS_DYNAMIC
260#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
261#else
262#define USB_CFG_DESCR_PROPS_DEVICE 0
263#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
264#endif
265#define USB_CFG_DESCR_PROPS_STRINGS 0
266#define USB_CFG_DESCR_PROPS_STRING_0 0
267#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
268#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
269#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
270#define USB_CFG_DESCR_PROPS_HID 0
271#define USB_CFG_DESCR_PROPS_HID_REPORT 0
272#define USB_CFG_DESCR_PROPS_UNKNOWN 0
273
274#define usbMsgPtr_t unsigned short
275/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
276 * a scalar type here because gcc generates slightly shorter code for scalar
277 * arithmetics than for pointer arithmetics. Remove this define for backward
278 * type compatibility or define it to an 8 bit type if you use data in RAM only
279 * and all RAM is below 256 bytes (tiny memory model in IAR CC).
280 */
281
282/* ----------------------- Optional MCU Description ------------------------ */
283
284/* The following configurations have working defaults in usbdrv.h. You
285 * usually don't need to set them explicitly. Only if you want to run
286 * the driver on a device which is not yet supported or with a compiler
287 * which is not fully supported (such as IAR C) or if you use a differnt
288 * interrupt than INT0, you may have to define some of these.
289 */
290/* #define USB_INTR_CFG MCUCR */
291/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
292/* #define USB_INTR_CFG_CLR 0 */
293/* #define USB_INTR_ENABLE GIMSK */
294/* #define USB_INTR_ENABLE_BIT INT0 */
295/* #define USB_INTR_PENDING GIFR */
296/* #define USB_INTR_PENDING_BIT INTF0 */
297/* #define USB_INTR_VECTOR INT0_vect */
298
299#endif /* __usbconfig_h_included__ */