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