Browse Source

init

master
Robin THONI 3 years ago
commit
c7e0c6f7f5

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+/.idea

+ 34
- 0
ArduinoNotes.txt View File

@@ -0,0 +1,34 @@
1
+Notes On Integrating AVRUSB with Arduino
2
+========================================
3
+
4
+* Note the license(s) under which AVRUSB is distributed.
5
+
6
+* See also: http://code.rancidbacon.com/ProjectLogArduinoUSB
7
+
8
+* Note: The pins we use on the PCB (not protoboard) hardware shield are:
9
+
10
+     INT0 == PD2 == IC Pin 4 == Arduino Digital Pin 2 == D+
11
+
12
+     ---- == PD4 == -------- == Arduino Digital Pin 4 == D-
13
+
14
+     ---- == PD5 == -------- == Arduino Digital Pin 5 == pull-up
15
+
16
+  (DONE: Change to not use PD3 so INT1 is left free?)
17
+
18
+* In order to compile a valid 'usbconfig.h' file must exit. The content of this
19
+  file will vary depending on whether the device is a generic USB device,
20
+  generic HID device or specific class of HID device for example.
21
+
22
+  The file 'usbconfig-prototype.h' can be used as a starting point, however
23
+  it might be easier to use the 'usbconfig.h' from one of the example projects.
24
+
25
+  TODO: Specify the settings that need to be changed to match the shield
26
+        design we use.
27
+
28
+* (NOTE: Initial 'usbconfig.h' used will be based on the file from
29
+ 'HIDKeys.2007-03-29'.) (Note: Have now upgraded to V-USB 2009-08-22.)
30
+
31
+* Versions of the Arduino IDE prior to 0018 won't compile our library
32
+  so it needs to be pre-compiled with:
33
+
34
+    avr-g++  -Wall -Os -I. -DF_CPU=16000000 -mmcu=atmega168  -c usbdrvasm.S  -c usbdrv.c

+ 296
- 0
Changelog.txt View File

@@ -0,0 +1,296 @@
1
+This file documents changes in the firmware-only USB driver for atmel's AVR
2
+microcontrollers. New entries are always appended to the end of the file.
3
+Scroll down to the bottom to see the most recent changes.
4
+
5
+2005-04-01:
6
+  - Implemented endpoint 1 as interrupt-in endpoint.
7
+  - Moved all configuration options to usbconfig.h which is not part of the
8
+    driver.
9
+  - Changed interface for usbVendorSetup().
10
+  - Fixed compatibility with ATMega8 device.
11
+  - Various minor optimizations.
12
+
13
+2005-04-11:
14
+  - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead()
15
+    and usbFunctionWrite() now. Added configuration options to choose which
16
+    of these functions to compile in.
17
+  - Assembler module delivers receive data non-inverted now.
18
+  - Made register and bit names compatible with more AVR devices.
19
+
20
+2005-05-03:
21
+  - Allow address of usbRxBuf on any memory page as long as the buffer does
22
+    not cross 256 byte page boundaries.
23
+  - Better device compatibility: works with Mega88 now.
24
+  - Code optimization in debugging module.
25
+  - Documentation updates.
26
+
27
+2006-01-02:
28
+  - Added (free) default Vendor- and Product-IDs bought from voti.nl.
29
+  - Added USBID-License.txt file which defines the rules for using the free
30
+    shared VID/PID pair.
31
+  - Added Readme.txt to the usbdrv directory which clarifies administrative
32
+    issues.
33
+
34
+2006-01-25:
35
+  - Added "configured state" to become more standards compliant.
36
+  - Added "HALT" state for interrupt endpoint.
37
+  - Driver passes the "USB Command Verifier" test from usb.org now.
38
+  - Made "serial number" a configuration option.
39
+  - Minor optimizations, we now recommend compiler option "-Os" for best
40
+    results.
41
+  - Added a version number to usbdrv.h
42
+
43
+2006-02-03:
44
+  - New configuration variable USB_BUFFER_SECTION for the memory section where
45
+    the USB rx buffer will go. This defaults to ".bss" if not defined. Since
46
+    this buffer MUST NOT cross 256 byte pages (not even touch a page at the
47
+    end), the user may want to pass a linker option similar to
48
+    "-Wl,--section-start=.mybuffer=0x800060".
49
+  - Provide structure for usbRequest_t.
50
+  - New defines for USB constants.
51
+  - Prepared for HID implementations.
52
+  - Increased data size limit for interrupt transfers to 8 bytes.
53
+  - New macro usbInterruptIsReady() to query interrupt buffer state.
54
+
55
+2006-02-18:
56
+  - Ensure that the data token which is sent as an ack to an OUT transfer is
57
+    always zero sized. This fixes a bug where the host reports an error after
58
+    sending an out transfer to the device, although all data arrived at the
59
+    device.
60
+  - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite().
61
+
62
+* Release 2006-02-20
63
+
64
+  - Give a compiler warning when compiling with debugging turned on.
65
+  - Added Oleg Semyonov's changes for IAR-cc compatibility.
66
+  - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect()
67
+    (also thanks to Oleg!).
68
+  - Rearranged tests in usbPoll() to save a couple of instructions in the most
69
+    likely case that no actions are pending.
70
+  - We need a delay between the SET ADDRESS request until the new address
71
+    becomes active. This delay was handled in usbPoll() until now. Since the
72
+    spec says that the delay must not exceed 2ms, previous versions required
73
+    aggressive polling during the enumeration phase. We have now moved the
74
+    handling of the delay into the interrupt routine.
75
+  - We must not reply with NAK to a SETUP transaction. We can only achieve this
76
+    by making sure that the rx buffer is empty when SETUP tokens are expected.
77
+    We therefore don't pass zero sized data packets from the status phase of
78
+    a transfer to usbPoll(). This change MAY cause troubles if you rely on
79
+    receiving a less than 8 bytes long packet in usbFunctionWrite() to
80
+    identify the end of a transfer. usbFunctionWrite() will NEVER be called
81
+    with a zero length.
82
+
83
+* Release 2006-03-14
84
+
85
+  - Improved IAR C support: tiny memory model, more devices
86
+  - Added template usbconfig.h file under the name usbconfig-prototype.h
87
+
88
+* Release 2006-03-26
89
+
90
+  - Added provision for one more interrupt-in endpoint (endpoint 3).
91
+  - Added provision for one interrupt-out endpoint (endpoint 1).
92
+  - Added flowcontrol macros for USB.
93
+  - Added provision for custom configuration descriptor.
94
+  - Allow ANY two port bits for D+ and D-.
95
+  - Merged (optional) receive endpoint number into global usbRxToken variable.
96
+  - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the
97
+    variable name from the single port letter instead of computing the address
98
+    of related ports from the output-port address.
99
+
100
+* Release 2006-06-26
101
+
102
+  - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the
103
+    new features.
104
+  - Removed "#warning" directives because IAR does not understand them. Use
105
+    unused static variables instead to generate a warning.
106
+  - Do not include <avr/io.h> when compiling with IAR.
107
+  - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each
108
+    USB descriptor should be handled. It is now possible to provide descriptor
109
+    data in Flash, RAM or dynamically at runtime.
110
+  - STALL is now a status in usbTxLen* instead of a message. We can now conform
111
+    to the spec and leave the stall status pending until it is cleared.
112
+  - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the
113
+    application code to reset data toggling on interrupt pipes.
114
+
115
+* Release 2006-07-18
116
+
117
+  - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes
118
+    an assembler error.
119
+  - usbDeviceDisconnect() takes pull-up resistor to high impedance now.
120
+
121
+* Release 2007-02-01
122
+
123
+  - Merged in some code size improvements from usbtiny (thanks to Dick
124
+    Streefland for these optimizations!)
125
+  - Special alignment requirement for usbRxBuf not required any more. Thanks
126
+    again to Dick Streefland for this hint!
127
+  - Reverted to "#warning" instead of unused static variables -- new versions
128
+    of IAR CC should handle this directive.
129
+  - Changed Open Source license to GNU GPL v2 in order to make linking against
130
+    other free libraries easier. We no longer require publication of the
131
+    circuit diagrams, but we STRONGLY encourage it. If you improve the driver
132
+    itself, PLEASE grant us a royalty free license to your changes for our
133
+    commercial license.
134
+
135
+* Release 2007-03-29
136
+
137
+  - New configuration option "USB_PUBLIC" in usbconfig.h.
138
+  - Set USB version number to 1.10 instead of 1.01.
139
+  - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and
140
+    USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences
141
+    to USB_CFG_DESCR_PROPS_STRING_PRODUCT.
142
+  - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver
143
+    code.
144
+  - New assembler module for 16 MHz crystal.
145
+  - usbdrvasm.S contains common code only, clock-specific parts have been moved
146
+    to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively.
147
+
148
+* Release 2007-06-25
149
+
150
+  - 16 MHz module: Do SE0 check in stuffed bits as well.
151
+
152
+* Release 2007-07-07
153
+
154
+  - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary
155
+    for negative values.
156
+  - Added 15 MHz module contributed by V. Bosch.
157
+  - Interrupt vector name can now be configured. This is useful if somebody
158
+    wants to use a different hardware interrupt than INT0.
159
+
160
+* Release 2007-08-07
161
+
162
+  - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is
163
+    not exceeded.
164
+  - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN,
165
+    USB_COUNT_SOF
166
+  - USB_INTR_PENDING can now be a memory address, not just I/O
167
+
168
+* Release 2007-09-19
169
+
170
+  - Split out common parts of assembler modules into separate include file
171
+  - Made endpoint numbers configurable so that given interface definitions
172
+    can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h.
173
+  - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut()
174
+    can handle any number of endpoints.
175
+  - Define usbDeviceConnect() and usbDeviceDisconnect() even if no
176
+    USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this
177
+    case.
178
+
179
+* Release 2007-12-01
180
+
181
+  - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size
182
+    when USB_CFG_PULLUP_IOPORTNAME is not defined.
183
+
184
+* Release 2007-12-13
185
+
186
+  - Renamed all include-only assembler modules from *.S to *.inc so that
187
+    people don't add them to their project sources.
188
+  - Distribute leap bits in tx loop more evenly for 16 MHz module.
189
+  - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR
190
+  - Avoid compiler warnings for constant expr range by casting some values in
191
+    USB descriptors.
192
+
193
+* Release 2008-01-21
194
+
195
+  - Fixed bug in 15 and 16 MHz module where the new address set with
196
+    SET_ADDRESS was already accepted at the next NAK or ACK we send, not at
197
+    the next data packet we send. This caused problems when the host polled
198
+    too fast. Thanks to Alexander Neumann for his help and patience debugging
199
+    this issue!
200
+
201
+* Release 2008-02-05
202
+
203
+  - Fixed bug in 16.5 MHz module where a register was used in the interrupt
204
+    handler before it was pushed. This bug was introduced with version
205
+    2007-09-19 when common parts were moved to a separate file.
206
+  - Optimized CRC routine (thanks to Reimar Doeffinger).
207
+
208
+* Release 2008-02-16
209
+
210
+  - Removed outdated IAR compatibility stuff (code sections).
211
+  - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK().
212
+  - Added optional routine usbMeasureFrameLength() for calibration of the
213
+    internal RC oscillator.
214
+
215
+* Release 2008-02-28
216
+
217
+  - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we
218
+    start with sending USBPID_DATA0.
219
+  - Changed defaults in usbconfig-prototype.h
220
+  - Added free USB VID/PID pair for MIDI class devices
221
+  - Restructured AVR-USB as separate package, not part of PowerSwitch any more.
222
+
223
+* Release 2008-04-18
224
+
225
+  - Restructured usbdrv.c so that it is easier to read and understand.
226
+  - Better code optimization with gcc 4.
227
+  - If a second interrupt in endpoint is enabled, also add it to config
228
+    descriptor.
229
+  - Added config option for long transfers (above 254 bytes), see
230
+    USB_CFG_LONG_TRANSFERS in usbconfig.h.
231
+  - Added 20 MHz module contributed by Jeroen Benschop.
232
+
233
+* Release 2008-05-13
234
+
235
+  - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length
236
+    was not incremented, pointer to length was incremented instead.
237
+  - Added code to command line tool(s) which claims an interface. This code
238
+    is disabled by default, but may be necessary on newer Linux kernels.
239
+  - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING".
240
+  - New header "usbportability.h" prepares ports to other development
241
+    environments.
242
+  - Long transfers (above 254 bytes) did not work when usbFunctionRead() was
243
+    used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!]
244
+  - In hiddata.c (example code for sending/receiving data over HID), use
245
+    USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so
246
+    that we need not claim the interface.
247
+  - in usbPoll() loop 20 times polling for RESET state instead of 10 times.
248
+    This accounts for the higher clock rates we now support.
249
+  - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop.
250
+  - Added hook to SOF code so that oscillator can be tuned to USB frame clock.
251
+  - Added timeout to waitForJ loop. Helps preventing unexpected hangs.
252
+  - Added example code for oscillator tuning to libs-device (thanks to
253
+    Henrik Haftmann for the idea to this routine).
254
+  - Implemented option USB_CFG_SUPPRESS_INTR_CODE.
255
+
256
+* Release 2008-10-22
257
+
258
+  - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and
259
+    similar, not offset of 0x20 needs to be added.
260
+  - Allow distribution under GPLv3 for those who have to link against other
261
+    code distributed under GPLv3.
262
+
263
+* Release 2008-11-26
264
+
265
+  - Removed libusb-win32 dependency for hid-data example in Makefile.windows.
266
+    It was never required and confused many people.
267
+  - Added extern uchar usbRxToken to usbdrv.h.
268
+  - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser.
269
+
270
+* Release 2009-03-23
271
+
272
+  - Hid-mouse example used settings from hid-data example, fixed that.
273
+  - Renamed project to V-USB due to a trademark issue with Atmel(r).
274
+  - Changed CommercialLicense.txt and USBID-License.txt to make the
275
+    background of USB ID registration clearer.
276
+
277
+* Release 2009-04-15
278
+
279
+  - Changed CommercialLicense.txt to reflect the new range of PIDs from
280
+    Jason Kotzin.
281
+  - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and
282
+    USB-ID-FAQ.txt
283
+  - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in
284
+    the center between bit 0 and 1 of each byte. This is where the data lines
285
+    are expected to change and the sampled data may therefore be nonsense.
286
+    We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-.
287
+  - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed,
288
+    the unstuffing code in the receiver routine was 1 cycle too long. If
289
+    multiple bytes had the unstuffing in bit 6, the error summed up until the
290
+    receiver was out of sync.
291
+  - Included option for faster CRC routine.
292
+    Thanks to Slawomir Fras (BoskiDialer) for this code!
293
+  - Updated bits in Configuration Descriptor's bmAttributes according to
294
+    USB 1.1 (in particular bit 7, it is a must-be-set bit now).
295
+
296
+* Release 2009-08-22

+ 166
- 0
CommercialLicense.txt View File

@@ -0,0 +1,166 @@
1
+V-USB Driver Software License Agreement
2
+Version 2009-08-03
3
+
4
+THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN
5
+ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING
6
+THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT.
7
+
8
+
9
+1 DEFINITIONS
10
+
11
+1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH,
12
+Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA.
13
+
14
+1.2 "You" shall mean the Licensee.
15
+
16
+1.3 "V-USB" shall mean all files included in the package distributed under
17
+the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/)
18
+unless otherwise noted. This includes the firmware-only USB device
19
+implementation for Atmel AVR microcontrollers, some simple device examples
20
+and host side software examples and libraries.
21
+
22
+
23
+2 LICENSE GRANTS
24
+
25
+2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source
26
+code of V-USB.
27
+
28
+2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the
29
+non-exclusive right to use, copy and distribute V-USB with your hardware
30
+product(s), restricted by the limitations in section 3 below.
31
+
32
+2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify
33
+the source code and your copy of V-USB according to your needs.
34
+
35
+2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB
36
+Product ID(s), sent to you in e-mail. These Product IDs are reserved
37
+exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID
38
+ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen
39
+Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from
40
+Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs
41
+have obtained these IDs from the USB Implementers Forum, Inc.
42
+(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might
43
+arise from the assignment of USB IDs.
44
+
45
+2.5 USB Certification. Although not part of this agreement, we want to make
46
+it clear that you cannot become USB certified when you use V-USB or a USB
47
+Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't
48
+meet the electrical specifications required by the USB specification and
49
+the USB Implementers Forum certifies only members who bought a Vendor ID of
50
+their own.
51
+
52
+
53
+3 LICENSE RESTRICTIONS
54
+
55
+3.1 Number of Units. Only one of the following three definitions is
56
+applicable. Which one is determined by the amount you pay to OBJECTIVE
57
+DEVELOPMENT, see section 4 ("Payment") below.
58
+
59
+Hobby License: You may use V-USB according to section 2 above in no more
60
+than 5 hardware units. These units must not be sold for profit.
61
+
62
+Entry Level License: You may use V-USB according to section 2 above in no
63
+more than 150 hardware units.
64
+
65
+Professional License: You may use V-USB according to section 2 above in
66
+any number of hardware units, except for large scale production ("unlimited
67
+fair use"). Quantities below 10,000 units are not considered large scale
68
+production. If your reach quantities which are obviously large scale
69
+production, you must pay a license fee of 0.10 EUR per unit for all units
70
+above 10,000.
71
+
72
+3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber
73
+any copy of V-USB, or any of the rights granted herein.
74
+
75
+3.3 Transfer. You may not transfer your rights under this Agreement to
76
+another party without OBJECTIVE DEVELOPMENT's prior written consent. If
77
+such consent is obtained, you may permanently transfer this License to
78
+another party. The recipient of such transfer must agree to all terms and
79
+conditions of this Agreement.
80
+
81
+3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not
82
+expressly granted.
83
+
84
+3.5 Non-Exclusive Rights. Your license rights under this Agreement are
85
+non-exclusive.
86
+
87
+3.6 Third Party Rights. This Agreement cannot grant you rights controlled
88
+by third parties. In particular, you are not allowed to use the USB logo or
89
+other trademarks owned by the USB Implementers Forum, Inc. without their
90
+consent. Since such consent depends on USB certification, it should be
91
+noted that V-USB will not pass certification because it does not
92
+implement checksum verification and the microcontroller ports do not meet
93
+the electrical specifications.
94
+
95
+
96
+4 PAYMENT
97
+
98
+The payment amount depends on the variation of this agreement (according to
99
+section 3.1) into which you want to enter. Concrete prices are listed on
100
+OBJECTIVE DEVELOPMENT's web site, usually at
101
+http://www.obdev.at/vusb/license.html. You agree to pay the amount listed
102
+there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor
103
+or reseller.
104
+
105
+
106
+5 COPYRIGHT AND OWNERSHIP
107
+
108
+V-USB is protected by copyright laws and international copyright
109
+treaties, as well as other intellectual property laws and treaties. V-USB
110
+is licensed, not sold.
111
+
112
+
113
+6 TERM AND TERMINATION
114
+
115
+6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE
116
+DEVELOPMENT may terminate this Agreement and revoke the granted license and
117
+USB-IDs if you fail to comply with any of its terms and conditions.
118
+
119
+6.2 Survival of Terms. All provisions regarding secrecy, confidentiality
120
+and limitation of liability shall survive termination of this agreement.
121
+
122
+
123
+7 DISCLAIMER OF WARRANTY AND LIABILITY
124
+
125
+LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
126
+KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE
127
+DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER
128
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
129
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
130
+NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE
131
+TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
132
+RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO
133
+STATE/JURISDICTION.
134
+
135
+LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
136
+IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY
137
+SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER
138
+(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
139
+BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY
140
+LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE
141
+PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE
142
+DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY
143
+CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS
144
+AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB.
145
+
146
+
147
+8 MISCELLANEOUS TERMS
148
+
149
+8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing
150
+purposes that you entered into this agreement.
151
+
152
+8.2 Entire Agreement. This document represents the entire agreement between
153
+OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by
154
+an authorized representative of both, OBJECTIVE DEVELOPMENT and you.
155
+
156
+8.3 Severability. In case a provision of these terms and conditions should
157
+be or become partly or entirely invalid, ineffective, or not executable,
158
+the validity of all other provisions shall not be affected.
159
+
160
+8.4 Applicable Law. This agreement is governed by the laws of the Republic
161
+of Austria.
162
+
163
+8.5 Responsible Courts. The responsible courts in Vienna/Austria will have
164
+exclusive jurisdiction regarding all disputes in connection with this
165
+agreement.
166
+

+ 361
- 0
License.txt View File

@@ -0,0 +1,361 @@
1
+OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the
2
+terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is
3
+your choice whether you apply the terms of version 2 or version 3. The full
4
+text of GPLv2 is included below. In addition to the requirements in the GPL,
5
+we STRONGLY ENCOURAGE you to do the following:
6
+
7
+(1) Publish your entire project on a web site and drop us a note with the URL.
8
+Use the form at http://www.obdev.at/vusb/feedback.html for your submission.
9
+
10
+(2) Adhere to minimum publication standards. Please include AT LEAST:
11
+    - a circuit diagram in PDF, PNG or GIF format
12
+    - full source code for the host software
13
+    - a Readme.txt file in ASCII format which describes the purpose of the
14
+      project and what can be found in which directories and which files
15
+    - a reference to http://www.obdev.at/vusb/
16
+
17
+(3) If you improve the driver firmware itself, please give us a free license
18
+to your modifications for our commercial license offerings.
19
+
20
+
21
+
22
+                    GNU GENERAL PUBLIC LICENSE
23
+                       Version 2, June 1991
24
+
25
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
26
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ Everyone is permitted to copy and distribute verbatim copies
28
+ of this license document, but changing it is not allowed.
29
+
30
+                            Preamble
31
+
32
+  The licenses for most software are designed to take away your
33
+freedom to share and change it.  By contrast, the GNU General Public
34
+License is intended to guarantee your freedom to share and change free
35
+software--to make sure the software is free for all its users.  This
36
+General Public License applies to most of the Free Software
37
+Foundation's software and to any other program whose authors commit to
38
+using it.  (Some other Free Software Foundation software is covered by
39
+the GNU Library General Public License instead.)  You can apply it to
40
+your programs, too.
41
+
42
+  When we speak of free software, we are referring to freedom, not
43
+price.  Our General Public Licenses are designed to make sure that you
44
+have the freedom to distribute copies of free software (and charge for
45
+this service if you wish), that you receive source code or can get it
46
+if you want it, that you can change the software or use pieces of it
47
+in new free programs; and that you know you can do these things.
48
+
49
+  To protect your rights, we need to make restrictions that forbid
50
+anyone to deny you these rights or to ask you to surrender the rights.
51
+These restrictions translate to certain responsibilities for you if you
52
+distribute copies of the software, or if you modify it.
53
+
54
+  For example, if you distribute copies of such a program, whether
55
+gratis or for a fee, you must give the recipients all the rights that
56
+you have.  You must make sure that they, too, receive or can get the
57
+source code.  And you must show them these terms so they know their
58
+rights.
59
+
60
+  We protect your rights with two steps: (1) copyright the software, and
61
+(2) offer you this license which gives you legal permission to copy,
62
+distribute and/or modify the software.
63
+
64
+  Also, for each author's protection and ours, we want to make certain
65
+that everyone understands that there is no warranty for this free
66
+software.  If the software is modified by someone else and passed on, we
67
+want its recipients to know that what they have is not the original, so
68
+that any problems introduced by others will not reflect on the original
69
+authors' reputations.
70
+
71
+  Finally, any free program is threatened constantly by software
72
+patents.  We wish to avoid the danger that redistributors of a free
73
+program will individually obtain patent licenses, in effect making the
74
+program proprietary.  To prevent this, we have made it clear that any
75
+patent must be licensed for everyone's free use or not licensed at all.
76
+
77
+  The precise terms and conditions for copying, distribution and
78
+modification follow.
79
+
80
+                    GNU GENERAL PUBLIC LICENSE
81
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
82
+
83
+  0. This License applies to any program or other work which contains
84
+a notice placed by the copyright holder saying it may be distributed
85
+under the terms of this General Public License.  The "Program", below,
86
+refers to any such program or work, and a "work based on the Program"
87
+means either the Program or any derivative work under copyright law:
88
+that is to say, a work containing the Program or a portion of it,
89
+either verbatim or with modifications and/or translated into another
90
+language.  (Hereinafter, translation is included without limitation in
91
+the term "modification".)  Each licensee is addressed as "you".
92
+
93
+Activities other than copying, distribution and modification are not
94
+covered by this License; they are outside its scope.  The act of
95
+running the Program is not restricted, and the output from the Program
96
+is covered only if its contents constitute a work based on the
97
+Program (independent of having been made by running the Program).
98
+Whether that is true depends on what the Program does.
99
+
100
+  1. You may copy and distribute verbatim copies of the Program's
101
+source code as you receive it, in any medium, provided that you
102
+conspicuously and appropriately publish on each copy an appropriate
103
+copyright notice and disclaimer of warranty; keep intact all the
104
+notices that refer to this License and to the absence of any warranty;
105
+and give any other recipients of the Program a copy of this License
106
+along with the Program.
107
+
108
+You may charge a fee for the physical act of transferring a copy, and
109
+you may at your option offer warranty protection in exchange for a fee.
110
+
111
+  2. You may modify your copy or copies of the Program or any portion
112
+of it, thus forming a work based on the Program, and copy and
113
+distribute such modifications or work under the terms of Section 1
114
+above, provided that you also meet all of these conditions:
115
+
116
+    a) You must cause the modified files to carry prominent notices
117
+    stating that you changed the files and the date of any change.
118
+
119
+    b) You must cause any work that you distribute or publish, that in
120
+    whole or in part contains or is derived from the Program or any
121
+    part thereof, to be licensed as a whole at no charge to all third
122
+    parties under the terms of this License.
123
+
124
+    c) If the modified program normally reads commands interactively
125
+    when run, you must cause it, when started running for such
126
+    interactive use in the most ordinary way, to print or display an
127
+    announcement including an appropriate copyright notice and a
128
+    notice that there is no warranty (or else, saying that you provide
129
+    a warranty) and that users may redistribute the program under
130
+    these conditions, and telling the user how to view a copy of this
131
+    License.  (Exception: if the Program itself is interactive but
132
+    does not normally print such an announcement, your work based on
133
+    the Program is not required to print an announcement.)
134
+
135
+These requirements apply to the modified work as a whole.  If
136
+identifiable sections of that work are not derived from the Program,
137
+and can be reasonably considered independent and separate works in
138
+themselves, then this License, and its terms, do not apply to those
139
+sections when you distribute them as separate works.  But when you
140
+distribute the same sections as part of a whole which is a work based
141
+on the Program, the distribution of the whole must be on the terms of
142
+this License, whose permissions for other licensees extend to the
143
+entire whole, and thus to each and every part regardless of who wrote it.
144
+
145
+Thus, it is not the intent of this section to claim rights or contest
146
+your rights to work written entirely by you; rather, the intent is to
147
+exercise the right to control the distribution of derivative or
148
+collective works based on the Program.
149
+
150
+In addition, mere aggregation of another work not based on the Program
151
+with the Program (or with a work based on the Program) on a volume of
152
+a storage or distribution medium does not bring the other work under
153
+the scope of this License.
154
+
155
+  3. You may copy and distribute the Program (or a work based on it,
156
+under Section 2) in object code or executable form under the terms of
157
+Sections 1 and 2 above provided that you also do one of the following:
158
+
159
+    a) Accompany it with the complete corresponding machine-readable
160
+    source code, which must be distributed under the terms of Sections
161
+    1 and 2 above on a medium customarily used for software interchange; or,
162
+
163
+    b) Accompany it with a written offer, valid for at least three
164
+    years, to give any third party, for a charge no more than your
165
+    cost of physically performing source distribution, a complete
166
+    machine-readable copy of the corresponding source code, to be
167
+    distributed under the terms of Sections 1 and 2 above on a medium
168
+    customarily used for software interchange; or,
169
+
170
+    c) Accompany it with the information you received as to the offer
171
+    to distribute corresponding source code.  (This alternative is
172
+    allowed only for noncommercial distribution and only if you
173
+    received the program in object code or executable form with such
174
+    an offer, in accord with Subsection b above.)
175
+
176
+The source code for a work means the preferred form of the work for
177
+making modifications to it.  For an executable work, complete source
178
+code means all the source code for all modules it contains, plus any
179
+associated interface definition files, plus the scripts used to
180
+control compilation and installation of the executable.  However, as a
181
+special exception, the source code distributed need not include
182
+anything that is normally distributed (in either source or binary
183
+form) with the major components (compiler, kernel, and so on) of the
184
+operating system on which the executable runs, unless that component
185
+itself accompanies the executable.
186
+
187
+If distribution of executable or object code is made by offering
188
+access to copy from a designated place, then offering equivalent
189
+access to copy the source code from the same place counts as
190
+distribution of the source code, even though third parties are not
191
+compelled to copy the source along with the object code.
192
+
193
+  4. You may not copy, modify, sublicense, or distribute the Program
194
+except as expressly provided under this License.  Any attempt
195
+otherwise to copy, modify, sublicense or distribute the Program is
196
+void, and will automatically terminate your rights under this License.
197
+However, parties who have received copies, or rights, from you under
198
+this License will not have their licenses terminated so long as such
199
+parties remain in full compliance.
200
+
201
+  5. You are not required to accept this License, since you have not
202
+signed it.  However, nothing else grants you permission to modify or
203
+distribute the Program or its derivative works.  These actions are
204
+prohibited by law if you do not accept this License.  Therefore, by
205
+modifying or distributing the Program (or any work based on the
206
+Program), you indicate your acceptance of this License to do so, and
207
+all its terms and conditions for copying, distributing or modifying
208
+the Program or works based on it.
209
+
210
+  6. Each time you redistribute the Program (or any work based on the
211
+Program), the recipient automatically receives a license from the
212
+original licensor to copy, distribute or modify the Program subject to
213
+these terms and conditions.  You may not impose any further
214
+restrictions on the recipients' exercise of the rights granted herein.
215
+You are not responsible for enforcing compliance by third parties to
216
+this License.
217
+
218
+  7. If, as a consequence of a court judgment or allegation of patent
219
+infringement or for any other reason (not limited to patent issues),
220
+conditions are imposed on you (whether by court order, agreement or
221
+otherwise) that contradict the conditions of this License, they do not
222
+excuse you from the conditions of this License.  If you cannot
223
+distribute so as to satisfy simultaneously your obligations under this
224
+License and any other pertinent obligations, then as a consequence you
225
+may not distribute the Program at all.  For example, if a patent
226
+license would not permit royalty-free redistribution of the Program by
227
+all those who receive copies directly or indirectly through you, then
228
+the only way you could satisfy both it and this License would be to
229
+refrain entirely from distribution of the Program.
230
+
231
+If any portion of this section is held invalid or unenforceable under
232
+any particular circumstance, the balance of the section is intended to
233
+apply and the section as a whole is intended to apply in other
234
+circumstances.
235
+
236
+It is not the purpose of this section to induce you to infringe any
237
+patents or other property right claims or to contest validity of any
238
+such claims; this section has the sole purpose of protecting the
239
+integrity of the free software distribution system, which is
240
+implemented by public license practices.  Many people have made
241
+generous contributions to the wide range of software distributed
242
+through that system in reliance on consistent application of that
243
+system; it is up to the author/donor to decide if he or she is willing
244
+to distribute software through any other system and a licensee cannot
245
+impose that choice.
246
+
247
+This section is intended to make thoroughly clear what is believed to
248
+be a consequence of the rest of this License.
249
+
250
+  8. If the distribution and/or use of the Program is restricted in
251
+certain countries either by patents or by copyrighted interfaces, the
252
+original copyright holder who places the Program under this License
253
+may add an explicit geographical distribution limitation excluding
254
+those countries, so that distribution is permitted only in or among
255
+countries not thus excluded.  In such case, this License incorporates
256
+the limitation as if written in the body of this License.
257
+
258
+  9. The Free Software Foundation may publish revised and/or new versions
259
+of the General Public License from time to time.  Such new versions will
260
+be similar in spirit to the present version, but may differ in detail to
261
+address new problems or concerns.
262
+
263
+Each version is given a distinguishing version number.  If the Program
264
+specifies a version number of this License which applies to it and "any
265
+later version", you have the option of following the terms and conditions
266
+either of that version or of any later version published by the Free
267
+Software Foundation.  If the Program does not specify a version number of
268
+this License, you may choose any version ever published by the Free Software
269
+Foundation.
270
+
271
+  10. If you wish to incorporate parts of the Program into other free
272
+programs whose distribution conditions are different, write to the author
273
+to ask for permission.  For software which is copyrighted by the Free
274
+Software Foundation, write to the Free Software Foundation; we sometimes
275
+make exceptions for this.  Our decision will be guided by the two goals
276
+of preserving the free status of all derivatives of our free software and
277
+of promoting the sharing and reuse of software generally.
278
+
279
+                            NO WARRANTY
280
+
281
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
282
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
283
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
284
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
285
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
286
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
287
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
288
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
289
+REPAIR OR CORRECTION.
290
+
291
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
292
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
293
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
294
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
295
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
296
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
297
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
298
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
299
+POSSIBILITY OF SUCH DAMAGES.
300
+
301
+                     END OF TERMS AND CONDITIONS
302
+
303
+            How to Apply These Terms to Your New Programs
304
+
305
+  If you develop a new program, and you want it to be of the greatest
306
+possible use to the public, the best way to achieve this is to make it
307
+free software which everyone can redistribute and change under these terms.
308
+
309
+  To do so, attach the following notices to the program.  It is safest
310
+to attach them to the start of each source file to most effectively
311
+convey the exclusion of warranty; and each file should have at least
312
+the "copyright" line and a pointer to where the full notice is found.
313
+
314
+    <one line to give the program's name and a brief idea of what it does.>
315
+    Copyright (C) <year>  <name of author>
316
+
317
+    This program is free software; you can redistribute it and/or modify
318
+    it under the terms of the GNU General Public License as published by
319
+    the Free Software Foundation; either version 2 of the License, or
320
+    (at your option) any later version.
321
+
322
+    This program is distributed in the hope that it will be useful,
323
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
324
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
325
+    GNU General Public License for more details.
326
+
327
+    You should have received a copy of the GNU General Public License
328
+    along with this program; if not, write to the Free Software
329
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
330
+
331
+
332
+Also add information on how to contact you by electronic and paper mail.
333
+
334
+If the program is interactive, make it output a short notice like this
335
+when it starts in an interactive mode:
336
+
337
+    Gnomovision version 69, Copyright (C) year name of author
338
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
339
+    This is free software, and you are welcome to redistribute it
340
+    under certain conditions; type `show c' for details.
341
+
342
+The hypothetical commands `show w' and `show c' should show the appropriate
343
+parts of the General Public License.  Of course, the commands you use may
344
+be called something other than `show w' and `show c'; they could even be
345
+mouse-clicks or menu items--whatever suits your program.
346
+
347
+You should also get your employer (if you work as a programmer) or your
348
+school, if any, to sign a "copyright disclaimer" for the program, if
349
+necessary.  Here is a sample; alter the names:
350
+
351
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
352
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
353
+
354
+  <signature of Ty Coon>, 1 April 1989
355
+  Ty Coon, President of Vice
356
+
357
+This General Public License does not permit incorporating your program into
358
+proprietary programs.  If your program is a subroutine library, you may
359
+consider it more useful to permit linking proprietary applications with the
360
+library.  If this is what you want to do, use the GNU Library General
361
+Public License instead of this License.

+ 158
- 0
Readme.txt View File

@@ -0,0 +1,158 @@
1
+This is the Readme file to Objective Development's firmware-only USB driver
2
+for Atmel AVR microcontrollers. For more information please visit
3
+http://www.obdev.at/vusb/
4
+
5
+This directory contains the USB firmware only. Copy it as-is to your own
6
+project and add all .c and .S files to your project (these files are marked
7
+with an asterisk in the list below). Then copy usbconfig-prototype.h as
8
+usbconfig.h to your project and edit it according to your configuration.
9
+
10
+
11
+TECHNICAL DOCUMENTATION
12
+=======================
13
+The technical documentation (API) for the firmware driver is contained in the
14
+file "usbdrv.h". Please read all of it carefully! Configuration options are
15
+documented in "usbconfig-prototype.h".
16
+
17
+The driver consists of the following files:
18
+  Readme.txt ............. The file you are currently reading.
19
+  Changelog.txt .......... Release notes for all versions of the driver.
20
+  usbdrv.h ............... Driver interface definitions and technical docs.
21
+* usbdrv.c ............... High level language part of the driver. Link this
22
+                           module to your code!
23
+* usbdrvasm.S ............ Assembler part of the driver. This module is mostly
24
+                           a stub and includes one of the usbdrvasm*.S files
25
+                           depending on processor clock. Link this module to
26
+                           your code!
27
+  usbdrvasm*.inc ......... Assembler routines for particular clock frequencies.
28
+                           Included by usbdrvasm.S, don't link it directly!
29
+  asmcommon.inc .......... Common assembler routines. Included by
30
+                           usbdrvasm*.inc, don't link it directly!
31
+  usbconfig-prototype.h .. Prototype for your own usbdrv.h file.
32
+* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is
33
+                           defined to a value greater than 0. Link this module
34
+                           to your code!
35
+  oddebug.h .............. Interface definitions of the debug module.
36
+  usbportability.h ....... Header with compiler-dependent stuff.
37
+  usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this
38
+                           module instead of usbdrvasm.S when you assembler
39
+                           with IAR's tools.
40
+  License.txt ............ Open Source license for this driver.
41
+  CommercialLicense.txt .. Optional commercial license for this driver.
42
+  USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs.
43
+  USB-IDs-for-free.txt ... List and terms of use for free shared PIDs.
44
+
45
+(*) ... These files should be linked to your project.
46
+
47
+
48
+CPU CORE CLOCK FREQUENCY
49
+========================
50
+We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz,
51
+16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The
52
+actual clock rate must be configured in usbdrv.h unless you use the default
53
+12 MHz.
54
+
55
+12 MHz Clock
56
+This is the traditional clock rate of V-USB because it's the lowest clock
57
+rate where the timing constraints of the USB spec can be met.
58
+
59
+15 MHz Clock
60
+Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock
61
+rate allows for some loops which make the resulting code size somewhat smaller
62
+than the 12 MHz version.
63
+
64
+16 MHz Clock
65
+This clock rate has been added for users of the Arduino board and other
66
+ready-made boards which come with a fixed 16 MHz crystal. It's also an option
67
+if you need the slightly higher clock rate for performance reasons. Since
68
+16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
69
+is somewhat tricky and has to insert a leap cycle every third byte.
70
+
71
+12.8 MHz and 16.5 MHz Clock
72
+The assembler modules for these clock rates differ from the other modules
73
+because they have been built for an RC oscillator with only 1% precision. The
74
+receiver code inserts leap cycles to compensate for clock deviations. 1% is
75
+also the precision which can be achieved by calibrating the internal RC
76
+oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL
77
+oscillator can reach 16.5 MHz with the RC oscillator. This includes the very
78
+popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost
79
+all AVRs can reach 12.8 MHz, although this is outside the specified range.
80
+
81
+See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for
82
+code which calibrates the RC oscillator based on the USB frame clock.
83
+
84
+18 MHz Clock
85
+This module is closer to the USB specification because it performs an on the
86
+fly CRC check for incoming packets. Packets with invalid checksum are
87
+discarded as required by the spec. If you also implement checks for data
88
+PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING
89
+in usbconfig.h for more info), this ensures data integrity. Due to the CRC
90
+tables and alignment requirements, this code is bigger than modules for other
91
+clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1
92
+and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h.
93
+
94
+20 MHz Clock
95
+This module is for people who won't do it with less than the maximum. Since
96
+20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
97
+uses similar tricks as the 16 MHz module to insert leap cycles.
98
+
99
+
100
+USB IDENTIFIERS
101
+===============
102
+Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs
103
+are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you
104
+can assign PIDs at will.
105
+
106
+Since an entry level cost of 1,500 USD is too high for most small companies
107
+and hobbyists, we provide some VID/PID pairs for free. See the file
108
+USB-IDs-for-free.txt for details.
109
+
110
+Objective Development also has some license offerings which include product
111
+IDs. See http://www.obdev.at/vusb/ for details.
112
+
113
+
114
+DEVELOPMENT SYSTEM
115
+==================
116
+This driver has been developed and optimized for the GNU compiler version 3
117
+(gcc 3). It does work well with gcc 4, but with bigger code size. We recommend
118
+that you use the GNU compiler suite because it is freely available. V-USB
119
+has also been ported to the IAR compiler and assembler. It has been tested
120
+with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the "small" and "tiny"
121
+memory model. Not every release is tested with IAR CC and the driver may
122
+therefore fail to compile with IAR. Please note that gcc is more efficient for
123
+usbdrv.c because this module has been deliberately optimized for gcc.
124
+
125
+
126
+USING V-USB FOR FREE
127
+====================
128
+The AVR firmware driver is published under the GNU General Public License
129
+Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is
130
+your choice whether you apply the terms of version 2 or version 3.
131
+
132
+If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the
133
+following things IN ADDITION to the obligations from the GPL:
134
+
135
+(1) Publish your entire project on a web site and drop us a note with the URL.
136
+Use the form at http://www.obdev.at/vusb/feedback.html for your submission.
137
+If you don't have a web site, you can publish the project in obdev's
138
+documentation wiki at
139
+http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects.
140
+
141
+(2) Adhere to minimum publication standards. Please include AT LEAST:
142
+    - a circuit diagram in PDF, PNG or GIF format
143
+    - full source code for the host software
144
+    - a Readme.txt file in ASCII format which describes the purpose of the
145
+      project and what can be found in which directories and which files
146
+    - a reference to http://www.obdev.at/vusb/
147
+
148
+(3) If you improve the driver firmware itself, please give us a free license
149
+to your modifications for our commercial license offerings.
150
+
151
+
152
+COMMERCIAL LICENSES FOR V-USB
153
+=============================
154
+If you don't want to publish your source code under the terms of the GPL,
155
+you can simply pay money for V-USB. As an additional benefit you get
156
+USB PIDs for free, reserved exclusively to you. See the file
157
+"CommercialLicense.txt" for details.
158
+

+ 149
- 0
USB-ID-FAQ.txt View File

@@ -0,0 +1,149 @@
1
+Version 2009-08-22
2
+
3
+==========================
4
+WHY DO WE NEED THESE IDs?
5
+==========================
6
+
7
+USB is more than a low level protocol for data transport. It also defines a
8
+common set of requests which must be understood by all devices. And as part
9
+of these common requests, the specification defines data structures, the
10
+USB Descriptors, which are used to describe the properties of the device.
11
+
12
+From the perspective of an operating system, it is therefore possible to find
13
+out basic properties of a device (such as e.g. the manufacturer and the name
14
+of the device) without a device-specific driver. This is essential because
15
+the operating system can choose a driver to load based on this information
16
+(Plug-And-Play).
17
+
18
+Among the most important properties in the Device Descriptor are the USB
19
+Vendor- and Product-ID. Both are 16 bit integers. The most simple form of
20
+driver matching is based on these IDs. The driver announces the Vendor- and
21
+Product-IDs of the devices it can handle and the operating system loads the
22
+appropriate driver when the device is connected.
23
+
24
+It is obvious that this technique only works if the pair Vendor- plus
25
+Product-ID is unique: Only devices which require the same driver can have the
26
+same pair of IDs.
27
+
28
+
29
+=====================================================
30
+HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE?
31
+=====================================================
32
+
33
+Since it is so important that USB IDs are unique, the USB Implementers Forum,
34
+Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by
35
+law to build a device and assign it any random numbers as IDs. Usb.org
36
+therefore needs an agreement to regulate the use of USB IDs. The agreement
37
+binds only parties who agreed to it, of course. Everybody else is free to use
38
+any numbers for their IDs.
39
+
40
+So how can usb.org ensure that every manufacturer of USB devices enters into
41
+an agreement with them? They do it via trademark licensing. Usb.org has
42
+registered the trademark "USB", all associated logos and related terms. If
43
+you want to put an USB logo on your product or claim that it is USB
44
+compliant, you must license these trademarks from usb.org. And this is where
45
+you enter into an agreement. See the "USB-IF Trademark License Agreement and
46
+Usage Guidelines for the USB-IF Logo" at
47
+http://www.usb.org/developers/logo_license/.
48
+
49
+Licensing the USB trademarks requires that you buy a USB Vendor-ID from
50
+usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org
51
+(yearly fee of ca. 4,000 USD) and that you meet all the technical
52
+specifications from the USB spec.
53
+
54
+This means that most hobbyists and small companies will never be able to
55
+become USB compliant, just because membership is so expensive. And you can't
56
+be compliant with a driver based on V-USB anyway, because the AVR's port pins
57
+don't meet the electrical specifications for USB. So, in principle, all
58
+hobbyists and small companies are free to choose any random numbers for their
59
+IDs. They have nothing to lose...
60
+
61
+There is one exception worth noting, though: If you use a sub-component which
62
+implements USB, the vendor of the sub-components may guarantee USB
63
+compliance. This might apply to some or all of FTDI's solutions.
64
+
65
+
66
+=======================================================================
67
+WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS?
68
+=======================================================================
69
+
70
+You have learned in the previous section that you are free to choose any
71
+numbers for your IDs anyway. So why not do exactly this? There is still the
72
+technical issue. If you choose IDs which are already in use by somebody else,
73
+operating systems will load the wrong drivers and your device won't work.
74
+Even if you choose IDs which are not currently in use, they may be in use in
75
+the next version of the operating system or even after an automatic update.
76
+
77
+So what you need is a pair of Vendor- and Product-IDs for which you have the
78
+guarantee that no USB compliant product uses them. This implies that no
79
+operating system will ever ship with drivers responsible for these IDs.
80
+
81
+
82
+==============================================
83
+HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs?
84
+==============================================
85
+
86
+Objective Development gives away pairs of USB-IDs with their V-USB licenses.
87
+In order to ensure that these IDs are unique, Objective Development has an
88
+agreement with the company/person who has bought the USB Vendor-ID from
89
+usb.org. This agreement ensures that a range of USB Product-IDs is reserved
90
+for assignment by Objective Development and that the owner of the Vendor-ID
91
+won't give it to anybody else.
92
+
93
+This means that you have to trust three parties to ensure uniqueness of
94
+your IDs:
95
+
96
+  - Objective Development, that they don't give the same PID to more than
97
+    one person.
98
+  - The owner of the Vendor-ID that they don't assign PIDs from the range
99
+    assigned to Objective Development to anybody else.
100
+  - Usb.org that they don't assign the same Vendor-ID a second time.
101
+
102
+
103
+==================================
104
+WHO IS THE OWNER OF THE VENDOR-ID?
105
+==================================
106
+
107
+Objective Development has obtained ranges of USB Product-IDs under two
108
+Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen
109
+Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason
110
+Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their
111
+Vendor-ID directly from usb.org.
112
+
113
+
114
+=========================================================================
115
+CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE?
116
+=========================================================================
117
+
118
+The short answer is: Yes. All you get is a guarantee that the IDs are never
119
+assigned to anybody else. What more do you need?
120
+
121
+
122
+============================
123
+WHAT ABOUT SHARED ID PAIRS?
124
+============================
125
+
126
+Objective Development has reserved some PID/VID pairs for shared use. You
127
+have no guarantee of uniqueness for them, except that no USB compliant device
128
+uses them. In order to avoid technical problems, we must ensure that all
129
+devices with the same pair of IDs use the same driver on kernel level. For
130
+details, see the file USB-IDs-for-free.txt.
131
+
132
+
133
+======================================================
134
+I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL?
135
+======================================================
136
+
137
+A 16 bit integer number cannot be protected by copyright laws. It is not
138
+sufficiently complex. And since none of the parties involved entered into the
139
+USB-IF Trademark License Agreement, we are not bound by this agreement. So
140
+there is no reason why it should be illegal to sub-license USB-IDs.
141
+
142
+
143
+=============================================
144
+WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES?
145
+=============================================
146
+
147
+Objective Development disclaims all liabilities which might arise from the
148
+assignment of IDs. If you guarantee product features to your customers
149
+without proper disclaimer, YOU are liable for that.

+ 148
- 0
USB-IDs-for-free.txt View File

@@ -0,0 +1,148 @@
1
+Version 2009-08-22
2
+
3
+===========================
4
+FREE USB-IDs FOR SHARED USE
5
+===========================
6
+
7
+Objective Development has reserved a set of USB Product-IDs for use according
8
+to the guidelines outlined below. For more information about the concept of
9
+USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees
10
+that the IDs listed below are not used by any USB compliant devices.
11
+
12
+
13
+====================
14
+MECHANISM OF SHARING
15
+====================
16
+
17
+From a technical point of view, two different devices can share the same USB
18
+Vendor- and Product-ID if they require the same driver on operating system
19
+level. We make use of this fact by assigning separate IDs for various device
20
+classes. On application layer, devices must be distinguished by their textual
21
+name or serial number. We offer separate sets of IDs for discrimination by
22
+textual name and for serial number.
23
+
24
+Examples for shared use of USB IDs are included with V-USB in the "examples"
25
+subdirectory.
26
+
27
+
28
+======================================
29
+IDs FOR DISCRIMINATION BY TEXTUAL NAME
30
+======================================
31
+
32
+If you use one of the IDs listed below, your device and host-side software
33
+must conform to these rules:
34
+
35
+(1) The USB device MUST provide a textual representation of the manufacturer
36
+and product identification. The manufacturer identification MUST be available
37
+at least in USB language 0x0409 (English/US).
38
+
39
+(2) The textual manufacturer identification MUST contain either an Internet
40
+domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail
41
+address under your control (e.g. "myname@gmx.net"). You can embed the domain
42
+name or e-mail address in any string you like, e.g.  "Objective Development
43
+http://www.obdev.at/vusb/".
44
+
45
+(3) You are responsible for retaining ownership of the domain or e-mail
46
+address for as long as any of your products are in use.
47
+
48
+(4) You may choose any string for the textual product identification, as long
49
+as this string is unique within the scope of your textual manufacturer
50
+identification.
51
+
52
+(5) Application side device look-up MUST be based on the textual manufacturer
53
+and product identification in addition to VID/PID matching. The driver
54
+matching MUST be a comparison of the entire strings, NOT a sub-string match.
55
+
56
+(6) For devices which implement a particular USB device class (e.g. HID), the
57
+operating system's default class driver MUST be used. If an operating system
58
+driver for Vendor Class devices is needed, this driver must be libusb or
59
+libusb-win32 (see http://libusb.org/ and
60
+http://libusb-win32.sourceforge.net/).
61
+
62
+Table if IDs for discrimination by textual name:
63
+
64
+PID dec (hex) | VID dec (hex) | Description of use
65
+==============+===============+============================================
66
+1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb
67
+--------------+---------------+--------------------------------------------
68
+1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are
69
+              |               | NOT mice, keyboards or joysticks)
70
+--------------+---------------+--------------------------------------------
71
+1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
72
+--------------+---------------+--------------------------------------------
73
+1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices
74
+--------------+---------------+--------------------------------------------
75
+
76
+Note that Windows caches the textual product- and vendor-description for
77
+mice, keyboards and joysticks. Name-bsed discrimination is therefore not
78
+recommended for these device classes.
79
+
80
+
81
+=======================================
82
+IDs FOR DISCRIMINATION BY SERIAL NUMBER
83
+=======================================
84
+
85
+If you use one of the IDs listed below, your device and host-side software
86
+must conform to these rules:
87
+
88
+(1) The USB device MUST provide a textual representation of the serial
89
+number. The serial number string MUST be available at least in USB language
90
+0x0409 (English/US).
91
+
92
+(2) The serial number MUST start with either an Internet domain name (e.g.
93
+"mycompany.com") registered and owned by you, or an e-mail address under your
94
+control (e.g. "myname@gmx.net"), both terminated with a colon (":") character.
95
+You MAY append any string you like for further discrimination of your devices.
96
+
97
+(3) You are responsible for retaining ownership of the domain or e-mail
98
+address for as long as any of your products are in use.
99
+
100
+(5) Application side device look-up MUST be based on the serial number string
101
+in addition to VID/PID matching. The matching must start at the first
102
+character of the serial number string and include the colon character
103
+terminating your domain or e-mail address. It MAY stop anywhere after that.
104
+
105
+(6) For devices which implement a particular USB device class (e.g. HID), the
106
+operating system's default class driver MUST be used. If an operating system
107
+driver for Vendor Class devices is needed, this driver must be libusb or
108
+libusb-win32 (see http://libusb.org/ and
109
+http://libusb-win32.sourceforge.net/).
110
+
111
+Table if IDs for discrimination by serial number string:
112
+
113
+PID dec (hex)  | VID dec (hex) | Description of use
114
+===============+===============+===========================================
115
+10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb
116
+---------------+---------------+-------------------------------------------
117
+10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are
118
+               |               | NOT mice, keyboards or joysticks)
119
+---------------+---------------+-------------------------------------------
120
+10202 (0x27da) | 5824 (0x16c0) | For USB Mice
121
+---------------+---------------+-------------------------------------------
122
+10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
123
+---------------+---------------+-------------------------------------------
124
+10204 (0x27db) | 5824 (0x16c0) | For USB Joysticks
125
+---------------+---------------+-------------------------------------------
126
+10205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
127
+---------------+---------------+-------------------------------------------
128
+10206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices
129
+---------------+---------------+-------------------------------------------
130
+
131
+
132
+=================
133
+ORIGIN OF USB-IDs
134
+=================
135
+
136
+OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed
137
+here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition.
138
+Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc.
139
+(see www.usb.org). The VID is registered for the company name "Van Ooijen
140
+Technische Informatica".
141
+
142
+
143
+==========
144
+DISCLAIMER
145
+==========
146
+
147
+OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any
148
+problems which are caused by the shared use of these VID/PID pairs.

+ 154
- 0
USBID-License.txt View File

@@ -0,0 +1,154 @@
1
+Royalty-Free Non-Exclusive Use of USB Product-IDs
2
+=================================================
3
+
4
+Version 2009-04-13
5
+
6
+Strictly speaking, this is not a license. You can't give a license to use
7
+a simple number (such as e.g. 1500) for any purpose. This is a set of rules
8
+which should make it possible to build USB devices without the requirement
9
+for individual USB IDs. If you break one of the rules, you will run into
10
+technical problems sooner or later, but you don't risk legal trouble.
11
+
12
+
13
+OBJECTIVE DEVELOPMENT Software GmbH hereby grants you the non-exclusive
14
+right to use four USB.org vendor-ID (VID) / product-ID (PID) pairs with
15
+products based on Objective Development's firmware-only USB driver for
16
+Atmel AVR microcontrollers:
17
+
18
+ * VID = 5824 (=0x16c0) / PID = 1500 (=0x5dc) for devices implementing no
19
+   USB device class (vendor-class devices with USB class = 0xff). Devices
20
+   using this pair will be referred to as "VENDOR CLASS" devices.
21
+
22
+ * VID = 5824 (=0x16c0) / PID = 1503 (=0x5df) for HID class devices
23
+   (excluding mice and keyboards). Devices using this pair will be referred
24
+   to as "HID CLASS" devices.
25
+
26
+ * VID = 5824 (=0x16c0) / PID = 1505 (=0x5e1) for CDC class modem devices
27
+   Devices using this pair will be referred to as "CDC-ACM CLASS" devices.
28
+
29
+ * VID = 5824 (=0x16c0) / PID = 1508 (=0x5e4) for MIDI class devices
30
+   Devices using this pair will be referred to as "MIDI CLASS" devices.
31
+
32
+Since the granted right is non-exclusive, the same VID/PID pairs may be
33
+used by many companies and individuals for different products. To avoid
34
+conflicts, your device and host driver software MUST adhere to the rules
35
+outlined below.
36
+
37
+OBJECTIVE DEVELOPMENT Software GmbH has obtained these VID/PID pairs from
38
+Wouter van Ooijen (see www.voti.nl) for exclusive disposition. Wouter van
39
+Ooijen has obtained the VID from the USB Implementers Forum, Inc.
40
+(see www.usb.org). The VID is registered for the company name
41
+"Van Ooijen Technische Informatica".
42
+
43
+
44
+RULES AND RESTRICTIONS
45
+======================
46
+
47
+(1) The USB device MUST provide a textual representation of the
48
+manufacturer and product identification. The manufacturer identification
49
+MUST be available at least in USB language 0x0409 (English/US).
50
+
51
+(2) The textual manufacturer identification MUST contain either an Internet
52
+domain name (e.g. "mycompany.com") registered and owned by you, or an
53
+e-mail address under your control (e.g. "myname@gmx.net"). You can embed
54
+the domain name or e-mail address in any string you like, e.g.  "Objective
55
+Development http://www.obdev.at/vusb/".
56
+
57
+(3) You are responsible for retaining ownership of the domain or e-mail
58
+address for as long as any of your products are in use.
59
+
60
+(4) You may choose any string for the textual product identification, as
61
+long as this string is unique within the scope of your textual manufacturer
62
+identification.
63
+
64
+(5) Matching of device-specific drivers MUST be based on the textual
65
+manufacturer and product identification in addition to the usual VID/PID
66
+matching. This means that operating system features which are based on
67
+VID/PID matching only (e.g. Windows kernel level drivers, automatic actions
68
+when the device is plugged in etc) MUST NOT be used. The driver matching
69
+MUST be a comparison of the entire strings, NOT a sub-string match. For
70
+CDC-ACM CLASS and MIDI CLASS devices, a generic class driver should be used
71
+and the matching is based on the USB device class.
72
+
73
+(6) The extent to which VID/PID matching is allowed for non device-specific
74
+drivers or features depends on the operating system and particular VID/PID
75
+pair used:
76
+
77
+ * Mac OS X, Linux, FreeBSD and other Unixes: No VID/PID matching is
78
+   required and hence no VID/PID-only matching is allowed at all.
79
+
80
+ * Windows: The operating system performs VID/PID matching for the kernel
81
+   level driver. You are REQUIRED to use libusb-win32 (see
82
+   http://libusb-win32.sourceforge.net/) as the kernel level driver for
83
+   VENDOR CLASS devices. HID CLASS devices all use the generic HID class
84
+   driver shipped with Windows, except mice and keyboards. You therefore
85
+   MUST NOT use any of the shared VID/PID pairs for mice or keyboards.
86
+   CDC-ACM CLASS devices require a ".inf" file which matches on the VID/PID
87
+   pair. This ".inf" file MUST load the "usbser" driver to configure the
88
+   device as modem (COM-port).
89
+
90
+(7) OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any
91
+problems which are caused by the shared use of these VID/PID pairs. You
92
+have been warned that the sharing of VID/PID pairs may cause problems. If
93
+you want to avoid them, get your own VID/PID pair for exclusive use.
94
+
95
+
96
+HOW TO IMPLEMENT THESE RULES
97
+============================
98
+
99
+The following rules are for VENDOR CLASS and HID CLASS devices. CDC-ACM
100
+CLASS and MIDI CLASS devices use the operating system's class driver and
101
+don't need a custom driver.
102
+
103
+The host driver MUST iterate over all devices with the given VID/PID
104
+numbers in their device descriptors and query the string representation for
105
+the manufacturer name in USB language 0x0409 (English/US). It MUST compare
106
+the ENTIRE string with your textual manufacturer identification chosen in
107
+(2) above. A substring search for your domain or e-mail address is NOT
108
+acceptable. The driver MUST NOT touch the device (other than querying the
109
+descriptors) unless the strings match.
110
+
111
+For all USB devices with matching VID/PID and textual manufacturer
112
+identification, the host driver must query the textual product
113
+identification and string-compare it with the name of the product it can
114
+control. It may only initialize the device if the product matches exactly.
115
+
116
+Objective Development provides examples for these matching rules with the
117
+"PowerSwitch" project (using libusb) and with the "Automator" project
118
+(using Windows calls on Windows and libusb on Unix).
119
+
120
+
121
+Technical Notes:
122
+================
123
+
124
+Sharing the same VID/PID pair among devices is possible as long as ALL
125
+drivers which match the VID/PID also perform matching on the textual
126
+identification strings. This is easy on all operating systems except
127
+Windows, since Windows establishes a static connection between the VID/PID
128
+pair and a kernel level driver. All devices with the same VID/PID pair must
129
+therefore use THE SAME kernel level driver.
130
+
131
+We therefore demand that you use libusb-win32 for VENDOR CLASS devices.
132
+This is a generic kernel level driver which allows all types of USB access
133
+for user space applications. This is only a partial solution of the
134
+problem, though, because different device drivers may come with different
135
+versions of libusb-win32 and they may not work with the libusb version of
136
+the respective other driver. You are therefore encouraged to test your
137
+driver against a broad range of libusb-win32 versions. Do not use new
138
+features in new versions, or check for their existence before you use them.
139
+When a new libusb-win32 becomes available, make sure that your driver is
140
+compatible with it.
141
+
142
+For HID CLASS devices it is necessary that all those devices bind to the
143
+same kernel driver: Microsoft's generic USB HID driver. This is true for
144
+all HID devices except those with a specialized driver. Currently, the only
145
+HIDs with specialized drivers are mice and keyboards. You therefore MUST
146
+NOT use a shared VID/PID with mouse and keyboard devices.
147
+
148
+Sharing the same VID/PID among different products is unusual and probably
149
+violates the USB specification. If you do it, you do it at your own risk.
150
+
151
+To avoid possible incompatibilities, we highly recommend that you get your
152
+own VID/PID pair if you intend to sell your product. Objective
153
+Development's commercial licenses for V-USB include a PID for
154
+unrestricted exclusive use.

+ 58
- 0
UsbRawHid.h View File

@@ -0,0 +1,58 @@
1
+/*
2
+ * Based on Obdev's AVRUSB code and under the same license.
3
+ * Modified by Robin Thoni <robin@rthoni.com>
4
+ */
5
+#ifndef __UsbKeyboard_h__
6
+#define __UsbKeyboard_h__
7
+
8
+#include <avr/pgmspace.h>
9
+#include <avr/interrupt.h>
10
+#include <string.h>
11
+
12
+#include "usbdrv.h"
13
+
14
+// TODO: Work around Arduino 12 issues better.
15
+//#include <WConstants.h>
16
+//#undef int()
17
+
18
+typedef uint8_t byte;
19
+
20
+#define WAIT_USB do {           \
21
+  UsbRawHid.update();           \
22
+  if (!usbInterruptIsReady())   \
23
+  {                             \
24
+    return;                     \
25
+  }                             \
26
+} while(0)
27
+
28
+#define BUFFER_SIZE 4 // Minimum of 2: 1 for modifiers + 1 for keystroke 
29
+
30
+typedef struct{
31
+    uchar   buttonMask;
32
+    char    dx;
33
+    char    dy;
34
+    char    dWheel;
35
+}report_t;
36
+
37
+static uchar    idleRate;/* repeat rate for keyboards, never used for mice */
38
+
39
+class UsbRawHidDevice {
40
+public:
41
+    UsbRawHidDevice();
42
+
43
+    bool isUsbReady();
44
+    
45
+    void update() {
46
+        usbPoll();
47
+    }
48
+    
49
+    //private: TODO: Make friend?
50
+    report_t reportBuffer;    // buffer for HID reports [ 1 modifier byte + (len-1) key strokes]
51
+
52
+private:
53
+
54
+};
55
+
56
+#include "UsbRawHid.hxx"
57
+
58
+#endif // __UsbKeyboard_h__

+ 86
- 0
UsbRawHid.hxx View File

@@ -0,0 +1,86 @@
1
+//
2
+// Created by robin on 1/8/16.
3
+//
4
+
5
+UsbRawHidDevice UsbRawHid = UsbRawHidDevice();
6
+
7
+
8
+/* We use a simplifed keyboard report descriptor which does not support the
9
+ * boot protocol. We don't allow setting status LEDs and but we do allow
10
+ * simultaneous key presses.
11
+ * The report descriptor has been created with usb.org's "HID Descriptor Tool"
12
+ * which can be downloaded from http://www.usb.org/developers/hidpage/.
13
+ * Redundant entries (such as LOGICAL_MINIMUM and USAGE_PAGE) have been omitted
14
+ * for the second INPUT item.
15
+ */
16
+PROGMEM const char usbHidReportDescriptor[52] = { /* USB report descriptor, size must match usbconfig.h */
17
+        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
18
+        0x09, 0x02,                    // USAGE (Mouse)
19
+        0xa1, 0x01,                    // COLLECTION (Application)
20
+        0x09, 0x01,                    //   USAGE (Pointer)
21
+        0xA1, 0x00,                    //   COLLECTION (Physical)
22
+        0x05, 0x09,                    //     USAGE_PAGE (Button)
23
+        0x19, 0x01,                    //     USAGE_MINIMUM
24
+        0x29, 0x03,                    //     USAGE_MAXIMUM
25
+        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
26
+        0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
27
+        0x95, 0x03,                    //     REPORT_COUNT (3)
28
+        0x75, 0x01,                    //     REPORT_SIZE (1)
29
+        0x81, 0x02,                    //     INPUT (Data,Var,Abs)
30
+        0x95, 0x01,                    //     REPORT_COUNT (1)
31
+        0x75, 0x05,                    //     REPORT_SIZE (5)
32
+        0x81, 0x03,                    //     INPUT (Const,Var,Abs)
33
+        0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
34
+        0x09, 0x30,                    //     USAGE (X)
35
+        0x09, 0x31,                    //     USAGE (Y)
36
+        0x09, 0x38,                    //     USAGE (Wheel)
37
+        0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
38
+        0x25, 0x7F,                    //     LOGICAL_MAXIMUM (127)
39
+        0x75, 0x08,                    //     REPORT_SIZE (8)
40
+        0x95, 0x03,                    //     REPORT_COUNT (3)
41
+        0x81, 0x06,                    //     INPUT (Data,Var,Rel)
42
+        0xC0,                          //   END_COLLECTION
43
+        0xC0,                          // END COLLECTION
44
+};
45
+
46
+UsbRawHidDevice::UsbRawHidDevice()
47
+{
48
+    PORTD = 0; // TODO: Only for USB pins?
49
+    DDRD |= ~USBMASK;
50
+
51
+    cli();
52
+    usbDeviceDisconnect();
53
+    usbDeviceConnect();
54
+    usbInit();
55
+    sei();
56
+}
57
+
58
+bool UsbRawHidDevice::isUsbReady()
59
+{
60
+    update();
61
+    return usbInterruptIsReady();
62
+}
63
+
64
+usbMsgLen_t usbFunctionSetup(uchar data[8])
65
+{
66
+    usbRequest_t    *rq = (usbRequest_t*)(void*)data;
67
+
68
+    /* The following requests are never used. But since they are required by
69
+     * the specification, we implement them in this example.
70
+     */
71
+    if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){    /* class request type */
72
+        if(rq->bRequest == USBRQ_HID_GET_REPORT){  /* wValue: ReportType (highbyte), ReportID (lowbyte) */
73
+            /* we only have one report type, so don't look at wValue */
74
+            usbMsgPtr = (unsigned char*)(void *)&UsbRawHid.reportBuffer;
75
+            return sizeof(UsbRawHid.reportBuffer);
76
+        }else if(rq->bRequest == USBRQ_HID_GET_IDLE){
77
+            usbMsgPtr = &idleRate;
78
+            return 1;
79
+        }else if(rq->bRequest == USBRQ_HID_SET_IDLE){
80
+            idleRate = rq->wValue.bytes[1];
81
+        }
82
+    }else{
83
+        /* no vendor specific requests implemented */
84
+    }
85
+    return 0;   /* default for not implemented requests: return no data back to host */
86
+}

+ 188
- 0
asmcommon.inc View File

@@ -0,0 +1,188 @@
1
+/* Name: asmcommon.inc
2
+ * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3
+ * Author: Christian Starkjohann
4
+ * Creation Date: 2007-11-05
5
+ * Tabsize: 4
6
+ * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7
+ * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8
+ * Revision: $Id$
9
+ */
10
+
11
+/* Do not link this file! Link usbdrvasm.S instead, which includes the
12
+ * appropriate implementation!
13
+ */
14
+
15
+/*
16
+General Description:
17
+This file contains assembler code which is shared among the USB driver
18
+implementations for different CPU cocks. Since the code must be inserted
19
+in the middle of the module, it's split out into this file and #included.
20
+
21
+Jump destinations called from outside:
22
+    sofError: Called when no start sequence was found.
23
+    se0: Called when a package has been successfully received.
24
+    overflow: Called when receive buffer overflows.
25
+    doReturn: Called after sending data.
26
+
27
+Outside jump destinations used by this module:
28
+    waitForJ: Called to receive an already arriving packet.
29
+    sendAckAndReti:
30
+    sendNakAndReti:
31
+    sendCntAndReti:
32
+    usbSendAndReti:
33
+
34
+The following macros must be defined before this file is included:
35
+    .macro POP_STANDARD
36
+    .endm
37
+    .macro POP_RETI
38
+    .endm
39
+*/
40
+
41
+#define token   x1
42
+
43
+overflow:
44
+    ldi     x2, 1<<USB_INTR_PENDING_BIT
45
+    USB_STORE_PENDING(x2)       ; clear any pending interrupts
46
+ignorePacket:
47
+    clr     token
48
+    rjmp    storeTokenAndReturn
49
+
50
+;----------------------------------------------------------------------------
51
+; Processing of received packet (numbers in brackets are cycles after center of SE0)
52
+;----------------------------------------------------------------------------
53
+;This is the only non-error exit point for the software receiver loop
54
+;we don't check any CRCs here because there is no time left.
55
+se0:
56
+    subi    cnt, USB_BUFSIZE    ;[5]
57
+    neg     cnt                 ;[6]
58
+    sub     YL, cnt             ;[7]
59
+    sbci    YH, 0               ;[8]
60
+    ldi     x2, 1<<USB_INTR_PENDING_BIT ;[9]
61
+    USB_STORE_PENDING(x2)       ;[10] clear pending intr and check flag later. SE0 should be over.
62
+    ld      token, y            ;[11]
63
+    cpi     token, USBPID_DATA0 ;[13]
64
+    breq    handleData          ;[14]
65
+    cpi     token, USBPID_DATA1 ;[15]
66
+    breq    handleData          ;[16]
67
+    lds     shift, usbDeviceAddr;[17]
68
+    ldd     x2, y+1             ;[19] ADDR and 1 bit endpoint number
69
+    lsl     x2                  ;[21] shift out 1 bit endpoint number
70
+    cpse    x2, shift           ;[22]
71
+    rjmp    ignorePacket        ;[23]
72
+/* only compute endpoint number in x3 if required later */
73
+#if USB_CFG_HAVE_INTRIN_ENDPOINT || USB_CFG_IMPLEMENT_FN_WRITEOUT
74
+    ldd     x3, y+2             ;[24] endpoint number + crc
75
+    rol     x3                  ;[26] shift in LSB of endpoint
76
+#endif
77
+    cpi     token, USBPID_IN    ;[27]
78
+    breq    handleIn            ;[28]
79
+    cpi     token, USBPID_SETUP ;[29]
80
+    breq    handleSetupOrOut    ;[30]
81
+    cpi     token, USBPID_OUT   ;[31]
82
+    brne    ignorePacket        ;[32] must be ack, nak or whatever
83
+;   rjmp    handleSetupOrOut    ; fallthrough
84
+
85
+;Setup and Out are followed by a data packet two bit times (16 cycles) after
86
+;the end of SE0. The sync code allows up to 40 cycles delay from the start of
87
+;the sync pattern until the first bit is sampled. That's a total of 56 cycles.
88
+handleSetupOrOut:               ;[32]
89
+#if USB_CFG_IMPLEMENT_FN_WRITEOUT   /* if we have data for endpoint != 0, set usbCurrentTok to address */
90
+    andi    x3, 0xf             ;[32]
91
+    breq    storeTokenAndReturn ;[33]
92
+    mov     token, x3           ;[34] indicate that this is endpoint x OUT
93
+#endif
94
+storeTokenAndReturn:
95
+    sts     usbCurrentTok, token;[35]
96
+doReturn:
97
+    POP_STANDARD                ;[37] 12...16 cycles
98
+    USB_LOAD_PENDING(YL)        ;[49]
99
+    sbrc    YL, USB_INTR_PENDING_BIT;[50] check whether data is already arriving
100
+    rjmp    waitForJ            ;[51] save the pops and pushes -- a new interrupt is already pending
101
+sofError:
102
+    POP_RETI                    ;macro call
103
+    reti
104
+
105
+handleData:
106
+#if USB_CFG_CHECK_CRC
107
+    CRC_CLEANUP_AND_CHECK       ; jumps to ignorePacket if CRC error
108
+#endif
109
+    lds     shift, usbCurrentTok;[18]
110
+    tst     shift               ;[20]
111
+    breq    doReturn            ;[21]
112
+    lds     x2, usbRxLen        ;[22]
113
+    tst     x2                  ;[24]
114
+    brne    sendNakAndReti      ;[25]
115
+; 2006-03-11: The following two lines fix a problem where the device was not
116
+; recognized if usbPoll() was called less frequently than once every 4 ms.
117
+    cpi     cnt, 4              ;[26] zero sized data packets are status phase only -- ignore and ack
118
+    brmi    sendAckAndReti      ;[27] keep rx buffer clean -- we must not NAK next SETUP
119
+#if USB_CFG_CHECK_DATA_TOGGLING
120
+    sts     usbCurrentDataToken, token  ; store for checking by C code
121
+#endif
122
+    sts     usbRxLen, cnt       ;[28] store received data, swap buffers
123
+    sts     usbRxToken, shift   ;[30]
124
+    lds     x2, usbInputBufOffset;[32] swap buffers
125
+    ldi     cnt, USB_BUFSIZE    ;[34]
126
+    sub     cnt, x2             ;[35]
127
+    sts     usbInputBufOffset, cnt;[36] buffers now swapped
128
+    rjmp    sendAckAndReti      ;[38] 40 + 17 = 57 until SOP
129
+
130
+handleIn:
131
+;We don't send any data as long as the C code has not processed the current
132
+;input data and potentially updated the output data. That's more efficient
133
+;in terms of code size than clearing the tx buffers when a packet is received.
134
+    lds     x1, usbRxLen        ;[30]
135
+    cpi     x1, 1               ;[32] negative values are flow control, 0 means "buffer free"
136
+    brge    sendNakAndReti      ;[33] unprocessed input packet?
137
+    ldi     x1, USBPID_NAK      ;[34] prepare value for usbTxLen
138
+#if USB_CFG_HAVE_INTRIN_ENDPOINT
139
+    andi    x3, 0xf             ;[35] x3 contains endpoint
140
+#if USB_CFG_SUPPRESS_INTR_CODE
141
+    brne    sendNakAndReti      ;[36]
142
+#else
143
+    brne    handleIn1           ;[36]
144
+#endif
145
+#endif
146
+    lds     cnt, usbTxLen       ;[37]
147
+    sbrc    cnt, 4              ;[39] all handshake tokens have bit 4 set
148
+    rjmp    sendCntAndReti      ;[40] 42 + 16 = 58 until SOP
149
+    sts     usbTxLen, x1        ;[41] x1 == USBPID_NAK from above
150
+    ldi     YL, lo8(usbTxBuf)   ;[43]
151
+    ldi     YH, hi8(usbTxBuf)   ;[44]
152
+    rjmp    usbSendAndReti      ;[45] 57 + 12 = 59 until SOP
153
+
154
+; Comment about when to set usbTxLen to USBPID_NAK:
155
+; We should set it back when we receive the ACK from the host. This would
156
+; be simple to implement: One static variable which stores whether the last
157
+; tx was for endpoint 0 or 1 and a compare in the receiver to distinguish the
158
+; ACK. However, we set it back immediately when we send the package,
159
+; assuming that no error occurs and the host sends an ACK. We save one byte
160
+; RAM this way and avoid potential problems with endless retries. The rest of
161
+; the driver assumes error-free transfers anyway.
162
+
163
+#if !USB_CFG_SUPPRESS_INTR_CODE && USB_CFG_HAVE_INTRIN_ENDPOINT /* placed here due to relative jump range */
164
+handleIn1:                      ;[38]
165
+#if USB_CFG_HAVE_INTRIN_ENDPOINT3
166
+; 2006-06-10 as suggested by O.Tamura: support second INTR IN / BULK IN endpoint
167
+    cpi     x3, USB_CFG_EP3_NUMBER;[38]
168
+    breq    handleIn3           ;[39]
169
+#endif
170
+    lds     cnt, usbTxLen1      ;[40]
171
+    sbrc    cnt, 4              ;[42] all handshake tokens have bit 4 set
172
+    rjmp    sendCntAndReti      ;[43] 47 + 16 = 63 until SOP
173
+    sts     usbTxLen1, x1       ;[44] x1 == USBPID_NAK from above
174
+    ldi     YL, lo8(usbTxBuf1)  ;[46]
175
+    ldi     YH, hi8(usbTxBuf1)  ;[47]
176
+    rjmp    usbSendAndReti      ;[48] 50 + 12 = 62 until SOP
177
+
178
+#if USB_CFG_HAVE_INTRIN_ENDPOINT3
179
+handleIn3:
180
+    lds     cnt, usbTxLen3      ;[41]
181
+    sbrc    cnt, 4              ;[43]
182
+    rjmp    sendCntAndReti      ;[44] 49 + 16 = 65 until SOP
183
+    sts     usbTxLen3, x1       ;[45] x1 == USBPID_NAK from above
184
+    ldi     YL, lo8(usbTxBuf3)  ;[47]
185
+    ldi     YH, hi8(usbTxBuf3)  ;[48]
186
+    rjmp    usbSendAndReti      ;[49] 51 + 12 = 63 until SOP
187
+#endif
188
+#endif

+ 1
- 0
examples/UsbRawHidDemo1/.gitignore View File

@@ -0,0 +1 @@
1
+/.idea

+ 12
- 0
examples/UsbRawHidDemo1/CMakeLists.txt View File

@@ -0,0 +1,12 @@
1
+cmake_minimum_required(VERSION 2.8.4)
2
+set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
3
+set(PROJECT_NAME rawhid)
4
+project(${PROJECT_NAME})
5
+
6
+set(${CMAKE_PROJECT_NAME}_BOARD nano328)
7
+set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyUSB0)
8
+
9
+enable_language(ASM)
10
+
11
+set(${CMAKE_PROJECT_NAME}_SKETCH main.ino)
12
+generate_arduino_firmware(${CMAKE_PROJECT_NAME})

+ 89
- 0
examples/UsbRawHidDemo1/cmake/ArduinoToolchain.cmake View File

@@ -0,0 +1,89 @@
1
+#=============================================================================#
2
+# Author: Tomasz Bogdal (QueezyTheGreat)
3
+# Home:   https://github.com/queezythegreat/arduino-cmake
4
+#
5
+# This Source Code Form is subject to the terms of the Mozilla Public
6
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
7
+# You can obtain one at http://mozilla.org/MPL/2.0/.
8
+#=============================================================================#
9
+set(CMAKE_SYSTEM_NAME Arduino)
10
+
11
+set(CMAKE_C_COMPILER   avr-gcc)
12
+set(CMAKE_CXX_COMPILER avr-g++)
13
+
14
+# Add current directory to CMake Module path automatically
15
+if(EXISTS  ${CMAKE_CURRENT_LIST_DIR}/Platform/Arduino.cmake)
16
+    set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
17
+endif()
18
+
19
+#=============================================================================#
20
+#                         System Paths                                        #
21
+#=============================================================================#
22
+if(UNIX)
23
+    include(Platform/UnixPaths)
24
+    if(APPLE)
25
+        list(APPEND CMAKE_SYSTEM_PREFIX_PATH ~/Applications
26
+                                             /Applications
27
+                                             /Developer/Applications
28
+                                             /sw        # Fink
29
+                                             /opt/local) # MacPorts
30
+    endif()
31
+elseif(WIN32)
32
+    include(Platform/WindowsPaths)
33
+endif()
34
+
35
+
36
+#=============================================================================#
37
+#                         Detect Arduino SDK                                  #
38
+#=============================================================================#
39
+if(NOT ARDUINO_SDK_PATH)
40
+    set(ARDUINO_PATHS)
41
+
42
+    foreach(DETECT_VERSION_MAJOR 1)
43
+        foreach(DETECT_VERSION_MINOR RANGE 5 0)
44
+            list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR})
45
+            foreach(DETECT_VERSION_PATCH  RANGE 3 0)
46
+                list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR}.${DETECT_VERSION_PATCH})
47
+            endforeach()
48
+        endforeach()
49
+    endforeach()
50
+
51
+    foreach(VERSION RANGE 23 19)
52
+        list(APPEND ARDUINO_PATHS arduino-00${VERSION})
53
+    endforeach()
54
+
55
+    if(UNIX)
56
+        file(GLOB SDK_PATH_HINTS /usr/share/arduino*
57
+            /opt/local/arduino*
58
+            /opt/arduino*
59
+            /usr/local/share/arduino*)
60
+    elseif(WIN32)
61
+        set(SDK_PATH_HINTS "C:\\Program Files\\Arduino"
62
+            "C:\\Program Files (x86)\\Arduino"
63
+            )
64
+    endif()
65
+    list(SORT SDK_PATH_HINTS)
66
+    list(REVERSE SDK_PATH_HINTS)
67
+endif()
68
+
69
+find_path(ARDUINO_SDK_PATH
70
+          NAMES lib/version.txt
71
+          PATH_SUFFIXES share/arduino
72
+                        Arduino.app/Contents/Java/
73
+                        Arduino.app/Contents/Resources/Java/
74
+                        ${ARDUINO_PATHS}
75
+          HINTS ${SDK_PATH_HINTS}
76
+          DOC "Arduino SDK path.")
77
+
78
+if(ARDUINO_SDK_PATH)
79
+    list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr)
80
+    list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr/utils)
81
+else()
82
+    message(FATAL_ERROR "Could not find Arduino SDK (set ARDUINO_SDK_PATH)!")
83
+endif()
84
+
85
+set(ARDUINO_CPUMENU)
86
+if(ARDUINO_CPU)
87
+    set(ARDUINO_CPUMENU ".menu.cpu.${ARDUINO_CPU}")
88
+endif(ARDUINO_CPU)
89
+

+ 2304
- 0
examples/UsbRawHidDemo1/cmake/Platform/Arduino.cmake
File diff suppressed because it is too large
View File


+ 21
- 0
examples/UsbRawHidDemo1/main.ino View File

@@ -0,0 +1,21 @@
1
+#define ARD_UTILS_DELAYMS
2
+#include "ArdUtils/ArdUtils.h"
3
+
4
+#include "UsbRawHid.h"
5
+
6
+#define ledPin 13
7
+
8
+void setup()
9
+{
10
+    pinMode (ledPin, OUTPUT);
11
+    digitalWrite (ledPin, HIGH);
12
+}
13
+
14
+void loop()
15
+{
16
+    WAIT_USB;
17
+
18
+
19
+    ArdUtils::delayMs(1000);
20
+    digitalWrite(ledPin, !digitalRead(ledPin));
21
+}

+ 50
- 0
oddebug.c View File

@@ -0,0 +1,50 @@
1
+/* Name: oddebug.c
2
+ * Project: AVR library
3
+ * Author: Christian Starkjohann
4
+ * Creation Date: 2005-01-16
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
+ * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $
9
+ */
10
+
11
+#include "oddebug.h"
12
+
13
+#if DEBUG_LEVEL > 0
14
+
15
+#warning "Never compile production devices with debugging enabled"
16
+
17
+static void uartPutc(char c)
18
+{
19
+    while(!(ODDBG_USR & (1 << ODDBG_UDRE)));    /* wait for data register empty */
20
+    ODDBG_UDR = c;
21
+}
22
+
23
+static uchar    hexAscii(uchar h)
24
+{
25
+    h &= 0xf;
26
+    if(h >= 10)
27
+        h += 'a' - (uchar)10 - '0';
28
+    h += '0';
29
+    return h;
30
+}
31
+
32
+static void printHex(uchar c)
33
+{
34
+    uartPutc(hexAscii(c >> 4));
35
+    uartPutc(hexAscii(c));
36
+}
37
+
38
+void    odDebug(uchar prefix, uchar *data, uchar len)
39
+{
40
+    printHex(prefix);
41
+    uartPutc(':');
42
+    while(len--){
43
+        uartPutc(' ');
44
+        printHex(*data++);
45
+    }
46
+    uartPutc('\r');
47
+    uartPutc('\n');
48
+}
49
+
50
+#endif

+ 123
- 0
oddebug.h View File

@@ -0,0 +1,123 @@
1
+/* Name: oddebug.h
2
+ * Project: AVR library
3
+ * Author: Christian Starkjohann
4
+ * Creation Date: 2005-01-16
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
+ * This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $
9
+ */
10
+
11
+#ifndef __oddebug_h_included__
12
+#define __oddebug_h_included__
13
+
14
+/*
15
+General Description:
16
+This module implements a function for debug logs on the serial line of the
17
+AVR microcontroller. Debugging can be configured with the define
18
+'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging
19
+calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is
20
+2, DBG1 and DBG2 logs will be printed.
21
+
22
+A debug log consists of a label ('prefix') to indicate which debug log created
23
+the output and a memory block to dump in hex ('data' and 'len').
24
+*/
25
+
26
+
27
+#ifndef F_CPU
28
+#   define  F_CPU   12000000    /* 12 MHz */
29
+#endif
30
+
31
+/* make sure we have the UART defines: */
32
+#include "usbportability.h"
33
+
34
+#ifndef uchar
35
+#   define  uchar   unsigned char
36
+#endif
37
+
38
+#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */
39
+#   warning "Debugging disabled because device has no UART"
40
+#   undef   DEBUG_LEVEL
41
+#endif
42
+
43
+#ifndef DEBUG_LEVEL
44
+#   define  DEBUG_LEVEL 0
45
+#endif
46
+
47
+/* ------------------------------------------------------------------------- */
48
+
49
+#if DEBUG_LEVEL > 0
50
+#   define  DBG1(prefix, data, len) odDebug(prefix, data, len)
51
+#else
52
+#   define  DBG1(prefix, data, len)
53
+#endif
54
+
55
+#if DEBUG_LEVEL > 1
56
+#   define  DBG2(prefix, data, len) odDebug(prefix, data, len)
57
+#else
58
+#   define  DBG2(prefix, data, len)
59
+#endif
60
+
61
+/* ------------------------------------------------------------------------- */
62
+
63
+#if DEBUG_LEVEL > 0
64
+extern void odDebug(uchar prefix, uchar *data, uchar len);
65
+
66
+/* Try to find our control registers; ATMEL likes to rename these */
67
+
68
+#if defined UBRR
69
+#   define  ODDBG_UBRR  UBRR
70
+#elif defined UBRRL
71
+#   define  ODDBG_UBRR  UBRRL
72
+#elif defined UBRR0
73
+#   define  ODDBG_UBRR  UBRR0
74
+#elif defined UBRR0L
75
+#   define  ODDBG_UBRR  UBRR0L
76
+#endif
77
+
78
+#if defined UCR
79
+#   define  ODDBG_UCR   UCR
80
+#elif defined UCSRB
81
+#   define  ODDBG_UCR   UCSRB
82
+#elif defined UCSR0B
83
+#   define  ODDBG_UCR   UCSR0B
84
+#endif
85
+
86
+#if defined TXEN
87
+#   define  ODDBG_TXEN  TXEN
88
+#else
89
+#   define  ODDBG_TXEN  TXEN0
90
+#endif
91
+
92
+#if defined USR
93
+#   define  ODDBG_USR   USR
94
+#elif defined UCSRA
95
+#   define  ODDBG_USR   UCSRA
96
+#elif defined UCSR0A
97
+#   define  ODDBG_USR   UCSR0A
98
+#endif
99
+
100
+#if defined UDRE
101
+#   define  ODDBG_UDRE  UDRE
102
+#else
103
+#   define  ODDBG_UDRE  UDRE0
104
+#endif
105
+
106
+#if defined UDR
107
+#   define  ODDBG_UDR   UDR
108
+#elif defined UDR0
109
+#   define  ODDBG_UDR   UDR0
110
+#endif
111
+
112
+static inline void  odDebugInit(void)
113
+{
114
+    ODDBG_UCR |= (1<<ODDBG_TXEN);
115
+    ODDBG_UBRR = F_CPU / (19200 * 16L) - 1;
116
+}
117
+#else
118
+#   define odDebugInit()
119
+#endif
120
+
121
+/* ------------------------------------------------------------------------- */
122
+
123
+#endif /* __oddebug_h_included__ */

+ 369
- 0
usbconfig-prototype.h View File

@@ -0,0 +1,369 @@
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
+ * This Revision: $Id: usbconfig-prototype.h 767 2009-08-22 11:39:22Z cs $
9
+ */
10
+
11
+#ifndef __usbconfig_h_included__
12
+#define __usbconfig_h_included__
13
+
14
+/*
15
+General Description:
16
+This file is an example configuration (with inline documentation) for the USB
17
+driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
18
+also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
19
+wire the lines to any other port, as long as D+ is also wired to INT0 (or any
20
+other hardware interrupt, as long as it is the highest level interrupt, see
21
+section at the end of this file).
22
++ To create your own usbconfig.h file, copy this file to your project's
23
++ firmware source directory) and rename it to "usbconfig.h".
24
++ Then edit it accordingly.
25
+*/
26
+
27
+/* ---------------------------- Hardware Config ---------------------------- */
28
+
29
+#define USB_CFG_IOPORTNAME      D
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
+ */
33
+#define USB_CFG_DMINUS_BIT      4
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
+ */
37
+#define USB_CFG_DPLUS_BIT       2
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! [You can also use other interrupts, see section
41
+ * "Optional MCU Description" below, or you can connect D- to the interrupt, as
42
+ * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
43
+ * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
44
+ * markers every millisecond.]
45
+ */
46
+#define USB_CFG_CLOCK_KHZ       (F_CPU/1000)
47
+/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
48
+ * 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no
49
+ * crystal, they tolerate +/- 1% deviation from the nominal frequency. All
50
+ * other rates require a precision of 2000 ppm and thus a crystal!
51
+ * Default if not specified: 12 MHz
52
+ */
53
+#define USB_CFG_CHECK_CRC       0
54
+/* Define this to 1 if you want that the driver checks integrity of incoming
55
+ * data packets (CRC checks). CRC checks cost quite a bit of code size and are
56
+ * currently only available for 18 MHz crystal clock. You must choose
57
+ * USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
58
+ */
59
+
60
+/* ----------------------- Optional Hardware Config ------------------------ */
61
+
62
+/* #define USB_CFG_PULLUP_IOPORTNAME   D */
63
+/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
64
+ * V+, you can connect and disconnect the device from firmware by calling
65
+ * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
66
+ * This constant defines the port on which the pullup resistor is connected.
67
+ */
68
+/* #define USB_CFG_PULLUP_BIT          4 */
69
+/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
70
+ * above) where the 1.5k pullup resistor is connected. See description
71
+ * above for details.
72
+ */
73
+
74
+/* --------------------------- Functional Range ---------------------------- */
75
+
76
+#define USB_CFG_HAVE_INTRIN_ENDPOINT    0
77
+/* Define this to 1 if you want to compile a version with two endpoints: The
78
+ * default control endpoint 0 and an interrupt-in endpoint (any other endpoint
79
+ * number).
80
+ */
81
+#define USB_CFG_HAVE_INTRIN_ENDPOINT3   0
82
+/* Define this to 1 if you want to compile a version with three endpoints: The
83
+ * default control endpoint 0, an interrupt-in endpoint 3 (or the number
84
+ * configured below) and a catch-all default interrupt-in endpoint as above.
85
+ * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
86
+ */
87
+#define USB_CFG_EP3_NUMBER              3
88
+/* If the so-called endpoint 3 is used, it can now be configured to any other
89
+ * endpoint number (except 0) with this macro. Default if undefined is 3.
90
+ */
91
+/* #define USB_INITIAL_DATATOKEN           USBPID_DATA1 */
92
+/* The above macro defines the startup condition for data toggling on the
93
+ * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
94
+ * Since the token is toggled BEFORE sending any data, the first packet is
95
+ * sent with the oposite value of this configuration!
96
+ */
97
+#define USB_CFG_IMPLEMENT_HALT          0
98
+/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
99
+ * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
100
+ * it is required by the standard. We have made it a config option because it
101
+ * bloats the code considerably.
102
+ */
103
+#define USB_CFG_SUPPRESS_INTR_CODE      0
104
+/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
105
+ * want to send any data over them. If this macro is defined to 1, functions
106
+ * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
107
+ * you need the interrupt-in endpoints in order to comply to an interface
108
+ * (e.g. HID), but never want to send any data. This option saves a couple
109
+ * of bytes in flash memory and the transmit buffers in RAM.
110
+ */
111
+#define USB_CFG_INTR_POLL_INTERVAL      10
112
+/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
113
+ * interval. The value is in milliseconds and must not be less than 10 ms for
114
+ * low speed devices.
115
+ */
116
+#define USB_CFG_IS_SELF_POWERED         0
117
+/* Define this to 1 if the device has its own power supply. Set it to 0 if the
118
+ * device is powered from the USB bus.
119
+ */
120
+#define USB_CFG_MAX_BUS_POWER           100
121
+/* Set this variable to the maximum USB bus power consumption of your device.
122
+ * The value is in milliamperes. [It will be divided by two since USB
123
+ * communicates power requirements in units of 2 mA.]
124
+ */
125
+#define USB_CFG_IMPLEMENT_FN_WRITE      0
126
+/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
127
+ * transfers. Set it to 0 if you don't need it and want to save a couple of
128
+ * bytes.
129
+ */
130
+#define USB_CFG_IMPLEMENT_FN_READ       0
131
+/* Set this to 1 if you need to send control replies which are generated
132
+ * "on the fly" when usbFunctionRead() is called. If you only want to send
133
+ * data from a static buffer, set it to 0 and return the data from
134
+ * usbFunctionSetup(). This saves a couple of bytes.
135
+ */
136
+#define USB_CFG_IMPLEMENT_FN_WRITEOUT   0
137
+/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
138
+ * You must implement the function usbFunctionWriteOut() which receives all
139
+ * interrupt/bulk data sent to any endpoint other than 0. The endpoint number
140
+ * can be found in 'usbRxToken'.
141
+ */
142
+#define USB_CFG_HAVE_FLOWCONTROL        0
143
+/* Define this to 1 if you want flowcontrol over USB data. See the definition
144
+ * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
145
+ * usbdrv.h.
146
+ */
147
+#define USB_CFG_LONG_TRANSFERS          0
148
+/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
149
+ * in a single control-in or control-out transfer. Note that the capability
150
+ * for long transfers increases the driver size.
151
+ */
152
+/* #define USB_RX_USER_HOOK(data, len)     if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
153
+/* This macro is a hook if you want to do unconventional things. If it is
154
+ * defined, it's inserted at the beginning of received message processing.
155
+ * If you eat the received message and don't want default processing to
156
+ * proceed, do a return after doing your things. One possible application
157
+ * (besides debugging) is to flash a status LED on each packet.
158
+ */
159
+/* #define USB_RESET_HOOK(resetStarts)     if(!resetStarts){hadUsbReset();} */
160
+/* This macro is a hook if you need to know when an USB RESET occurs. It has
161
+ * one parameter which distinguishes between the start of RESET state and its
162
+ * end.
163
+ */
164
+/* #define USB_SET_ADDRESS_HOOK()              hadAddressAssigned(); */
165
+/* This macro (if defined) is executed when a USB SET_ADDRESS request was
166
+ * received.
167
+ */
168
+#define USB_COUNT_SOF                   0
169
+/* define this macro to 1 if you need the global variable "usbSofCount" which
170
+ * counts SOF packets. This feature requires that the hardware interrupt is
171
+ * connected to D- instead of D+.
172
+ */
173
+/* #ifdef __ASSEMBLER__
174
+ * macro myAssemblerMacro
175
+ *     in      YL, TCNT0
176
+ *     sts     timer0Snapshot, YL
177
+ *     endm
178
+ * #endif
179
+ * #define USB_SOF_HOOK                    myAssemblerMacro
180
+ * This macro (if defined) is executed in the assembler module when a
181
+ * Start Of Frame condition is detected. It is recommended to define it to
182
+ * the name of an assembler macro which is defined here as well so that more
183
+ * than one assembler instruction can be used. The macro may use the register
184
+ * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
185
+ * immediately after an SOF pulse may be lost and must be retried by the host.
186
+ * What can you do with this hook? Since the SOF signal occurs exactly every
187
+ * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
188
+ * designs running on the internal RC oscillator.
189
+ * Please note that Start Of Frame detection works only if D- is wired to the
190
+ * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
191
+ */
192
+#define USB_CFG_CHECK_DATA_TOGGLING     0
193
+/* define this macro to 1 if you want to filter out duplicate data packets
194
+ * sent by the host. Duplicates occur only as a consequence of communication
195
+ * errors, when the host does not receive an ACK. Please note that you need to
196
+ * implement the filtering yourself in usbFunctionWriteOut() and
197
+ * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
198
+ * for each control- and out-endpoint to check for duplicate packets.
199
+ */
200
+#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH   0
201
+/* define this macro to 1 if you want the function usbMeasureFrameLength()
202
+ * compiled in. This function can be used to calibrate the AVR's RC oscillator.
203
+ */
204
+#define USB_USE_FAST_CRC                0
205
+/* The assembler module has two implementations for the CRC algorithm. One is
206
+ * faster, the other is smaller. This CRC routine is only used for transmitted
207
+ * messages where timing is not critical. The faster routine needs 31 cycles
208
+ * per byte while the smaller one needs 61 to 69 cycles. The faster routine
209
+ * may be worth the 32 bytes bigger code size if you transmit lots of data and
210
+ * run the AVR close to its limit.
211
+ */
212
+
213
+/* -------------------------- Device Description --------------------------- */
214
+
215
+#define  USB_CFG_VENDOR_ID       0xc0, 0x16 /* = 0x16c0 = 5824 = voti.nl */
216
+/* USB vendor ID for the device, low byte first. If you have registered your
217
+ * own Vendor ID, define it here. Otherwise you may use one of obdev's free
218
+ * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
219
+ * *** IMPORTANT NOTE ***
220
+ * This template uses obdev's shared VID/PID pair for Vendor Class devices
221
+ * with libusb: 0x16c0/0x5dc.  Use this VID/PID pair ONLY if you understand
222
+ * the implications!
223
+ */
224
+#define  USB_CFG_DEVICE_ID       0xdc, 0x05 /* = 0x05dc = 1500 */
225
+/* This is the ID of the product, low byte first. It is interpreted in the
226
+ * scope of the vendor ID. If you have registered your own VID with usb.org
227
+ * or if you have licensed a PID from somebody else, define it here. Otherwise
228
+ * you may use one of obdev's free shared VID/PID pairs. See the file
229
+ * USB-IDs-for-free.txt for details!
230
+ * *** IMPORTANT NOTE ***
231
+ * This template uses obdev's shared VID/PID pair for Vendor Class devices
232
+ * with libusb: 0x16c0/0x5dc.  Use this VID/PID pair ONLY if you understand
233
+ * the implications!
234
+ */
235
+#define USB_CFG_DEVICE_VERSION  0x00, 0x01
236
+/* Version number of the device: Minor number first, then major number.
237
+ */
238
+#define USB_CFG_VENDOR_NAME     'o', 'b', 'd', 'e', 'v', '.', 'a', 't'
239
+#define USB_CFG_VENDOR_NAME_LEN 8
240
+/* These two values define the vendor name returned by the USB device. The name
241
+ * must be given as a list of characters under single quotes. The characters
242
+ * are interpreted as Unicode (UTF-16) entities.
243
+ * If you don't want a vendor name string, undefine these macros.
244
+ * ALWAYS define a vendor name containing your Internet domain name if you use
245
+ * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
246
+ * details.
247
+ */
248
+#define USB_CFG_DEVICE_NAME     'T', 'e', 'm', 'p', 'l', 'a', 't', 'e'
249
+#define USB_CFG_DEVICE_NAME_LEN 8
250
+/* Same as above for the device name. If you don't want a device name, undefine
251
+ * the macros. See the file USB-IDs-for-free.txt before you assign a name if
252
+ * you use a shared VID/PID.
253
+ */
254
+/*#define USB_CFG_SERIAL_NUMBER   'N', 'o', 'n', 'e' */
255
+/*#define USB_CFG_SERIAL_NUMBER_LEN   0 */
256
+/* Same as above for the serial number. If you don't want a serial number,
257
+ * undefine the macros.
258
+ * It may be useful to provide the serial number through other means than at
259
+ * compile time. See the section about descriptor properties below for how
260
+ * to fine tune control over USB descriptors such as the string descriptor
261
+ * for the serial number.
262
+ */
263
+#define USB_CFG_DEVICE_CLASS        0xff    /* set to 0 if deferred to interface */
264
+#define USB_CFG_DEVICE_SUBCLASS     0
265
+/* See USB specification if you want to conform to an existing device class.
266
+ * Class 0xff is "vendor specific".
267
+ */
268
+#define USB_CFG_INTERFACE_CLASS     0   /* define class here if not at device level */
269
+#define USB_CFG_INTERFACE_SUBCLASS  0
270
+#define USB_CFG_INTERFACE_PROTOCOL  0
271
+/* See USB specification if you want to conform to an existing device class or
272
+ * protocol. The following classes must be set at interface level:
273
+ * HID class is 3, no subclass and protocol required (but may be useful!)
274
+ * CDC class is 2, use subclass 2 and protocol 1 for ACM
275
+ */
276
+/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH    42 */
277
+/* Define this to the length of the HID report descriptor, if you implement
278
+ * an HID device. Otherwise don't define it or define it to 0.
279
+ * If you use this define, you must add a PROGMEM character array named
280
+ * "usbHidReportDescriptor" to your code which contains the report descriptor.
281
+ * Don't forget to keep the array and this define in sync!
282
+ */
283
+
284
+/* #define USB_PUBLIC static */
285
+/* Use the define above if you #include usbdrv.c instead of linking against it.
286
+ * This technique saves a couple of bytes in flash memory.
287
+ */
288
+
289
+/* ------------------- Fine Control over USB Descriptors ------------------- */
290
+/* If you don't want to use the driver's default USB descriptors, you can
291
+ * provide our own. These can be provided as (1) fixed length static data in
292
+ * flash memory, (2) fixed length static data in RAM or (3) dynamically at
293
+ * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
294
+ * information about this function.
295
+ * Descriptor handling is configured through the descriptor's properties. If
296
+ * no properties are defined or if they are 0, the default descriptor is used.
297
+ * Possible properties are:
298
+ *   + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
299
+ *     at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
300
+ *     used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
301
+ *     you want RAM pointers.
302
+ *   + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
303
+ *     in static memory is in RAM, not in flash memory.
304
+ *   + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
305
+ *     the driver must know the descriptor's length. The descriptor itself is
306
+ *     found at the address of a well known identifier (see below).
307
+ * List of static descriptor names (must be declared PROGMEM if in flash):
308
+ *   char usbDescriptorDevice[];
309
+ *   char usbDescriptorConfiguration[];
310
+ *   char usbDescriptorHidReport[];
311
+ *   char usbDescriptorString0[];
312
+ *   int usbDescriptorStringVendor[];
313
+ *   int usbDescriptorStringDevice[];
314
+ *   int usbDescriptorStringSerialNumber[];
315
+ * Other descriptors can't be provided statically, they must be provided
316
+ * dynamically at runtime.
317
+ *
318
+ * Descriptor properties are or-ed or added together, e.g.:
319
+ * #define USB_CFG_DESCR_PROPS_DEVICE   (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
320
+ *
321
+ * The following descriptors are defined:
322
+ *   USB_CFG_DESCR_PROPS_DEVICE
323
+ *   USB_CFG_DESCR_PROPS_CONFIGURATION
324
+ *   USB_CFG_DESCR_PROPS_STRINGS
325
+ *   USB_CFG_DESCR_PROPS_STRING_0
326
+ *   USB_CFG_DESCR_PROPS_STRING_VENDOR
327
+ *   USB_CFG_DESCR_PROPS_STRING_PRODUCT
328
+ *   USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
329
+ *   USB_CFG_DESCR_PROPS_HID
330
+ *   USB_CFG_DESCR_PROPS_HID_REPORT
331
+ *   USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
332
+ *
333
+ * Note about string descriptors: String descriptors are not just strings, they
334
+ * are Unicode strings prefixed with a 2 byte header. Example:
335
+ * int  serialNumberDescriptor[] = {
336
+ *     USB_STRING_DESCRIPTOR_HEADER(6),
337
+ *     'S', 'e', 'r', 'i', 'a', 'l'
338
+ * };
339
+ */
340
+
341
+#define USB_CFG_DESCR_PROPS_DEVICE                  0
342
+#define USB_CFG_DESCR_PROPS_CONFIGURATION           0
343
+#define USB_CFG_DESCR_PROPS_STRINGS                 0
344
+#define USB_CFG_DESCR_PROPS_STRING_0                0
345
+#define USB_CFG_DESCR_PROPS_STRING_VENDOR           0
346
+#define USB_CFG_DESCR_PROPS_STRING_PRODUCT          0
347
+#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER    0
348
+#define USB_CFG_DESCR_PROPS_HID                     0
349
+#define USB_CFG_DESCR_PROPS_HID_REPORT              0
350
+#define USB_CFG_DESCR_PROPS_UNKNOWN                 0
351
+
352
+/* ----------------------- Optional MCU Description ------------------------ */
353
+
354
+/* The following configurations have working defaults in usbdrv.h. You
355
+ * usually don't need to set them explicitly. Only if you want to run
356
+ * the driver on a device which is not yet supported or with a compiler
357
+ * which is not fully supported (such as IAR C) or if you use a differnt
358
+ * interrupt than INT0, you may have to define some of these.
359
+ */
360
+/* #define USB_INTR_CFG            MCUCR */
361
+/* #define USB_INTR_CFG_SET        ((1 << ISC00) | (1 << ISC01)) */
362
+/* #define USB_INTR_CFG_CLR        0 */
363
+/* #define USB_INTR_ENABLE         GIMSK */
364
+/* #define USB_INTR_ENABLE_BIT     INT0 */
365
+/* #define USB_INTR_PENDING        GIFR */
366
+/* #define USB_INTR_PENDING_BIT    INTF0 */
367
+/* #define USB_INTR_VECTOR         SIG_INTERRUPT0 */
368
+
369
+#endif /* __usbconfig_h_included__ */

+ 371
- 0
usbconfig.h View File

@@ -0,0 +1,371 @@
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)