1 | /* Name: usbconfig.h
|
---|
2 | * Project: AVR USB driver
|
---|
3 | * Author: Christian Starkjohann
|
---|
4 | * Creation Date: 2007-12-08
|
---|
5 | * Tabsize: 4
|
---|
6 | * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
|
---|
7 | * License: GNU GPL v2 (see License.txt)
|
---|
8 | * This Revision: $Id: usbconfig.h 449 2007-12-13 22:25:49Z cs $
|
---|
9 | */
|
---|
10 |
|
---|
11 | #ifndef __usbconfig_h_included__
|
---|
12 | #define __usbconfig_h_included__
|
---|
13 |
|
---|
14 | /*
|
---|
15 | General Description:
|
---|
16 | This file contains the configuration options for the USB driver.
|
---|
17 |
|
---|
18 | Please note that the usbdrv contains a usbconfig-prototype.h file now. We
|
---|
19 | recommend that you use that file as a template because it will always list
|
---|
20 | the newest features and options.
|
---|
21 | */
|
---|
22 |
|
---|
23 | /* Fetch the hardware configuration from bootloaderconfig.h so that we have a
|
---|
24 | * single file where hardware settings are stored.
|
---|
25 | * Do not edit the functional settings below.
|
---|
26 | */
|
---|
27 | #include "bootloaderconfig.h"
|
---|
28 |
|
---|
29 | #define USB_PUBLIC static
|
---|
30 | /* Use the define above if you #include usbdrv.c instead of linking against it.
|
---|
31 | * This technique saves a couple of bytes in flash memory.
|
---|
32 | */
|
---|
33 |
|
---|
34 | /* --------------------------- Functional Range ---------------------------- */
|
---|
35 |
|
---|
36 | #define USB_CFG_HAVE_INTRIN_ENDPOINT 0
|
---|
37 | /* Define this to 1 if you want to compile a version with two endpoints: The
|
---|
38 | * default control endpoint 0 and an interrupt-in endpoint 1.
|
---|
39 | */
|
---|
40 | #define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
|
---|
41 | /* Define this to 1 if you want to compile a version with three endpoints: The
|
---|
42 | * default control endpoint 0, an interrupt-in endpoint 1 and an interrupt-in
|
---|
43 | * endpoint 3. You must also enable endpoint 1 above.
|
---|
44 | */
|
---|
45 | #define USB_CFG_IMPLEMENT_HALT 0
|
---|
46 | /* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
---|
47 | * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
---|
48 | * it is required by the standard. We have made it a config option because it
|
---|
49 | * bloats the code considerably.
|
---|
50 | */
|
---|
51 | #define USB_CFG_INTR_POLL_INTERVAL 200
|
---|
52 | /* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
---|
53 | * interval. The value is in milliseconds and must not be less than 10 ms for
|
---|
54 | * low speed devices.
|
---|
55 | */
|
---|
56 | #define USB_CFG_IS_SELF_POWERED 0
|
---|
57 | /* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
---|
58 | * device is powered from the USB bus.
|
---|
59 | */
|
---|
60 | #define USB_CFG_MAX_BUS_POWER 100
|
---|
61 | /* Set this variable to the maximum USB bus power consumption of your device.
|
---|
62 | * The value is in milliamperes. [It will be divided by two since USB
|
---|
63 | * communicates power requirements in units of 2 mA.]
|
---|
64 | */
|
---|
65 | #define USB_CFG_IMPLEMENT_FN_WRITE 1
|
---|
66 | /* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
---|
67 | * transfers. Set it to 0 if you don't need it and want to save a couple of
|
---|
68 | * bytes.
|
---|
69 | */
|
---|
70 | #define USB_CFG_IMPLEMENT_FN_READ 1
|
---|
71 | /* Set this to 1 if you need to send control replies which are generated
|
---|
72 | * "on the fly" when usbFunctionRead() is called. If you only want to send
|
---|
73 | * data from a static buffer, set it to 0 and return the data from
|
---|
74 | * usbFunctionSetup(). This saves a couple of bytes.
|
---|
75 | */
|
---|
76 | #define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
---|
77 | /* Define this to 1 if you want to use interrupt-out (or bulk out) endpoint 1.
|
---|
78 | * You must implement the function usbFunctionWriteOut() which receives all
|
---|
79 | * interrupt/bulk data sent to endpoint 1.
|
---|
80 | */
|
---|
81 | #define USB_CFG_HAVE_FLOWCONTROL 0
|
---|
82 | /* Define this to 1 if you want flowcontrol over USB data. See the definition
|
---|
83 | * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
---|
84 | * usbdrv.h.
|
---|
85 | */
|
---|
86 |
|
---|
87 | /* -------------------------- Device Description --------------------------- */
|
---|
88 |
|
---|
89 | #define USB_CFG_VENDOR_ID 0xc0, 0x16 /* 5824 in dec, stands for VOTI */
|
---|
90 | /* USB vendor ID for the device, low byte first. If you have registered your
|
---|
91 | * own Vendor ID, define it here. Otherwise you use obdev's free shared
|
---|
92 | * VID/PID pair. Be sure to read USBID-License.txt for rules!
|
---|
93 | */
|
---|
94 | #define USB_CFG_DEVICE_ID 0xdc, 0x05 /* 1500 in dec, obdev's free PID */
|
---|
95 | /* This is the ID of the product, low byte first. It is interpreted in the
|
---|
96 | * scope of the vendor ID. If you have registered your own VID with usb.org
|
---|
97 | * or if you have licensed a PID from somebody else, define it here. Otherwise
|
---|
98 | * you use obdev's free shared VID/PID pair. Be sure to read the rules in
|
---|
99 | * USBID-License.txt!
|
---|
100 | */
|
---|
101 | #define USB_CFG_DEVICE_VERSION 0x02, 0x01
|
---|
102 | /* Version number of the device: Minor number first, then major number.
|
---|
103 | */
|
---|
104 | #define USB_CFG_VENDOR_NAME 'w', 'w', 'w', '.', 'f', 'i', 's', 'c', 'h', 'l', '.', 'd', 'e'
|
---|
105 | #define USB_CFG_VENDOR_NAME_LEN 13
|
---|
106 | /* These two values define the vendor name returned by the USB device. The name
|
---|
107 | * must be given as a list of characters under single quotes. The characters
|
---|
108 | * are interpreted as Unicode (UTF-16) entities.
|
---|
109 | * If you don't want a vendor name string, undefine these macros.
|
---|
110 | * ALWAYS define a vendor name containing your Internet domain name if you use
|
---|
111 | * obdev's free shared VID/PID pair. See the file USBID-License.txt for
|
---|
112 | * details.
|
---|
113 | */
|
---|
114 | #define USB_CFG_DEVICE_NAME 'U', 'S', 'B', 'a', 's', 'p'
|
---|
115 | #define USB_CFG_DEVICE_NAME_LEN 6
|
---|
116 | /* Same as above for the device name. If you don't want a device name, undefine
|
---|
117 | * the macros. See the file USBID-License.txt before you assign a name.
|
---|
118 | */
|
---|
119 | /*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
---|
120 | /*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
---|
121 | /* Same as above for the serial number. If you don't want a serial number,
|
---|
122 | * undefine the macros.
|
---|
123 | * It may be useful to provide the serial number through other means than at
|
---|
124 | * compile time. See the section about descriptor properties below for how
|
---|
125 | * to fine tune control over USB descriptors such as the string descriptor
|
---|
126 | * for the serial number.
|
---|
127 | */
|
---|
128 | #define USB_CFG_DEVICE_CLASS 0xff
|
---|
129 | #define USB_CFG_DEVICE_SUBCLASS 0
|
---|
130 | /* See USB specification if you want to conform to an existing device class.
|
---|
131 | */
|
---|
132 | #define USB_CFG_INTERFACE_CLASS 0
|
---|
133 | #define USB_CFG_INTERFACE_SUBCLASS 0
|
---|
134 | #define USB_CFG_INTERFACE_PROTOCOL 0
|
---|
135 | /* See USB specification if you want to conform to an existing device class or
|
---|
136 | * protocol.
|
---|
137 | */
|
---|
138 | #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 /* total length of report descriptor */
|
---|
139 | /* Define this to the length of the HID report descriptor, if you implement
|
---|
140 | * an HID device. Otherwise don't define it or define it to 0.
|
---|
141 | */
|
---|
142 |
|
---|
143 | /* ------------------- Fine Control over USB Descriptors ------------------- */
|
---|
144 | /* If you don't want to use the driver's default USB descriptors, you can
|
---|
145 | * provide our own. These can be provided as (1) fixed length static data in
|
---|
146 | * flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
---|
147 | * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
---|
148 | * information about this function.
|
---|
149 | * Descriptor handling is configured through the descriptor's properties. If
|
---|
150 | * no properties are defined or if they are 0, the default descriptor is used.
|
---|
151 | * Possible properties are:
|
---|
152 | * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
---|
153 | * at runtime via usbFunctionDescriptor().
|
---|
154 | * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
---|
155 | * in static memory is in RAM, not in flash memory.
|
---|
156 | * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
---|
157 | * the driver must know the descriptor's length. The descriptor itself is
|
---|
158 | * found at the address of a well known identifier (see below).
|
---|
159 | * List of static descriptor names (must be declared PROGMEM if in flash):
|
---|
160 | * char usbDescriptorDevice[];
|
---|
161 | * char usbDescriptorConfiguration[];
|
---|
162 | * char usbDescriptorHidReport[];
|
---|
163 | * char usbDescriptorString0[];
|
---|
164 | * int usbDescriptorStringVendor[];
|
---|
165 | * int usbDescriptorStringDevice[];
|
---|
166 | * int usbDescriptorStringSerialNumber[];
|
---|
167 | * Other descriptors can't be provided statically, they must be provided
|
---|
168 | * dynamically at runtime.
|
---|
169 | *
|
---|
170 | * Descriptor properties are or-ed or added together, e.g.:
|
---|
171 | * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
---|
172 | *
|
---|
173 | * The following descriptors are defined:
|
---|
174 | * USB_CFG_DESCR_PROPS_DEVICE
|
---|
175 | * USB_CFG_DESCR_PROPS_CONFIGURATION
|
---|
176 | * USB_CFG_DESCR_PROPS_STRINGS
|
---|
177 | * USB_CFG_DESCR_PROPS_STRING_0
|
---|
178 | * USB_CFG_DESCR_PROPS_STRING_VENDOR
|
---|
179 | * USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
---|
180 | * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
---|
181 | * USB_CFG_DESCR_PROPS_HID
|
---|
182 | * USB_CFG_DESCR_PROPS_HID_REPORT
|
---|
183 | * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
---|
184 | *
|
---|
185 | */
|
---|
186 |
|
---|
187 | #define USB_CFG_DESCR_PROPS_DEVICE 0
|
---|
188 | #define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
---|
189 | #define USB_CFG_DESCR_PROPS_STRINGS 0
|
---|
190 | #define USB_CFG_DESCR_PROPS_STRING_0 0
|
---|
191 | #define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
---|
192 | #define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
---|
193 | #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
---|
194 | #define USB_CFG_DESCR_PROPS_HID 0
|
---|
195 | #define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
---|
196 | #define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
---|
197 |
|
---|
198 | /* ----------------------- Optional MCU Description ------------------------ */
|
---|
199 |
|
---|
200 | /* The following configurations have working defaults in usbdrv.h. You
|
---|
201 | * usually don't need to set them explicitly. Only if you want to run
|
---|
202 | * the driver on a device which is not yet supported or with a compiler
|
---|
203 | * which is not fully supported (such as IAR C) or if you use a differnt
|
---|
204 | * interrupt than INT0, you may have to define some of these.
|
---|
205 | */
|
---|
206 | /* #define USB_INTR_CFG MCUCR */
|
---|
207 | /* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
---|
208 | /* #define USB_INTR_CFG_CLR 0 */
|
---|
209 | /* #define USB_INTR_ENABLE GIMSK */
|
---|
210 | /* #define USB_INTR_ENABLE_BIT INT0 */
|
---|
211 | /* #define USB_INTR_PENDING GIFR */
|
---|
212 | /* #define USB_INTR_PENDING_BIT INTF0 */
|
---|
213 |
|
---|
214 | #endif /* __usbconfig_h_included__ */
|
---|