Rev Author Line No. Line
3471 miho 1 /* Name: usbconfig.h
2 * Project: AVR USB driver
3 * Author: Christian Starkjohann, Thomas Fischl
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) or proprietary (CommercialLicense.txt)
8 */
9  
10 #ifndef __usbconfig_h_included__
11 #define __usbconfig_h_included__
12  
13 /*
14 General Description:
15 This file contains parts of the USB driver which can be configured and can or
16 must be adapted to your hardware.
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 /* ---------------------------- Hardware Config ---------------------------- */
24  
3472 miho 25 #define USB_COUNT_SOF 0
26 /* Define this to 1 if interrupt is conected to D- signal
27 */
28  
29 #define USB_CFG_IOPORTNAME D
3471 miho 30 /* This is the port where the USB bus is connected. When you configure it to
31 * "B", the registers PORTB, PINB and DDRB will be used.
32 */
3472 miho 33 #define USB_CFG_DMINUS_BIT 4
3471 miho 34 /* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
35 * This may be any bit in the port.
36 */
3472 miho 37 #define USB_CFG_DPLUS_BIT 2
3471 miho 38 /* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
39 * This may be any bit in the port. Please note that D+ must also be connected
40 * to interrupt pin INT0!
41 */
42 #define USB_CFG_CLOCK_KHZ 12000
43 /* Clock rate of the AVR in MHz. Legal values are 12000, 16000 or 16500.
44 * The 16.5 MHz version of the code requires no crystal, it tolerates +/- 1%
45 * deviation from the nominal frequency. All other rates require a precision
46 * of 2000 ppm and thus a crystal!
47 * Default if not specified: 12 MHz
48 */
49  
50 /* ----------------------- Optional Hardware Config ------------------------ */
51  
52 /* #define USB_CFG_PULLUP_IOPORTNAME D */
53 /* If you connect the 1.5k pullup resistor from D- to a port pin instead of
54 * V+, you can connect and disconnect the device from firmware by calling
55 * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
56 * This constant defines the port on which the pullup resistor is connected.
57 */
58 /* #define USB_CFG_PULLUP_BIT 4 */
59 /* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
60 * above) where the 1.5k pullup resistor is connected. See description
61 * above for details.
62 */
63  
64 /* --------------------------- Functional Range ---------------------------- */
65  
66 #define USB_CFG_HAVE_INTRIN_ENDPOINT 0
67 /* Define this to 1 if you want to compile a version with two endpoints: The
68 * default control endpoint 0 and an interrupt-in endpoint 1.
69 */
70 #define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
71 /* Define this to 1 if you want to compile a version with three endpoints: The
72 * default control endpoint 0, an interrupt-in endpoint 1 and an interrupt-in
73 * endpoint 3. You must also enable endpoint 1 above.
74 */
75 #define USB_CFG_IMPLEMENT_HALT 0
76 /* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
77 * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
78 * it is required by the standard. We have made it a config option because it
79 * bloats the code considerably.
80 */
81 #define USB_CFG_INTR_POLL_INTERVAL 10
82 /* If you compile a version with endpoint 1 (interrupt-in), this is the poll
83 * interval. The value is in milliseconds and must not be less than 10 ms for
84 * low speed devices.
85 */
86 #define USB_CFG_IS_SELF_POWERED 0
87 /* Define this to 1 if the device has its own power supply. Set it to 0 if the
88 * device is powered from the USB bus.
89 */
90 #define USB_CFG_MAX_BUS_POWER 50
91 /* Set this variable to the maximum USB bus power consumption of your device.
92 * The value is in milliamperes. [It will be divided by two since USB
93 * communicates power requirements in units of 2 mA.]
94 */
95 #define USB_CFG_IMPLEMENT_FN_WRITE 1
96 /* Set this to 1 if you want usbFunctionWrite() to be called for control-out
97 * transfers. Set it to 0 if you don't need it and want to save a couple of
98 * bytes.
99 */
100 #define USB_CFG_IMPLEMENT_FN_READ 1
101 /* Set this to 1 if you need to send control replies which are generated
102 * "on the fly" when usbFunctionRead() is called. If you only want to send
103 * data from a static buffer, set it to 0 and return the data from
104 * usbFunctionSetup(). This saves a couple of bytes.
105 */
106 #define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
107 /* Define this to 1 if you want to use interrupt-out (or bulk out) endpoint 1.
108 * You must implement the function usbFunctionWriteOut() which receives all
109 * interrupt/bulk data sent to endpoint 1.
110 */
111 #define USB_CFG_HAVE_FLOWCONTROL 0
112 /* Define this to 1 if you want flowcontrol over USB data. See the definition
113 * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
114 * usbdrv.h.
115 */
116  
117 /* -------------------------- Device Description --------------------------- */
118  
119 #define USB_CFG_VENDOR_ID 0xc0, 0x16 /* 5824 in dec, stands for VOTI */
120 /* USB vendor ID for the device, low byte first. If you have registered your
121 * own Vendor ID, define it here. Otherwise you use obdev's free shared
122 * VID/PID pair. Be sure to read USBID-License.txt for rules!
123 */
124 #define USB_CFG_DEVICE_ID 0xdc, 0x05 /* 1500 in dec, obdev's free PID */
125 /* This is the ID of the product, low byte first. It is interpreted in the
126 * scope of the vendor ID. If you have registered your own VID with usb.org
127 * or if you have licensed a PID from somebody else, define it here. Otherwise
128 * you use obdev's free shared VID/PID pair. Be sure to read the rules in
129 * USBID-License.txt!
130 */
131 #define USB_CFG_DEVICE_VERSION 0x04, 0x01
132 /* Version number of the device: Minor number first, then major number.
133 */
134 #define USB_CFG_VENDOR_NAME 'w', 'w', 'w', '.', 'f', 'i', 's', 'c', 'h', 'l', '.', 'd', 'e'
135 #define USB_CFG_VENDOR_NAME_LEN 13
136 /* These two values define the vendor name returned by the USB device. The name
137 * must be given as a list of characters under single quotes. The characters
138 * are interpreted as Unicode (UTF-16) entities.
139 * If you don't want a vendor name string, undefine these macros.
140 * ALWAYS define a vendor name containing your Internet domain name if you use
141 * obdev's free shared VID/PID pair. See the file USBID-License.txt for
142 * details.
143 */
144 #define USB_CFG_DEVICE_NAME 'U', 'S', 'B', 'a', 's', 'p'
145 #define USB_CFG_DEVICE_NAME_LEN 6
146 /* Same as above for the device name. If you don't want a device name, undefine
147 * the macros. See the file USBID-License.txt before you assign a name.
148 */
149 /*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
150 /*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
151 /* Same as above for the serial number. If you don't want a serial number,
152 * undefine the macros.
153 * It may be useful to provide the serial number through other means than at
154 * compile time. See the section about descriptor properties below for how
155 * to fine tune control over USB descriptors such as the string descriptor
156 * for the serial number.
157 */
158 #define USB_CFG_DEVICE_CLASS 0xff
159 #define USB_CFG_DEVICE_SUBCLASS 0
160 /* See USB specification if you want to conform to an existing device class.
161 */
162 #define USB_CFG_INTERFACE_CLASS 0
163 #define USB_CFG_INTERFACE_SUBCLASS 0
164 #define USB_CFG_INTERFACE_PROTOCOL 0
165 /* See USB specification if you want to conform to an existing device class or
166 * protocol.
167 */
168 #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 /* total length of report descriptor */
169 /* Define this to the length of the HID report descriptor, if you implement
170 * an HID device. Otherwise don't define it or define it to 0.
171 */
172  
173 /* ------------------- Fine Control over USB Descriptors ------------------- */
174 /* If you don't want to use the driver's default USB descriptors, you can
175 * provide our own. These can be provided as (1) fixed length static data in
176 * flash memory, (2) fixed length static data in RAM or (3) dynamically at
177 * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
178 * information about this function.
179 * Descriptor handling is configured through the descriptor's properties. If
180 * no properties are defined or if they are 0, the default descriptor is used.
181 * Possible properties are:
182 * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
183 * at runtime via usbFunctionDescriptor().
184 * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
185 * in static memory is in RAM, not in flash memory.
186 * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
187 * the driver must know the descriptor's length. The descriptor itself is
188 * found at the address of a well known identifier (see below).
189 * List of static descriptor names (must be declared PROGMEM if in flash):
190 * char usbDescriptorDevice[];
191 * char usbDescriptorConfiguration[];
192 * char usbDescriptorHidReport[];
193 * char usbDescriptorString0[];
194 * int usbDescriptorStringVendor[];
195 * int usbDescriptorStringDevice[];
196 * int usbDescriptorStringSerialNumber[];
197 * Other descriptors can't be provided statically, they must be provided
198 * dynamically at runtime.
199 *
200 * Descriptor properties are or-ed or added together, e.g.:
201 * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
202 *
203 * The following descriptors are defined:
204 * USB_CFG_DESCR_PROPS_DEVICE
205 * USB_CFG_DESCR_PROPS_CONFIGURATION
206 * USB_CFG_DESCR_PROPS_STRINGS
207 * USB_CFG_DESCR_PROPS_STRING_0
208 * USB_CFG_DESCR_PROPS_STRING_VENDOR
209 * USB_CFG_DESCR_PROPS_STRING_PRODUCT
210 * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
211 * USB_CFG_DESCR_PROPS_HID
212 * USB_CFG_DESCR_PROPS_HID_REPORT
213 * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
214 *
215 */
216  
217 #define USB_CFG_DESCR_PROPS_DEVICE 0
218 #define USB_CFG_DESCR_PROPS_CONFIGURATION 0
219 #define USB_CFG_DESCR_PROPS_STRINGS 0
220 #define USB_CFG_DESCR_PROPS_STRING_0 0
221 #define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
222 #define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
223 #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
224 #define USB_CFG_DESCR_PROPS_HID 0
225 #define USB_CFG_DESCR_PROPS_HID_REPORT 0
226 #define USB_CFG_DESCR_PROPS_UNKNOWN 0
227  
228 /* ----------------------- Optional MCU Description ------------------------ */
229  
230 /* The following configurations have working defaults in usbdrv.h. You
231 * usually don't need to set them explicitly. Only if you want to run
232 * the driver on a device which is not yet supported or with a compiler
233 * which is not fully supported (such as IAR C) or if you use a differnt
234 * interrupt than INT0, you may have to define some of these.
235 */
236 /* #define USB_INTR_CFG MCUCR */
237 /* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
238 /* #define USB_INTR_CFG_CLR 0 */
239 /* #define USB_INTR_ENABLE GIMSK */
240 /* #define USB_INTR_ENABLE_BIT INT0 */
241 /* #define USB_INTR_PENDING GIFR */
242 /* #define USB_INTR_PENDING_BIT INTF0 */
243  
244 #endif /* __usbconfig_h_included__ */