From 037c4736732c088e4d99843017e55b4ea68b7481 Mon Sep 17 00:00:00 2001 From: Lucas Teske Date: Sun, 17 Aug 2014 16:20:59 -0300 Subject: [PATCH] Updated vusb library to compile on new versions of AVR-GCC. --- bin/firmware/usbasp.atmega48.2009-02-28.hex | 242 ------- bin/firmware/usbasp.atmega48.2014-08-17.hex | 227 ++++++ firmware/usbdrv/Changelog.txt | 10 + firmware/usbdrv/USB-IDs-for-free.txt | 16 +- firmware/usbdrv/oddebug.c | 2 +- firmware/usbdrv/oddebug.h | 2 +- firmware/usbdrv/usbconfig-prototype.h | 2 +- firmware/usbdrv/usbdrv.c | 19 +- firmware/usbdrv/usbdrv.h | 21 +- firmware/usbdrv/usbdrv.h~ | 735 ++++++++++++++++++++ firmware/usbdrv/usbdrvasm.S | 2 +- firmware/usbdrv/usbdrvasm12.inc | 2 +- firmware/usbdrv/usbdrvasm128.inc | 2 +- firmware/usbdrv/usbdrvasm15.inc | 2 +- firmware/usbdrv/usbdrvasm16.inc | 2 +- firmware/usbdrv/usbdrvasm165.inc | 2 +- firmware/usbdrv/usbdrvasm18-crc.inc | 2 +- firmware/usbdrv/usbdrvasm20.inc | 2 +- firmware/usbdrv/usbportability.h | 2 +- 19 files changed, 1017 insertions(+), 277 deletions(-) delete mode 100644 bin/firmware/usbasp.atmega48.2009-02-28.hex create mode 100644 bin/firmware/usbasp.atmega48.2014-08-17.hex create mode 100644 firmware/usbdrv/usbdrv.h~ diff --git a/bin/firmware/usbasp.atmega48.2009-02-28.hex b/bin/firmware/usbasp.atmega48.2009-02-28.hex deleted file mode 100644 index 1b25ac5..0000000 --- a/bin/firmware/usbasp.atmega48.2009-02-28.hex +++ /dev/null @@ -1,242 +0,0 @@ -:1000000042C0ADC15BC05AC059C058C057C056C0ED -:1000100055C054C053C052C051C050C04FC04EC054 -:100020004DC04CC04BC04AC049C048C047C046C084 -:1000300045C044C0040309041C037700770077001F -:100040002E00660069007300630068006C002E00DB -:10005000640065000E035500530042006100730008 -:10006000700012011001FF000008C016DC0503013A -:1000700001020001090212000101008019090400B7 -:1000800000000000000011241FBECFEFD2E0DEBF51 -:10009000CDBF11E0A0E0B1E0E0E0FFE002C00590DC -:1000A0000D92A230B107D9F711E0A2E0B1E001C092 -:1000B0001D92A734B107E1F7C4D420C7A1CFE9E668 -:1000C000F0E0808183608083E89A08951F93CF9346 -:1000D000DF9360912801635067FD13C08091250173 -:1000E000CCE0D0E0C81BD109C45DDE4F8091240173 -:1000F0008D3209F462C08091020187FD84C01092A4 -:1001000028018091000184FF4AC0609101016F3F86 -:1001100009F445C0693070F1685060930101809125 -:10012000180198E889278093180168E080910201FE -:1001300087FD8BC0209126013091270186FF6DC07D -:10014000A9E1B1E080E090E0F901E80FF91FE49146 -:10015000ED9301966817C1F76150862F90E06F5FAD -:100160000196820F931F9093270180932601162FEB -:100170001C5F0BC0109201018091180198E889273B -:1001800080931801662391F614E089E191E0E3D0B1 -:100190001C3019F08FEF809301011093000194E15E -:1001A00083B1837031F49150D9F7109229011092E4 -:1001B0002301DF91CF911F910895683009F09FCFFF -:1001C00083EC809318018AE580930001109202016C -:1001D0008881807659F59A8110922101898188233E -:1001E00009F043C01092220122E081E291E0909355 -:1001F0002701809326018F81882319F49E8192170D -:1002000008F1922F1FC0CE012DD48F3F51F18823CA -:1002100009F475CF1092010172CF962FD901E9E14F -:10022000F1E08D9181939150E1F796CFCE010CD5FD -:10023000282F8F3F01F7888187FD25C09FEF80E839 -:1002400080930201909301015ACF89E191E0ACD4EF -:10025000682F893008F453C08FEF809301011EE1AD -:100260009CCF8EE1809300014ACF853071F08630BB -:1002700091F0883031F1893061F18A3031F120E03C -:1002800081E291E0B4CF9E81DACF9093290120E002 -:1002900081E291E0ACCF8B81813049F18230F9F07D -:1002A000833029F020E080E480930201A4CF9923D9 -:1002B00049F584E390E0909327018093260124E0A0 -:1002C000F2CF21E08BE291E092CF21E081E291E058 -:1002D0008ECF90932B0120E081E291E088CF84E7DC -:1002E00090E0909327018093260122E1DCCF82E603 -:1002F00090E0909327018093260122E1D4CF182F1C -:100300001C5F43CF913051F0923061F684E590E06C -:1003100090932701809326012EE0C5CF88E390E0DB -:1003200090932701809326012CE1BDCFA82FB92FF0 -:1003300080E090E041E050EA60956F5F58F42D91C5 -:1003400038EF82279795879510F0842795273F5F90 -:10035000C8F3F3CF0895EADF8D939D930895CF936B -:10036000CFB7CF93C395189BE9F7189B09C0189B8B -:1003700007C0189B05C0189B03C0189B01C0A1C0F3 -:10038000DF93C0912501DD27C45DDE4F189B02C0BD -:10039000DF91EBCF2F930F931F9303B12FEF00FB50 -:1003A00020F94F933F9313B14FEF012700FB21F941 -:1003B0003BE031C04E7F012F13B1216028C0102FC8 -:1003C0004D7F2260000003B129C04B7F2460012FC4 -:1003D000000013B12BC013B1477F28602AC04F7EA5 -:1003E00003B120612CC04F7D13B120622FC04F7B21 -:1003F00003B1206432C0422703B149934FEF00009C -:10040000102710FB20F913B11370C9F1297F91F265 -:10041000012700FB21F903B1237F89F2315058F104 -:10042000102710FB22F913B1277E79F2012700FB78 -:1004300023F92F7C81F203B1102710FB24F92F79C7 -:1004400071F200C013B1012700FB25F92F7359F297 -:1004500000C003B1102710FB26F9223040F200C083 -:1004600013B1012700FB27F9243028F64F772068C5 -:1004700013B10000F9CF11E01CBB002717C03B509F -:100480003195C31BD04011E01CBB0881033CE9F04F -:100490000B34D9F0209123011981110F1213EDCFE4 -:1004A000093641F10D3211F0013E39F700932A016E -:1004B0003F914F911F910F912F91DF91CCB3C0FDD0 -:1004C00051CFCF91CFBFCF91189520912A012223F0 -:1004D00079F310912801112311F5343012F1309382 -:1004E000280120932401109125013BE0311B30931A -:1004F000250117C00091280101308CF40AE53091E4 -:10050000000134FD10C000930001C8E1D1E00FC02C -:100510002795A8F45150A9F4220F0000F9CF4AE51D -:1005200003C042ED01C0432FC4E1D0E032E014B17A -:100530001360289A14B905B120E413E05F930127F2 -:1005400056E005B9279520F4515021F4220FF9CF38 -:10055000012756E000003B5A05B9D0F2279528F450 -:10056000515029F4220F0000F9CF012756E02795BA -:1005700005B920F4515021F4220FF9CF012756E09C -:100580002991332305B921F60C7F10912901110F10 -:10059000C651D04005B911F01093230111E01CBBE6 -:1005A000016014B11C7F402F4C7F5F9100C000C0E0 -:1005B00005B914B945B97CCF809145018CBD8091B6 -:1005C00042018DBD0895282F8823A1F0883008F0BE -:1005D0003FC08CE793E09093440180934301243023 -:1005E00001F12530A0F0263081F1263050F127307E -:1005F000E1F008958DE993E09093440180934301E5 -:1006000082E58093450181E0809342010895223084 -:10061000A1F0233070F4213061F780EC8093460123 -:10062000089588E180934601089583E08093460110 -:10063000089580E380934601089580E68093460103 -:1006400008958CE080934601089520934601089513 -:100650008DE993E09093440180934301109242010D -:10066000293041F02A3050F4283051F683E5809348 -:100670004501089582E58093450108952B3031F0BE -:100680002C3009F0BDCF81E08093420181E5809359 -:100690004501089526B59091460186B5821B8917BC -:1006A000E0F3089584B18C6284B92A982D9896B5A8 -:1006B0002091460186B5891B8217E0F32A9A96B5E8 -:1006C00086B5891B8217E0F32A98809143019091A7 -:1006D00044018D59934009F00895809145018CBDE6 -:1006E000809142018DBD089584B1837D84B985B127 -:1006F000837D85B91CBC0895582F2091460140E0A8 -:1007000030E057FD16C02B98440F1C994F5F2D9A6F -:1007100096B586B5891B8217E0F32D9896B586B5F8 -:10072000891B8217E0F33F5F383029F0550F57FFE0 -:10073000EACF2B9AE9CF842F08958EBD0DB407FE22 -:10074000FDCF8EB508950F931F930FE1E091430104 -:10075000F09144018CEA0995E0914301F091440144 -:1007600083E50995E0914301F091440180E009950A -:10077000182FE0914301F091440180E00995133571 -:1007800039F11CBC2D9A96B52091460186B5891B7E -:100790008217E0F32D9896B586B5891B8217E0F392 -:1007A000E0914301F091440183E0ED39F80721F035 -:1007B000002351F00150CECF809145018CBD809136 -:1007C00042018DBD0023B1F781E01F910F91089583 -:1007D00080E01F910F910895EF92FF920F931F9366 -:1007E0007B018C01862F8170880F880F880FE09124 -:1007F0004301F091440180620995D801C70129E0C5 -:10080000B695A795979587952A95D1F7E0914301DD -:10081000F0914401099516950795F794E794E091B6 -:100820004301F09144018E2D0995E0914301F0912F -:10083000440180E009951F910F91FF90EF9008957A -:100840000F931F938C01E0914301F091440180EAE2 -:100850000995E0914301F0914401812F0995E091C0 -:100860004301F0914401802F0995E0914301F091FB -:10087000440180E009951F910F910895FF920F9315 -:100880001F938C01F62EE0914301F091440180EC1E -:100890000995E0914301F0914401812F0995E09180 -:1008A0004301F0914401802F0995E0914301F091BB -:1008B00044018F2D09958EE1B7D080E01F910F91F3 -:1008C000FF900895CF92DF92EF92FF920F931F93C4 -:1008D0006B017C01142FE0914301F09144018CE401 -:1008E0000995D701C60149E0B695A79597958795D3 -:1008F0004A95D1F7E0914301F09144010995D70160 -:10090000C601B695A79597958795E0914301F0911B -:1009100044010995E0914301F091440180E009957B -:100920001F3FF1F016B50EE1C701B60155DF8F3F4D -:1009300079F486B5811B8D33B8F316B50150A1F754 -:1009400081E01F910F91FF90EF90DF90CF9008957D -:1009500080E01F910F91FF90EF90DF90CF9008956E -:100960008FE062D080E01F910F91FF90EF90DF90B9 -:10097000CF900895CF92DF92EF92FF920F931F9343 -:100980006B017C01042F122F862F8170880F880F36 -:10099000880FE0914301F091440180640995D701EB -:1009A000C60169E0B695A795979587956A95D1F7A1 -:1009B000E0914301F09144010995D701C601B69534 -:1009C000A79597958795E0914301F091440109958A -:1009D000E0914301F0914401802F09951123C1F06A -:1009E0000F37F1F016B50EE1C701B601F5DE8F370E -:1009F00079F486B5811B8D33B8F316B50150A1F794 -:100A000081E01F910F91FF90EF90DF90CF900895BC -:100A100080E01F910F91FF90EF90DF90CF900895AD -:100A20008FE002D080E0F5CF382F882349F020E016 -:100A300096B586B5891B8C33E0F32F5F2317C0F37F -:100A400008951BB815B88BEF8AB98FEF84B914B825 -:100A500093E097B98EEF88B995BD31DB789436DB9A -:100A600035DBFDCFFF920F931F93CF93DF93F82ECB -:100A7000292F062F40910301413051F0443041F0BD -:100A80001FEF812FDF91CF911F910F91FF9008955C -:100A9000002309F487C08F2D922F9C01E90110E0FB -:100AA00053C08091140190911501892B09F058C011 -:100AB00060911001709111018091120190911301C8 -:100AC00021E0488157DF8091040190910501019751 -:100AD0009093050180930401892BD9F410920301AE -:100AE0008091160181FF3AC08091170190E020911A -:100AF0001401309115018217930781F16091100163 -:100B00007091110180911201909113014881DADEF8 -:100B100011E08091100190911101A0911201B0910A -:100B200013010196A11DB11D809310019093110135 -:100B3000A0931201B093130121969E012F19201743 -:100B400008F09FCF40910301413009F4AACF68819A -:100B5000809110019091110191DEB5CF11E0D9CFB4 -:100B60006091100170911101809112019091130117 -:100B700020E04881FFDE80911701815080931701AA -:100B8000882309F0A0CF609110017091110180912C -:100B9000120190911301488195DE80911401809398 -:100BA000170191CF10E06DCF0F931F93CF93DF9379 -:100BB000082F162F40910301842F8250823038F085 -:100BC0001FEF812FDF91CF911F910F910895662321 -:100BD00099F1802F9C01E90120C080911001909132 -:100BE00011012EDE88838091100190911101A09156 -:100BF0001201B09113010196A11DB11D8093100146 -:100C000090931101A0931201B093130121969E01BC -:100C1000201B211778F4409103014230F1F66091D6 -:100C20001001709111018091120190911301D4DD96 -:100C30008883D9CF183028F610920301812FDF91D5 -:100C4000CF911F910F9108950F931F93CF93DF932F -:100C50008C01EC0189818130F1F0823009F4B0C05F -:100C6000833031F1843009F482C0873009F456C0F2 -:100C7000853009F41EC1863009F4D7C0883009F4E4 -:100C8000A5C0893009F41CC18A3009F42DC180E067 -:100C9000C8E0D1E037C0329B3EC08091060193DCB2 -:100CA000109207014198FEDC80E0C8E0D1E02AC044 -:100CB000E0914301F0914401E8018A810995C8E07F -:100CC000D1E0809308012091430130914401F80163 -:100CD0008381F901099580930901209143013091A5 -:100CE0004401F8018481F901099580930A0120915A -:100CF000430130914401F8018581F9010995809300 -:100D00000B0184E0D0932701C0932601DF91CF919E -:100D10001F910F91089585E056DCC2CF80910701A5 -:100D2000882399F4E8019B8180E02A8130E0822BBE -:100D3000932BAA2797FDA095BA2F8093100190932B -:100D40001101A0931201B0931301F801978180E083 -:100D5000268130E0822B932B909305018093040130 -:100D600083E0809303018FEFC8E0D1E0CBCF809187 -:100D70000701882399F4E8019B8180E02A8130E013 -:100D8000822B932BAA2797FDA095BA2F8093100151 -:100D900090931101A0931201B0931301F801978170 -:100DA00080E0268130E0822B932B90930501809385 -:100DB000040182E0809303018FEFC8E0D1E0A2CF6D -:100DC00093DC419A80E0C8E0D1E09CCF809107019C -:100DD000882399F4F801938180E0228130E0822B0E -:100DE000932BAA2797FDA095BA2F8093100190937B -:100DF0001101A0931201B0931301109215011092EA -:100E0000140110921601E8019F8180E02E8130E0EC -:100E1000822B932B909305018093040184E08093AF -:100E200003018FEFC8E0D1E06DCF809107018823E7 -:100E300099F4E8019B8180E02A8130E0822B932B9A -:100E4000AA2797FDA095BA2F8093100190931101C6 -:100E5000A0931201B0931301F80184819581292F89 -:100E60002F7020931601492F50E0407F507042951B -:100E70005295507F5427407F5427480F511D50935F -:100E800015014093140120FF02C040931701E801AF -:100E90009F8180E02E8130E0822B932B909305017F -:100EA0008093040181E0809303018FEFC8E0D1E0DB -:100EB00029CF49DCC8E0D1E08093080181E022CF4E -:100EC00081E080930701F80182819381A481B5813B -:100ED0008093100190931101A0931201B09313011C -:100EE00080E0C8E0D1E00ECFE8018A81809306015E -:100EF000C8E0D1E01092080181E004CFF894FFCF60 -:020F00005AFF96 -:00000001FF diff --git a/bin/firmware/usbasp.atmega48.2014-08-17.hex b/bin/firmware/usbasp.atmega48.2014-08-17.hex new file mode 100644 index 0000000..f44493e --- /dev/null +++ b/bin/firmware/usbasp.atmega48.2014-08-17.hex @@ -0,0 +1,227 @@ +:1000000042C08FC15BC05AC059C058C057C056C00B +:1000100055C054C053C052C051C050C04FC04EC054 +:100020004DC04CC04BC04AC049C048C047C046C084 +:1000300045C044C0090212000101008019090400F2 +:1000400000000000000012011001FF000008C016AF +:10005000DC050401010200010E03550053004200BB +:100060006100730070001C037700770077002E009A +:10007000660069007300630068006C002E00640075 +:1000800065000403090411241FBECFEFD2E0DEBFD8 +:10009000CDBF11E0A0E0B1E0EEE0FEE002C00590CF +:1000A0000D92A230B107D9F711E0A2E0B1E001C092 +:1000B0001D92A834B107E1F797D6A7C6A1CF1F9329 +:1000C000CF93DF9360912801635067FDA2C08091B8 +:1000D0002501CCE0D0E0C81BD109C45DDE4F809182 +:1000E00024018D3209F084C0683009F090C083EC9F +:1000F000809318018AE580930101109202018881A2 +:10010000807619F0CE0179D460C08A8110922101E5 +:100110009981911106C01092220121E231E082E022 +:1001200050C0953019F4809329013DC09630A9F54F +:100130009B81913019F486E490E004C0923041F440 +:1001400084E390E0909327018093260182E121C00F +:100150009330F1F4811108C082E890E09093270178 +:100160008093260184E015C0813041F486E690E05A +:1001700090932701809326018CE10BC0823041F4DB +:1001800088E590E090932701809326018EE001C0DE +:1001900080E090E49093020118C0983079F0993093 +:1001A00031F480932B0121E231E080E00AC081E04C +:1001B0009A3009F080E021E231E003C02BE231E027 +:1001C00081E030932701209326018F3F39F49881F5 +:1001D00097FD8E8190E89093020107C09F81911155 +:1001E00004C09E81981708F4892F809300010FC0E6 +:1001F0008091020187FF0BC0CE0165D58F3F21F4AE +:100200008EE18093010103C08111109200011092D0 +:1002100028018091010184FF56C0809100018F3F29 +:1002200009F451C0182F893008F018E0811B809321 +:1002300000018091180198E8892780931801112303 +:1002400089F18091020187FF08C0612F89E191E067 +:10025000F0D4182F893088F525C0E0912601F0915F +:10026000270186FF0BC029E131E0D90184918D93EC +:100270003196812F820F8A13F9CF10C0DF0149E137 +:1002800051E0EA019D012F5F3F4FF9018C91899365 +:10029000812F840F8C1711F0D901F4CFF09327012F +:1002A000E0932601612F89E191E037D01C5F1C307B +:1002B00041F08FEF8093000104C08FEF8093000125 +:1002C0001EE11093010184E199B19C7031F48150D9 +:1002D000D9F71092290110922301DF91CF911F913C +:1002E0000895E9E6F0E0808183608083E89A0895CC +:1002F000A82FB92F80E090E041E050EA609530E00F +:1003000009C02D9182279795879510F0842795270E +:10031000305EC8F36F5FA8F30895EADF8D939D9375 +:100320000895CF93CFB7CF93C3954B9BE9F74B9BE2 +:1003300009C04B9B07C04B9B05C04B9B03C04B9B0D +:1003400001C0A1C0DF93C0912501DD27C45DDE4F50 +:100350004B9B02C0DF91EBCF2F930F931F9309B1FB +:100360002FEF03FB20F94F933F9319B14FEF012774 +:1003700003FB21F93BE031C04E7F012F19B1216011 +:1003800028C0102F4D7F2260000009B129C04B7F8B +:100390002460012F000019B12BC019B1477F2860DC +:1003A0002AC04F7E09B120612CC04F7D19B1206257 +:1003B0002FC04F7B09B1206432C0422709B1499355 +:1003C0004FEF0000102713FB20F919B11C70C9F181 +:1003D000297F91F2012703FB21F909B1237F89F2DB +:1003E000315058F1102713FB22F919B1277E79F209 +:1003F000012703FB23F92F7C81F209B1102713FB9E +:1004000024F92F7971F200C019B1012703FB25F9F6 +:100410002F7359F200C009B1102713FB26F92230BF +:1004200040F200C019B1012703FB27F9243028F658 +:100430004F77206819B10000F9CF11E01CBB0027ED +:1004400017C03B503195C31BD04011E01CBB088145 +:10045000033CE9F00B34D9F0209123011981110FED +:100460001213EDCF093641F10D3211F0013E39F78B +:1004700000932A013F914F911F910F912F91DF918E +:10048000CCB3C0FD51CFCF91CFBFCF911895209164 +:100490002A01222379F310912801112311F5343018 +:1004A00012F13093280120932401109125013BE0A3 +:1004B000311B3093250117C00091280101308CF4C5 +:1004C0000AE53091010134FD10C000930101C8E13B +:1004D000D1E00FC02795A8F45150A9F4220F0000D5 +:1004E000F9CF4AE503C042ED01C0432FC4E1D0E09B +:1004F00032E01AB11C605B9A1AB90BB120E41CE01F +:100500005F93012756E00BB9279520F4515021F451 +:10051000220FF9CF012756E000003B5A0BB9D0F269 +:10052000279528F4515029F4220F0000F9CF012714 +:1005300056E027950BB920F4515021F4220FF9CF42 +:10054000012756E0299133230BB921F6037F10913F +:100550002901110FC651D0400BB911F0109323019E +:1005600011E01CBB08601AB1137F402F437F5F91DD +:1005700000C000C00BB91AB94BB97CCF8EBD0DB409 +:1005800007FEFDCF8EB5089521E196958795779565 +:1005900067952A95D1F7209146012617D9F06093E7 +:1005A0004601E0914301F09144018DE40995E09109 +:1005B0004301F091440180E00995E0914301F091FD +:1005C0004401809146010995E0914301F091440175 +:1005D00080E009940895809145018CBD809142018D +:1005E0008DBD0895882319F0883040F101C08AE05C +:1005F0002EEB32E0309344012093430110924201EC +:1006000091E090934701893099F018F4883091F087 +:1006100008C08B3021F08C3021F49093420181E5A9 +:100620000AC082E58093450181E0809342010895EC +:1006300082E501C083E580934501089526E433E017 +:100640003093440120934301843081F030F48230B0 +:1006500079F0833079F480E30EC0863061F020F0C9 +:10066000873041F483E007C08CE005C088E103C017 +:1006700080E601C080EC80934701089526B59091F3 +:10068000470186B5821B8917E0F308950F931F93E6 +:10069000CF93DF931F92CDB7DEB708E010E087FF5E +:1006A00002C02B9A01C02B98880F110F1C991F5F55 +:1006B0002D9A8983E3DF2D98E1DF015089810111B3 +:1006C000EECF812F0F90DF91CF911F910F91089561 +:1006D00084B18C6284B92A982D98D0DF2A9ACEDF13 +:1006E0002A9880914301909144018E5B924009F4D5 +:1006F00072DF10924601089584B1837D84B985B17B +:10070000837D85B91CBC0895CF93DF93C1E2C150AE +:1007100051F1E0914301F09144018CEA0995E09197 +:100720004301F091440183E50995E0914301F09183 +:10073000440180E00995D82FE0914301F0914401F4 +:1007400080E00995D33589F01CBC98DF2A9A96DFA2 +:100750002A9894DF80914301909144018E5B9240EE +:10076000B1F639DFD4CF81E001C080E0DF91CF91D5 +:100770000895CF92DF92EF92FF926B017C0104DF2C +:100780008C2D8170880F880F880FE0914301F091C4 +:10079000440180620995D701C60139E0B695A79555 +:1007A000979587953A95D1F7E0914301F0914401EF +:1007B0000995D701C601B695A79597958795E091BC +:1007C0004301F09144010995E0914301F091440106 +:1007D00080E0FF90EF90DF90CF900994CF92DF926E +:1007E000EF92FF920F931F93CF93DF931F92CDB79A +:1007F000DEB76B017C01142F2983C6DE8C2D81703E +:10080000880F880F880FE0914301F09144018064C4 +:100810000995D701C60159E0B695A7959795879593 +:100820005A95D1F7E0914301F09144010995D70120 +:10083000C601B695A79597958795E0914301F091EC +:1008400044010995E0914301F0914401812F0995FC +:100850002981222321F01F3721F48FE0C3D080E0CB +:1008600010C006B51EE1C701B60183DF8F37B9F7A7 +:1008700086B5801B8D3310F006B511501111F3CFE2 +:1008800081E00F90DF91CF911F910F91FF90EF903A +:10089000DF90CF900895CF92DF92EF92FF920F9367 +:1008A0001F93CF93DF931F92CDB7DEB76B017C010F +:1008B00049836ADEE0914301F09144018CE409959B +:1008C000D701C60179E0B695A795979587957A9552 +:1008D000D1F7E0914301F09144010995D701C60198 +:1008E000B695A79597958795E0914301F0914401BE +:1008F0000995E0914301F091440180E00995498117 +:100900004F3F19F48FE06ED011C006B51EE1C7014C +:10091000B6012FDF8F3F51F486B5801B8D3310F069 +:1009200006B511501111F3CF81E001C080E00F90A6 +:10093000DF91CF911F910F91FF90EF90DF90CF90BB +:1009400008951F93CF93DF931F92CDB7DEB7182F73 +:10095000E0914301F091440180EA99830995E09187 +:100960004301F09144019981892F0995E091430158 +:10097000F0914401812F0995E0914301F0914401E8 +:1009800080E00F90DF91CF911F9109941F93CF9337 +:10099000DF9300D0CDB7DEB7182FE0914301F0917F +:1009A000440180EC6A8399830995E0914301F091B9 +:1009B00044019981892F0995E0914301F091440107 +:1009C000812F0995E0914301F09144016A81862FBE +:1009D00009958EE107D080E00F900F90DF91CF91C5 +:1009E0001F91089590E0981739F036B526B5231B6E +:1009F0002C33E0F39F5FF7CF0895CF93DF93EC01A3 +:100A00008981813041F480910E01ECDD10920D015D +:100A10005D985EDE04C1823019F46EDE5D9AFFC01F +:100A2000833009F5E0914301F09144018A810995F1 +:100A300080931001E0914301F09144018B8109956D +:100A400080931101E0914301F09144018C8109955B +:100A500080931201E0914301F09144018D81099549 +:100A600080931301DAC0843011F580910D0181115A +:100A700012C08B8190E0982F88272A81822BAA2789 +:100A800097FDA095BA2F8093090190930A01A09336 +:100A90000B01B0930C018F8190E0982F88272E8155 +:100AA000822B909308018093070182E08CC08730ED +:100AB00011F580910D01811112C08B8190E0982F6A +:100AC00088272A81822BAA2797FDA095BA2F809389 +:100AD000090190930A01A0930B01B0930C018F813F +:100AE00090E0982F88272E81822B90930801809385 +:100AF000070183E068C0853021F406DE8093100191 +:100B00007FC08630B9F580910D01811112C04B81F3 +:100B100050E0542F44278A81482B662757FD609563 +:100B2000762F4093090150930A0160930B01709353 +:100B30000C013C812D81822F8F7080930401822FC4 +:100B4000807F40E1849FC0011124830F911D909309 +:100B500006018093050120FD809303018F8190E0C1 +:100B6000982F88272E81822B90930801809307016C +:100B700081E029C0883059F580910D01811112C0A2 +:100B80004B8150E0542F44278A81482B662757FD1C +:100B90006095762F4093090150930A0160930B01F1 +:100BA00070930C011092060110920501109204013D +:100BB0008F8190E0982F88272E81822B90930801B7 +:100BC0008093070184E080930F018FEF29C0893063 +:100BD00081F481E080930D018A819B81AC81BD818C +:100BE0008093090190930A01A0930B01B0930C012B +:100BF00016C08A3039F48A8180930E011092100158 +:100C000081E00EC08F3759F481E08093100110927B +:100C10001101109212011092130184E001C080E0D2 +:100C200020E131E03093270120932601DF91CF911D +:100C300008950F931F93CF93DF93162F20910F01E9 +:100C40003EEF320F323010F02530A9F5082FEC01BD +:100C50008C2F801B811750F580910F01823051F449 +:100C60006091090170910A0180910B0190910C0132 +:100C700080DD05C08091090190910A0162DE8883C0 +:100C80004091090150910A0160910B0170910C0192 +:100C90004F5F5F4F6F4F7F4F4093090150930A01A1 +:100CA00060930B0170930C012196D2CF183028F479 +:100CB00010920F0102C08FEF01C0812FDF91CF9101 +:100CC0001F910F910895FF920F931F93CF93DF937E +:100CD000F62E20910F01213021F4082FEC0110E0B5 +:100CE0003BC02D7F2430C9F38FEF78C080910F0176 +:100CF000813009F04FC020910501309106016091CB +:100D0000090170910A0180910B0190910C01232B34 +:100D100041F521E0488162DD809107019091080151 +:100D200001979093080180930701892BD1F140919D +:100D3000090150910A0160910B0170910C014F5F04 +:100D40005F4F6F4F7F4F4093090150930A016093AB +:100D50000B0170930C0121968C2F801B8F1530F2A4 +:100D60003CC020E048813ADD8091030181508093AE +:100D700003018111D1CF6091090170910A01809125 +:100D80000B0190910C01488186DD809105018093D3 +:100D90000301C2CF68818091090190910A01F6DDBB +:100DA000BBCF10920F018091040181FF14C02091EC +:100DB000030130E080910501909106012817390761 +:100DC00051F06091090170910A0180910B0190919D +:100DD0000C01488160DD11E0AACF812FDF91CF9116 +:100DE0001F910F91FF90089580E48BB915B888E6A4 +:100DF0008AB980E68AB917B818B883E085BD71DA78 +:0E0E000078945D9A5CD95D98FCCFF894FFCF92 +:020E0E00FF5A89 +:00000001FF diff --git a/firmware/usbdrv/Changelog.txt b/firmware/usbdrv/Changelog.txt index 5c6354a..5fae8f3 100644 --- a/firmware/usbdrv/Changelog.txt +++ b/firmware/usbdrv/Changelog.txt @@ -306,3 +306,13 @@ Scroll down to the bottom to see the most recent changes. endpoint now. * Release 2010-07-15 + + - Fixed bug in usbDriverSetup() which prevented descriptor sizes above 255 + bytes. + - Avoid a compiler warning for unused parameter in usbHandleResetHook() when + compiler option -Wextra is enabled. + - Fixed wrong hex value for some IDs in USB-IDs-for-free.txt. + - Keep a define for USBATTR_BUSPOWER, although the flag does not exist + in USB 1.1 any more. Set it to 0. This is for backward compatibility. + +* Release 2012-01-09 diff --git a/firmware/usbdrv/USB-IDs-for-free.txt b/firmware/usbdrv/USB-IDs-for-free.txt index 2f4d59a..d46517d 100644 --- a/firmware/usbdrv/USB-IDs-for-free.txt +++ b/firmware/usbdrv/USB-IDs-for-free.txt @@ -86,8 +86,9 @@ If you use one of the IDs listed below, your device and host-side software must conform to these rules: (1) The USB device MUST provide a textual representation of the serial -number. The serial number string MUST be available at least in USB language -0x0409 (English/US). +number, unless ONLY the operating system's default class driver is used. +The serial number string MUST be available at least in USB language 0x0409 +(English/US). (2) The serial number MUST start with either an Internet domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail address under your @@ -108,6 +109,11 @@ driver for Vendor Class devices is needed, this driver must be libusb or libusb-win32 (see http://libusb.org/ and http://libusb-win32.sourceforge.net/). +(7) If ONLY the operating system's default class driver is used, e.g. for +mice, keyboards, joysticks, CDC or MIDI devices and no discrimination by an +application is needed, the serial number may be omitted. + + Table if IDs for discrimination by serial number string: PID dec (hex) | VID dec (hex) | Description of use @@ -121,11 +127,11 @@ PID dec (hex) | VID dec (hex) | Description of use ---------------+---------------+------------------------------------------- 10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards ---------------+---------------+------------------------------------------- -10204 (0x27db) | 5824 (0x16c0) | For USB Joysticks +10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks ---------------+---------------+------------------------------------------- -10205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems) +10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems) ---------------+---------------+------------------------------------------- -10206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices +10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices ---------------+---------------+------------------------------------------- diff --git a/firmware/usbdrv/oddebug.c b/firmware/usbdrv/oddebug.c index 945457c..466e68f 100644 --- a/firmware/usbdrv/oddebug.c +++ b/firmware/usbdrv/oddebug.c @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $ + * This Revision: $Id$ */ #include "oddebug.h" diff --git a/firmware/usbdrv/oddebug.h b/firmware/usbdrv/oddebug.h index d61309d..c56af1c 100644 --- a/firmware/usbdrv/oddebug.h +++ b/firmware/usbdrv/oddebug.h @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $ + * This Revision: $Id$ */ #ifndef __oddebug_h_included__ diff --git a/firmware/usbdrv/usbconfig-prototype.h b/firmware/usbdrv/usbconfig-prototype.h index 847710e..826f026 100644 --- a/firmware/usbdrv/usbconfig-prototype.h +++ b/firmware/usbdrv/usbconfig-prototype.h @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ + * This Revision: $Id$ */ #ifndef __usbconfig_h_included__ diff --git a/firmware/usbdrv/usbdrv.c b/firmware/usbdrv/usbdrv.c index 21ed554..5594407 100644 --- a/firmware/usbdrv/usbdrv.c +++ b/firmware/usbdrv/usbdrv.c @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.c 791 2010-07-15 15:56:13Z cs $ + * This Revision: $Id$ */ #include "usbportability.h" @@ -67,7 +67,7 @@ optimizing hints: #if USB_CFG_DESCR_PROPS_STRING_0 == 0 #undef USB_CFG_DESCR_PROPS_STRING_0 #define USB_CFG_DESCR_PROPS_STRING_0 sizeof(usbDescriptorString0) -PROGMEM char usbDescriptorString0[] = { /* language descriptor */ +PROGMEM const char usbDescriptorString0[] = { /* language descriptor */ 4, /* sizeof(usbDescriptorString0): length of descriptor in bytes */ 3, /* descriptor type */ 0x09, 0x04, /* language index (0x0409 = US-English) */ @@ -77,7 +77,7 @@ PROGMEM char usbDescriptorString0[] = { /* language descriptor */ #if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN #undef USB_CFG_DESCR_PROPS_STRING_VENDOR #define USB_CFG_DESCR_PROPS_STRING_VENDOR sizeof(usbDescriptorStringVendor) -PROGMEM int usbDescriptorStringVendor[] = { +PROGMEM const int usbDescriptorStringVendor[] = { USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN), USB_CFG_VENDOR_NAME }; @@ -86,7 +86,7 @@ PROGMEM int usbDescriptorStringVendor[] = { #if USB_CFG_DESCR_PROPS_STRING_PRODUCT == 0 && USB_CFG_DEVICE_NAME_LEN #undef USB_CFG_DESCR_PROPS_STRING_PRODUCT #define USB_CFG_DESCR_PROPS_STRING_PRODUCT sizeof(usbDescriptorStringDevice) -PROGMEM int usbDescriptorStringDevice[] = { +PROGMEM const int usbDescriptorStringDevice[] = { USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN), USB_CFG_DEVICE_NAME }; @@ -95,7 +95,7 @@ PROGMEM int usbDescriptorStringDevice[] = { #if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN #undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber) -PROGMEM int usbDescriptorStringSerialNumber[] = { +PROGMEM const int usbDescriptorStringSerialNumber[] = { USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN), USB_CFG_SERIAL_NUMBER }; @@ -108,7 +108,7 @@ PROGMEM int usbDescriptorStringSerialNumber[] = { #if USB_CFG_DESCR_PROPS_DEVICE == 0 #undef USB_CFG_DESCR_PROPS_DEVICE #define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice) -PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */ +PROGMEM const char usbDescriptorDevice[] = { /* USB device descriptor */ 18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */ USBDESCR_DEVICE, /* descriptor type */ 0x10, 0x01, /* USB version supported */ @@ -139,7 +139,7 @@ PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */ #if USB_CFG_DESCR_PROPS_CONFIGURATION == 0 #undef USB_CFG_DESCR_PROPS_CONFIGURATION #define USB_CFG_DESCR_PROPS_CONFIGURATION sizeof(usbDescriptorConfiguration) -PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ +PROGMEM const char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ USBDESCR_CONFIG, /* descriptor type */ 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + @@ -361,7 +361,8 @@ uchar flags = USB_FLG_MSGPTR_IS_ROM; */ static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq) { -uchar len = 0, *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */ +usbMsgLen_t len = 0; +uchar *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */ uchar value = rq->wValue.bytes[0]; #if USB_CFG_IMPLEMENT_HALT uchar index = rq->wIndex.bytes[0]; @@ -557,6 +558,8 @@ uchar isReset = !notResetState; USB_RESET_HOOK(isReset); wasReset = isReset; } +#else + notResetState = notResetState; // avoid compiler warning #endif } diff --git a/firmware/usbdrv/usbdrv.h b/firmware/usbdrv/usbdrv.h index 3a78f30..9bee353 100644 --- a/firmware/usbdrv/usbdrv.h +++ b/firmware/usbdrv/usbdrv.h @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrv.h 793 2010-07-15 15:58:11Z cs $ + * This Revision: $Id$ */ #ifndef __usbdrv_h_included__ @@ -122,7 +122,7 @@ USB messages, even if they address another (low-speed) device on the same bus. /* --------------------------- Module Interface ---------------------------- */ /* ------------------------------------------------------------------------- */ -#define USBDRV_VERSION 20100715 +#define USBDRV_VERSION 20120109 /* This define uniquely identifies a driver version. It is a decimal number * constructed from the driver's release date in the form YYYYMMDD. If the * driver's behavior or interface changes, you can use this constant to @@ -237,7 +237,7 @@ USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); #endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ #if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ #define usbHidReportDescriptor usbDescriptorHidReport -/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ +/* should be declared as: PROGMEM const char usbHidReportDescriptor[]; */ /* If you implement an HID device, you need to provide a report descriptor. * The HID report descriptor syntax is a bit complex. If you understand how * report descriptors are constructed, we recommend that you use the HID @@ -450,43 +450,43 @@ extern volatile schar usbRxLen; #ifndef __ASSEMBLER__ extern #if !(USB_CFG_DESCR_PROPS_DEVICE & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif char usbDescriptorDevice[]; extern #if !(USB_CFG_DESCR_PROPS_CONFIGURATION & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif char usbDescriptorConfiguration[]; extern #if !(USB_CFG_DESCR_PROPS_HID_REPORT & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif char usbDescriptorHidReport[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_0 & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif char usbDescriptorString0[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_VENDOR & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif int usbDescriptorStringVendor[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_PRODUCT & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif int usbDescriptorStringDevice[]; extern #if !(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER & USB_PROP_IS_RAM) -PROGMEM +PROGMEM const #endif int usbDescriptorStringSerialNumber[]; @@ -719,6 +719,7 @@ typedef struct usbRequest{ #define USBDESCR_HID_PHYS 0x23 //#define USBATTR_BUSPOWER 0x80 // USB 1.1 does not define this value any more +#define USBATTR_BUSPOWER 0 #define USBATTR_SELFPOWER 0x40 #define USBATTR_REMOTEWAKE 0x20 diff --git a/firmware/usbdrv/usbdrv.h~ b/firmware/usbdrv/usbdrv.h~ new file mode 100644 index 0000000..bb85263 --- /dev/null +++ b/firmware/usbdrv/usbdrv.h~ @@ -0,0 +1,735 @@ +/* Name: usbdrv.h + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2004-12-29 + * Tabsize: 4 + * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id: usbdrv.h 793 2010-07-15 15:58:11Z cs $ + */ + +#ifndef __usbdrv_h_included__ +#define __usbdrv_h_included__ +#include "usbconfig.h" +#include "usbportability.h" + +/* +Hardware Prerequisites: +======================= +USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+ +triggers the interrupt (best achieved by using INT0 for D+), but it is also +possible to trigger the interrupt from D-. If D- is used, interrupts are also +triggered by SOF packets. D- requires a pull-up of 1.5k to +3.5V (and the +device must be powered at 3.5V) to identify as low-speed USB device. A +pull-down or pull-up of 1M SHOULD be connected from D+ to +3.5V to prevent +interference when no USB master is connected. If you use Zener diodes to limit +the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up. +We use D+ as interrupt source and not D- because it does not trigger on +keep-alive and RESET states. If you want to count keep-alive events with +USB_COUNT_SOF, you MUST use D- as an interrupt source. + +As a compile time option, the 1.5k pull-up resistor on D- can be made +switchable to allow the device to disconnect at will. See the definition of +usbDeviceConnect() and usbDeviceDisconnect() further down in this file. + +Please adapt the values in usbconfig.h according to your hardware! + +The device MUST be clocked at exactly 12 MHz, 15 MHz, 16 MHz or 20 MHz +or at 12.8 MHz resp. 16.5 MHz +/- 1%. See usbconfig-prototype.h for details. + + +Limitations: +============ +Robustness with respect to communication errors: +The driver assumes error-free communication. It DOES check for errors in +the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte, +token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due +to timing constraints: We must start sending a reply within 7 bit times. +Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU +performance does not permit that. The driver does not check Data0/Data1 +toggling, but application software can implement the check. + +Input characteristics: +Since no differential receiver circuit is used, electrical interference +robustness may suffer. The driver samples only one of the data lines with +an ordinary I/O pin's input characteristics. However, since this is only a +low speed USB implementation and the specification allows for 8 times the +bit rate over the same hardware, we should be on the safe side. Even the spec +requires detection of asymmetric states at high bit rate for SE0 detection. + +Number of endpoints: +The driver supports the following endpoints: + +- Endpoint 0, the default control endpoint. +- Any number of interrupt- or bulk-out endpoints. The data is sent to + usbFunctionWriteOut() and USB_CFG_IMPLEMENT_FN_WRITEOUT must be defined + to 1 to activate this feature. The endpoint number can be found in the + global variable 'usbRxToken'. +- One default interrupt- or bulk-in endpoint. This endpoint is used for + interrupt- or bulk-in transfers which are not handled by any other endpoint. + You must define USB_CFG_HAVE_INTRIN_ENDPOINT in order to activate this + feature and call usbSetInterrupt() to send interrupt/bulk data. +- One additional interrupt- or bulk-in endpoint. This was endpoint 3 in + previous versions of this driver but can now be configured to any endpoint + number. You must define USB_CFG_HAVE_INTRIN_ENDPOINT3 in order to activate + this feature and call usbSetInterrupt3() to send interrupt/bulk data. The + endpoint number can be set with USB_CFG_EP3_NUMBER. + +Please note that the USB standard forbids bulk endpoints for low speed devices! +Most operating systems allow them anyway, but the AVR will spend 90% of the CPU +time in the USB interrupt polling for bulk data. + +Maximum data payload: +Data payload of control in and out transfers may be up to 254 bytes. In order +to accept payload data of out transfers, you need to implement +'usbFunctionWrite()'. + +USB Suspend Mode supply current: +The USB standard limits power consumption to 500uA when the bus is in suspend +mode. This is not a problem for self-powered devices since they don't need +bus power anyway. Bus-powered devices can achieve this only by putting the +CPU in sleep mode. The driver does not implement suspend handling by itself. +However, the application may implement activity monitoring and wakeup from +sleep. The host sends regular SE0 states on the bus to keep it active. These +SE0 states can be detected by using D- as the interrupt source. Define +USB_COUNT_SOF to 1 and use the global variable usbSofCount to check for bus +activity. + +Operation without an USB master: +The driver behaves neutral without connection to an USB master if D- reads +as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M) +pull-down or pull-up resistor on D+ (interrupt). If Zener diodes are used, +use a pull-down. If D- becomes statically 0, the driver may block in the +interrupt routine. + +Interrupt latency: +The application must ensure that the USB interrupt is not disabled for more +than 25 cycles (this is for 12 MHz, faster clocks allow longer latency). +This implies that all interrupt routines must either have the "ISR_NOBLOCK" +attribute set (see "avr/interrupt.h") or be written in assembler with "sei" +as the first instruction. + +Maximum interrupt duration / CPU cycle consumption: +The driver handles all USB communication during the interrupt service +routine. The routine will not return before an entire USB message is received +and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if +the host conforms to the standard. The driver will consume CPU cycles for all +USB messages, even if they address another (low-speed) device on the same bus. + +*/ + +/* ------------------------------------------------------------------------- */ +/* --------------------------- Module Interface ---------------------------- */ +/* ------------------------------------------------------------------------- */ + +#define USBDRV_VERSION 20100715 +/* This define uniquely identifies a driver version. It is a decimal number + * constructed from the driver's release date in the form YYYYMMDD. If the + * driver's behavior or interface changes, you can use this constant to + * distinguish versions. If it is not defined, the driver's release date is + * older than 2006-01-25. + */ + + +#ifndef USB_PUBLIC +#define USB_PUBLIC +#endif +/* USB_PUBLIC is used as declaration attribute for all functions exported by + * the USB driver. The default is no attribute (see above). You may define it + * to static either in usbconfig.h or from the command line if you include + * usbdrv.c instead of linking against it. Including the C module of the driver + * directly in your code saves a couple of bytes in flash memory. + */ + +#ifndef __ASSEMBLER__ +#ifndef uchar +#define uchar unsigned char +#endif +#ifndef schar +#define schar signed char +#endif +/* shortcuts for well defined 8 bit integer types */ + +#if USB_CFG_LONG_TRANSFERS /* if more than 254 bytes transfer size required */ +# define usbMsgLen_t unsigned +#else +# define usbMsgLen_t uchar +#endif +/* usbMsgLen_t is the data type used for transfer lengths. By default, it is + * defined to uchar, allowing a maximum of 254 bytes (255 is reserved for + * USB_NO_MSG below). If the usbconfig.h defines USB_CFG_LONG_TRANSFERS to 1, + * a 16 bit data type is used, allowing up to 16384 bytes (the rest is used + * for flags in the descriptor configuration). + */ +#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */ + +struct usbRequest; /* forward declaration */ + +USB_PUBLIC void usbInit(void); +/* This function must be called before interrupts are enabled and the main + * loop is entered. We exepct that the PORT and DDR bits for D+ and D- have + * not been changed from their default status (which is 0). If you have changed + * them, set both back to 0 (configure them as input with no internal pull-up). + */ +USB_PUBLIC void usbPoll(void); +/* This function must be called at regular intervals from the main loop. + * Maximum delay between calls is somewhat less than 50ms (USB timeout for + * accepting a Setup message). Otherwise the device will not be recognized. + * Please note that debug outputs through the UART take ~ 0.5ms per byte + * at 19200 bps. + */ +extern uchar *usbMsgPtr; +/* This variable may be used to pass transmit data to the driver from the + * implementation of usbFunctionWrite(). It is also used internally by the + * driver for standard control requests. + */ +USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]); +/* This function is called when the driver receives a SETUP transaction from + * the host which is not answered by the driver itself (in practice: class and + * vendor requests). All control transfers start with a SETUP transaction where + * the host communicates the parameters of the following (optional) data + * transfer. The SETUP data is available in the 'data' parameter which can + * (and should) be casted to 'usbRequest_t *' for a more user-friendly access + * to parameters. + * + * If the SETUP indicates a control-in transfer, you should provide the + * requested data to the driver. There are two ways to transfer this data: + * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data + * block and return the length of the data in 'usbFunctionSetup()'. The driver + * will handle the rest. Or (2) return USB_NO_MSG in 'usbFunctionSetup()'. The + * driver will then call 'usbFunctionRead()' when data is needed. See the + * documentation for usbFunctionRead() for details. + * + * If the SETUP indicates a control-out transfer, the only way to receive the + * data from the host is through the 'usbFunctionWrite()' call. If you + * implement this function, you must return USB_NO_MSG in 'usbFunctionSetup()' + * to indicate that 'usbFunctionWrite()' should be used. See the documentation + * of this function for more information. If you just want to ignore the data + * sent by the host, return 0 in 'usbFunctionSetup()'. + * + * Note that calls to the functions usbFunctionRead() and usbFunctionWrite() + * are only done if enabled by the configuration in usbconfig.h. + */ +USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq); +/* You need to implement this function ONLY if you provide USB descriptors at + * runtime (which is an expert feature). It is very similar to + * usbFunctionSetup() above, but it is called only to request USB descriptor + * data. See the documentation of usbFunctionSetup() above for more info. + */ +#if USB_CFG_HAVE_INTRIN_ENDPOINT +USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len); +/* This function sets the message which will be sent during the next interrupt + * IN transfer. The message is copied to an internal buffer and must not exceed + * a length of 8 bytes. The message may be 0 bytes long just to indicate the + * interrupt status to the host. + * If you need to transfer more bytes, use a control read after the interrupt. + */ +#define usbInterruptIsReady() (usbTxLen1 & 0x10) +/* This macro indicates whether the last interrupt message has already been + * sent. If you set a new interrupt message before the old was sent, the + * message already buffered will be lost. + */ +#if USB_CFG_HAVE_INTRIN_ENDPOINT3 +USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); +#define usbInterruptIsReady3() (usbTxLen3 & 0x10) +/* Same as above for endpoint 3 */ +#endif +#endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ +#if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ +#define usbHidReportDescriptor usbDescriptorHidReport +/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ +/* If you implement an HID device, you need to provide a report descriptor. + * The HID report descriptor syntax is a bit complex. If you understand how + * report descriptors are constructed, we recommend that you use the HID + * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/. + * Otherwise you should probably start with a working example. + */ +#endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */ +#if USB_CFG_IMPLEMENT_FN_WRITE +USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len); +/* This function is called by the driver to provide a control transfer's + * payload data (control-out). It is called in chunks of up to 8 bytes. The + * total count provided in the current control transfer can be obtained from + * the 'length' property in the setup data. If an error occurred during + * processing, return 0xff (== -1). The driver will answer the entire transfer + * with a STALL token in this case. If you have received the entire payload + * successfully, return 1. If you expect more data, return 0. If you don't + * know whether the host will send more data (you should know, the total is + * provided in the usbFunctionSetup() call!), return 1. + * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called + * for the remaining data. You must continue to return 0xff for STALL in these + * calls. + * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE + * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. + */ +#endif /* USB_CFG_IMPLEMENT_FN_WRITE */ +#if USB_CFG_IMPLEMENT_FN_READ +USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len); +/* This function is called by the driver to ask the application for a control + * transfer's payload data (control-in). It is called in chunks of up to 8 + * bytes each. You should copy the data to the location given by 'data' and + * return the actual number of bytes copied. If you return less than requested, + * the control-in transfer is terminated. If you return 0xff, the driver aborts + * the transfer with a STALL token. + * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ + * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. + */ +#endif /* USB_CFG_IMPLEMENT_FN_READ */ + +extern uchar usbRxToken; /* may be used in usbFunctionWriteOut() below */ +#if USB_CFG_IMPLEMENT_FN_WRITEOUT +USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len); +/* This function is called by the driver when data is received on an interrupt- + * or bulk-out endpoint. The endpoint number can be found in the global + * variable usbRxToken. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 in + * usbconfig.h to get this function called. + */ +#endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */ +#ifdef USB_CFG_PULLUP_IOPORTNAME +#define usbDeviceConnect() ((USB_PULLUP_DDR |= (1<device, 1=device->host + * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved + * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other + */ + +/* USB setup recipient values */ +#define USBRQ_RCPT_MASK 0x1f +#define USBRQ_RCPT_DEVICE 0 +#define USBRQ_RCPT_INTERFACE 1 +#define USBRQ_RCPT_ENDPOINT 2 + +/* USB request type values */ +#define USBRQ_TYPE_MASK 0x60 +#define USBRQ_TYPE_STANDARD (0<<5) +#define USBRQ_TYPE_CLASS (1<<5) +#define USBRQ_TYPE_VENDOR (2<<5) + +/* USB direction values: */ +#define USBRQ_DIR_MASK 0x80 +#define USBRQ_DIR_HOST_TO_DEVICE (0<<7) +#define USBRQ_DIR_DEVICE_TO_HOST (1<<7) + +/* USB Standard Requests */ +#define USBRQ_GET_STATUS 0 +#define USBRQ_CLEAR_FEATURE 1 +#define USBRQ_SET_FEATURE 3 +#define USBRQ_SET_ADDRESS 5 +#define USBRQ_GET_DESCRIPTOR 6 +#define USBRQ_SET_DESCRIPTOR 7 +#define USBRQ_GET_CONFIGURATION 8 +#define USBRQ_SET_CONFIGURATION 9 +#define USBRQ_GET_INTERFACE 10 +#define USBRQ_SET_INTERFACE 11 +#define USBRQ_SYNCH_FRAME 12 + +/* USB descriptor constants */ +#define USBDESCR_DEVICE 1 +#define USBDESCR_CONFIG 2 +#define USBDESCR_STRING 3 +#define USBDESCR_INTERFACE 4 +#define USBDESCR_ENDPOINT 5 +#define USBDESCR_HID 0x21 +#define USBDESCR_HID_REPORT 0x22 +#define USBDESCR_HID_PHYS 0x23 + +//#define USBATTR_BUSPOWER 0x80 // USB 1.1 does not define this value any more +#define USBATTR_SELFPOWER 0x40 +#define USBATTR_REMOTEWAKE 0x20 + +/* USB HID Requests */ +#define USBRQ_HID_GET_REPORT 0x01 +#define USBRQ_HID_GET_IDLE 0x02 +#define USBRQ_HID_GET_PROTOCOL 0x03 +#define USBRQ_HID_SET_REPORT 0x09 +#define USBRQ_HID_SET_IDLE 0x0a +#define USBRQ_HID_SET_PROTOCOL 0x0b + +/* ------------------------------------------------------------------------- */ + +#endif /* __usbdrv_h_included__ */ diff --git a/firmware/usbdrv/usbdrvasm.S b/firmware/usbdrv/usbdrvasm.S index 45fcf18..4e6158c 100644 --- a/firmware/usbdrv/usbdrvasm.S +++ b/firmware/usbdrv/usbdrvasm.S @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm.S 785 2010-05-30 17:57:07Z cs $ + * Revision: $Id$ */ /* diff --git a/firmware/usbdrv/usbdrvasm12.inc b/firmware/usbdrv/usbdrvasm12.inc index c116758..cb74ceb 100644 --- a/firmware/usbdrv/usbdrvasm12.inc +++ b/firmware/usbdrv/usbdrvasm12.inc @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrvasm12.inc 740 2009-04-13 18:23:31Z cs $ + * This Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbdrvasm128.inc b/firmware/usbdrv/usbdrvasm128.inc index bcd6621..122cc75 100644 --- a/firmware/usbdrv/usbdrvasm128.inc +++ b/firmware/usbdrv/usbdrvasm128.inc @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbdrvasm128.inc 758 2009-08-06 10:12:54Z cs $ + * This Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbdrvasm15.inc b/firmware/usbdrv/usbdrvasm15.inc index 401b7f8..ce10391 100644 --- a/firmware/usbdrv/usbdrvasm15.inc +++ b/firmware/usbdrv/usbdrvasm15.inc @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm15.inc 740 2009-04-13 18:23:31Z cs $ + * Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbdrvasm16.inc b/firmware/usbdrv/usbdrvasm16.inc index 207b6e4..4c00faa 100644 --- a/firmware/usbdrv/usbdrvasm16.inc +++ b/firmware/usbdrv/usbdrvasm16.inc @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm16.inc 760 2009-08-09 18:59:43Z cs $ + * Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbdrvasm165.inc b/firmware/usbdrv/usbdrvasm165.inc index 79b3c61..d8a95ba 100644 --- a/firmware/usbdrv/usbdrvasm165.inc +++ b/firmware/usbdrv/usbdrvasm165.inc @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm165.inc 740 2009-04-13 18:23:31Z cs $ + * Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbdrvasm18-crc.inc b/firmware/usbdrv/usbdrvasm18-crc.inc index f83347d..dde09da 100644 --- a/firmware/usbdrv/usbdrvasm18-crc.inc +++ b/firmware/usbdrv/usbdrvasm18-crc.inc @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2008 by Lukas Schrittwieser and OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm18-crc.inc 740 2009-04-13 18:23:31Z cs $ + * Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbdrvasm20.inc b/firmware/usbdrv/usbdrvasm20.inc index 303abaf..0c74679 100644 --- a/firmware/usbdrv/usbdrvasm20.inc +++ b/firmware/usbdrv/usbdrvasm20.inc @@ -6,7 +6,7 @@ * Tabsize: 4 * Copyright: (c) 2008 by Jeroen Benschop and OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * Revision: $Id: usbdrvasm20.inc 740 2009-04-13 18:23:31Z cs $ + * Revision: $Id$ */ /* Do not link this file! Link usbdrvasm.S instead, which includes the diff --git a/firmware/usbdrv/usbportability.h b/firmware/usbdrv/usbportability.h index 476184d..a1ea93b 100644 --- a/firmware/usbdrv/usbportability.h +++ b/firmware/usbdrv/usbportability.h @@ -5,7 +5,7 @@ * Tabsize: 4 * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id: usbportability.h 785 2010-05-30 17:57:07Z cs $ + * This Revision: $Id$ */ /*