From 6746e37088ce8ba03529c1226bd216705edb2b1f Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 10 Apr 2015 01:25:48 +0900 Subject: Remove core library and build files --- protocol/adb.c | 456 ----- protocol/adb.h | 62 - protocol/bluefruit.mk | 27 - protocol/bluefruit/bluefruit.c | 202 --- protocol/bluefruit/bluefruit.h | 28 - protocol/bluefruit/main.c | 116 -- protocol/ibm4704.c | 169 -- protocol/ibm4704.h | 110 -- protocol/iwrap.mk | 26 - protocol/iwrap/iWRAP4.txt | 376 ---- protocol/iwrap/iWRAP5.txt | 356 ---- protocol/iwrap/iwrap.c | 469 ----- protocol/iwrap/iwrap.h | 49 - protocol/iwrap/main.c | 376 ---- protocol/iwrap/mux_exit.rb | 7 - protocol/iwrap/suart.S | 156 -- protocol/iwrap/suart.h | 8 - protocol/iwrap/wd.h | 159 -- protocol/lufa.mk | 50 - .../Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c | 61 - .../LUFA/Build/HID_EEPROM_Loader/makefile | 40 - .../lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk | 101 -- .../lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk | 84 - protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk | 296 ---- protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk | 152 -- .../lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk | 104 -- protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk | 93 - .../lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk | 81 - protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk | 88 - .../lufa/LUFA-120730/LUFA/Build/lufa_sources.mk | 116 -- .../LUFA/CodeTemplates/DriverStubs/Buttons.h | 90 - .../LUFA/CodeTemplates/DriverStubs/Dataflash.h | 220 --- .../LUFA/CodeTemplates/DriverStubs/Joystick.h | 102 -- .../LUFA/CodeTemplates/DriverStubs/LEDs.h | 130 -- .../LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h | 167 -- .../LUFA/CodeTemplates/makefile_template | 36 - .../LUFA-120730/LUFA/Common/ArchitectureSpecific.h | 177 -- .../lufa/LUFA-120730/LUFA/Common/Architectures.h | 84 - protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h | 150 -- protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h | 231 --- protocol/lufa/LUFA-120730/LUFA/Common/Common.h | 381 ----- .../LUFA-120730/LUFA/Common/CompilerSpecific.h | 97 -- protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h | 489 ------ protocol/lufa/LUFA-120730/LUFA/Doxygen.conf | 1809 -------------------- .../LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt | 846 --------- .../DoxygenPages/BuildingLinkableLibraries.txt | 23 - .../LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt | 1444 ---------------- .../LUFA/DoxygenPages/CompileTimeTokens.txt | 223 --- .../LUFA/DoxygenPages/CompilingApps.txt | 50 - .../LUFA/DoxygenPages/ConfiguringApps.txt | 104 -- .../LUFA/DoxygenPages/DevelopingWithLUFA.txt | 23 - .../LUFA/DoxygenPages/DeviceSupport.txt | 432 ----- .../LUFA/DoxygenPages/DirectorySummaries.txt | 80 - .../LUFA-120730/LUFA/DoxygenPages/Donating.txt | 24 - .../LUFA/DoxygenPages/ExportingLibrary.txt | 106 -- .../LUFA/DoxygenPages/FutureChanges.txt | 49 - .../LUFA/DoxygenPages/GettingStarted.txt | 25 - .../lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt | 38 - .../Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png | Bin 98201 -> 0 bytes .../Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png | Bin 100532 -> 0 bytes .../Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png | Bin 32987 -> 0 bytes .../Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png | Bin 161824 -> 0 bytes .../AS5_AS6_Import/AS5_AS6_Import_Step5_1.png | Bin 43666 -> 0 bytes .../AS5_AS6_Import/AS5_AS6_Import_Step5_2.png | Bin 28918 -> 0 bytes .../AS5_AS6_Import/AS5_AS6_Import_Step5_3.png | Bin 23561 -> 0 bytes .../LUFA/DoxygenPages/Images/Author.jpg | Bin 28410 -> 0 bytes .../LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png | Bin 10296 -> 0 bytes .../LUFA/DoxygenPages/Images/LUFA_thumb.png | Bin 3729 -> 0 bytes .../LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt | 44 - .../LUFA/DoxygenPages/LUFAPoweredProjects.txt | 181 -- .../LUFA/DoxygenPages/LibraryResources.txt | 34 - .../LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt | 22 - .../LUFA-120730/LUFA/DoxygenPages/MainPage.txt | 52 - .../LUFA/DoxygenPages/MigrationInformation.txt | 674 -------- .../LUFA/DoxygenPages/ProgrammingApps.txt | 30 - .../LUFA/DoxygenPages/SoftwareBootloaderJump.txt | 71 - .../LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm | 35 - .../LUFA-120730/LUFA/DoxygenPages/Style/Style.css | 1123 ------------ .../LUFA/DoxygenPages/VIDAndPIDValues.txt | 424 ----- .../LUFA/DoxygenPages/WritingBoardDrivers.txt | 27 - .../LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h | 139 -- .../LUFA/Drivers/Board/AVR8/BENITO/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/BENITO/LEDs.h | 139 -- .../LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h | 161 -- .../LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h | 139 -- .../LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h | 143 -- .../LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h | 105 -- .../LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h | 123 -- .../LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h | 149 -- .../LUFA/Drivers/Board/AVR8/CULV3/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/CULV3/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/DUCE/LEDs.h | 147 -- .../LUFA/Drivers/Board/AVR8/EVK527/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h | 220 --- .../LUFA/Drivers/Board/AVR8/EVK527/Joystick.h | 130 -- .../LUFA/Drivers/Board/AVR8/EVK527/LEDs.h | 143 -- .../LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h | 139 -- .../LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h | 208 --- .../LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h | 177 -- .../LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h | 143 -- .../LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h | 161 -- .../LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h | 179 -- .../LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h | 143 -- .../LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h | 169 -- .../LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h | 175 -- .../LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/STK525/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/STK525/Dataflash.h | 220 --- .../LUFA/Drivers/Board/AVR8/STK525/Joystick.h | 130 -- .../LUFA/Drivers/Board/AVR8/STK525/LEDs.h | 147 -- .../LUFA/Drivers/Board/AVR8/STK526/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/STK526/Dataflash.h | 220 --- .../LUFA/Drivers/Board/AVR8/STK526/Joystick.h | 123 -- .../LUFA/Drivers/Board/AVR8/STK526/LEDs.h | 147 -- .../LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h | 176 -- .../LUFA/Drivers/Board/AVR8/TUL/Buttons.h | 103 -- .../LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/UDIP/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/UDIP/LEDs.h | 163 -- .../LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h | 139 -- .../LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h | 113 -- .../LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h | 196 --- .../LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h | 135 -- .../LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h | 229 --- .../LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h | 130 -- .../LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h | 147 -- .../LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h | 103 -- .../LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h | 143 -- .../LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h | 243 --- .../LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h | 142 -- .../lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h | 178 -- .../LUFA-120730/LUFA/Drivers/Board/Dataflash.h | 252 --- .../lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h | 144 -- .../lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h | 274 --- .../LUFA-120730/LUFA/Drivers/Board/Temperature.c | 66 - .../LUFA-120730/LUFA/Drivers/Board/Temperature.h | 147 -- .../LUFA/Drivers/Board/UC3/EVK1100/Buttons.h | 117 -- .../LUFA/Drivers/Board/UC3/EVK1100/Joystick.h | 122 -- .../LUFA/Drivers/Board/UC3/EVK1100/LEDs.h | 173 -- .../LUFA/Drivers/Board/UC3/EVK1101/Buttons.h | 113 -- .../LUFA/Drivers/Board/UC3/EVK1101/Joystick.h | 131 -- .../LUFA/Drivers/Board/UC3/EVK1101/LEDs.h | 156 -- .../LUFA/Drivers/Board/UC3/EVK1104/Buttons.h | 109 -- .../LUFA/Drivers/Board/UC3/EVK1104/LEDs.h | 174 -- .../Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h | 119 -- .../Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h | 222 --- .../LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h | 144 -- .../LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h | 119 -- .../Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h | 224 --- .../LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h | 182 -- .../LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h | 100 -- .../LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h | 116 -- .../LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h | 303 ---- .../LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h | 231 --- .../lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h | 75 - .../LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h | 456 ----- .../LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h | 256 --- .../LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h | 200 --- .../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c | 119 -- .../LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h | 239 --- .../LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c | 207 --- .../LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h | 304 ---- .../lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h | 76 - .../LUFA-120730/LUFA/Drivers/Peripheral/Serial.h | 76 - .../LUFA/Drivers/Peripheral/SerialSPI.h | 76 - .../lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h | 74 - .../LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h | 248 --- .../Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h | 203 --- .../LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c | 122 -- .../LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h | 252 --- .../LUFA/Drivers/USB/Class/AndroidAccessoryClass.h | 76 - .../LUFA/Drivers/USB/Class/AudioClass.h | 80 - .../LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h | 80 - .../USB/Class/Common/AndroidAccessoryClassCommon.h | 128 -- .../Drivers/USB/Class/Common/AudioClassCommon.h | 774 --------- .../LUFA/Drivers/USB/Class/Common/CDCClassCommon.h | 386 ----- .../LUFA/Drivers/USB/Class/Common/HIDClassCommon.h | 655 ------- .../LUFA/Drivers/USB/Class/Common/HIDParser.c | 363 ---- .../LUFA/Drivers/USB/Class/Common/HIDParser.h | 364 ---- .../LUFA/Drivers/USB/Class/Common/HIDReportData.h | 126 -- .../Drivers/USB/Class/Common/MIDIClassCommon.h | 320 ---- .../USB/Class/Common/MassStorageClassCommon.h | 365 ---- .../Drivers/USB/Class/Common/PrinterClassCommon.h | 119 -- .../Drivers/USB/Class/Common/RNDISClassCommon.h | 414 ----- .../USB/Class/Common/StillImageClassCommon.h | 161 -- .../Drivers/USB/Class/Device/AudioClassDevice.c | 198 --- .../Drivers/USB/Class/Device/AudioClassDevice.h | 396 ----- .../LUFA/Drivers/USB/Class/Device/CDCClassDevice.c | 339 ---- .../LUFA/Drivers/USB/Class/Device/CDCClassDevice.h | 352 ---- .../LUFA/Drivers/USB/Class/Device/HIDClassDevice.c | 200 --- .../LUFA/Drivers/USB/Class/Device/HIDClassDevice.h | 210 --- .../Drivers/USB/Class/Device/MIDIClassDevice.c | 125 -- .../Drivers/USB/Class/Device/MIDIClassDevice.h | 175 -- .../USB/Class/Device/MassStorageClassDevice.c | 215 --- .../USB/Class/Device/MassStorageClassDevice.h | 161 -- .../Drivers/USB/Class/Device/RNDISClassDevice.c | 502 ------ .../Drivers/USB/Class/Device/RNDISClassDevice.h | 203 --- .../LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h | 81 - .../USB/Class/Host/AndroidAccessoryClassHost.c | 422 ----- .../USB/Class/Host/AndroidAccessoryClassHost.h | 314 ---- .../LUFA/Drivers/USB/Class/Host/AudioClassHost.c | 223 --- .../LUFA/Drivers/USB/Class/Host/AudioClassHost.h | 411 ----- .../LUFA/Drivers/USB/Class/Host/CDCClassHost.c | 478 ------ .../LUFA/Drivers/USB/Class/Host/CDCClassHost.h | 351 ---- .../LUFA/Drivers/USB/Class/Host/HIDClassHost.c | 396 ----- .../LUFA/Drivers/USB/Class/Host/HIDClassHost.h | 313 ---- .../LUFA/Drivers/USB/Class/Host/MIDIClassHost.c | 231 --- .../LUFA/Drivers/USB/Class/Host/MIDIClassHost.h | 190 -- .../Drivers/USB/Class/Host/MassStorageClassHost.c | 579 ------- .../Drivers/USB/Class/Host/MassStorageClassHost.h | 335 ---- .../LUFA/Drivers/USB/Class/Host/PrinterClassHost.c | 400 ----- .../LUFA/Drivers/USB/Class/Host/PrinterClassHost.h | 285 --- .../LUFA/Drivers/USB/Class/Host/RNDISClassHost.c | 476 ----- .../LUFA/Drivers/USB/Class/Host/RNDISClassHost.h | 270 --- .../Drivers/USB/Class/Host/StillImageClassHost.c | 436 ----- .../Drivers/USB/Class/Host/StillImageClassHost.h | 317 ---- .../LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h | 83 - .../LUFA/Drivers/USB/Class/MassStorageClass.h | 80 - .../LUFA/Drivers/USB/Class/PrinterClass.h | 77 - .../LUFA/Drivers/USB/Class/RNDISClass.h | 80 - .../LUFA/Drivers/USB/Class/StillImageClass.h | 75 - .../LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c | 57 - .../LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h | 264 --- .../Drivers/USB/Core/AVR8/EndpointStream_AVR8.c | 275 --- .../Drivers/USB/Core/AVR8/EndpointStream_AVR8.h | 648 ------- .../LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c | 201 --- .../LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h | 819 --------- .../LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c | 294 ---- .../LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h | 372 ---- .../LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h | 159 -- .../LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c | 221 --- .../LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h | 442 ----- .../LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c | 210 --- .../LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h | 921 ---------- .../AVR8/Template/Template_Endpoint_Control_R.c | 85 - .../AVR8/Template/Template_Endpoint_Control_W.c | 94 - .../USB/Core/AVR8/Template/Template_Endpoint_RW.c | 90 - .../USB/Core/AVR8/Template/Template_Pipe_RW.c | 89 - .../Drivers/USB/Core/AVR8/USBController_AVR8.c | 265 --- .../Drivers/USB/Core/AVR8/USBController_AVR8.h | 436 ----- .../LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c | 279 --- .../LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h | 369 ---- .../LUFA/Drivers/USB/Core/ConfigDescriptors.c | 146 -- .../LUFA/Drivers/USB/Core/ConfigDescriptors.h | 286 ---- .../LUFA-120730/LUFA/Drivers/USB/Core/Device.h | 159 -- .../LUFA/Drivers/USB/Core/DeviceStandardReq.c | 378 ---- .../LUFA/Drivers/USB/Core/DeviceStandardReq.h | 158 -- .../LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h | 130 -- .../LUFA/Drivers/USB/Core/EndpointStream.h | 124 -- .../LUFA-120730/LUFA/Drivers/USB/Core/Events.c | 40 - .../LUFA-120730/LUFA/Drivers/USB/Core/Events.h | 366 ---- .../lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h | 139 -- .../LUFA/Drivers/USB/Core/HostStandardReq.c | 322 ---- .../LUFA/Drivers/USB/Core/HostStandardReq.h | 292 ---- .../lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h | 80 - .../lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h | 144 -- .../LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h | 100 -- .../LUFA/Drivers/USB/Core/StdDescriptors.h | 739 -------- .../LUFA/Drivers/USB/Core/StdRequestType.h | 258 --- .../LUFA/Drivers/USB/Core/UC3/Device_UC3.c | 51 - .../LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 260 --- .../LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c | 235 --- .../LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h | 434 ----- .../LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c | 196 --- .../LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h | 795 --------- .../LUFA/Drivers/USB/Core/UC3/Host_UC3.c | 294 ---- .../LUFA/Drivers/USB/Core/UC3/Host_UC3.h | 363 ---- .../LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c | 166 -- .../LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h | 352 ---- .../LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c | 209 --- .../LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h | 924 ---------- .../UC3/Template/Template_Endpoint_Control_R.c | 85 - .../UC3/Template/Template_Endpoint_Control_W.c | 94 - .../USB/Core/UC3/Template/Template_Endpoint_RW.c | 90 - .../USB/Core/UC3/Template/Template_Pipe_RW.c | 89 - .../LUFA/Drivers/USB/Core/UC3/USBController_UC3.c | 222 --- .../LUFA/Drivers/USB/Core/UC3/USBController_UC3.h | 365 ---- .../LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c | 228 --- .../LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h | 370 ---- .../LUFA/Drivers/USB/Core/USBController.h | 151 -- .../LUFA/Drivers/USB/Core/USBInterrupt.h | 73 - .../LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h | 286 ---- .../LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c | 91 - .../LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h | 204 --- .../LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c | 49 - .../LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h | 258 --- .../Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c | 275 --- .../Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h | 648 ------- .../LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c | 168 -- .../LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h | 777 --------- .../LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c | 41 - .../LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c | 41 - .../LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c | 37 - .../XMEGA/Template/Template_Endpoint_Control_R.c | 87 - .../XMEGA/Template/Template_Endpoint_Control_W.c | 96 -- .../USB/Core/XMEGA/Template/Template_Endpoint_RW.c | 90 - .../Drivers/USB/Core/XMEGA/USBController_XMEGA.c | 189 -- .../Drivers/USB/Core/XMEGA/USBController_XMEGA.h | 313 ---- .../Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c | 106 -- .../Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h | 166 -- protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h | 418 ----- protocol/lufa/LUFA-120730/LUFA/License.txt | 24 - protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h | 80 - .../LUFA/Platform/UC3/ClockManagement.h | 338 ---- .../lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S | 128 -- .../LUFA/Platform/UC3/InterruptManagement.c | 68 - .../LUFA/Platform/UC3/InterruptManagement.h | 163 -- .../LUFA/Platform/XMEGA/ClockManagement.h | 397 ----- protocol/lufa/LUFA-120730/LUFA/Version.h | 52 - protocol/lufa/LUFA-120730/LUFA/makefile | 50 - protocol/lufa/LUFA-120730/README.txt | 56 - protocol/lufa/LUFA-git | 1 - protocol/lufa/descriptor.c | 630 ------- protocol/lufa/descriptor.h | 176 -- protocol/lufa/lufa.c | 605 ------- protocol/lufa/lufa.h | 80 - protocol/m0110.c | 591 ------- protocol/m0110.h | 92 - protocol/mbed/HIDKeyboard.cpp | 271 --- protocol/mbed/HIDKeyboard.h | 31 - protocol/mbed/mbed_driver.cpp | 41 - protocol/mbed/mbed_driver.h | 3 - protocol/news.c | 168 -- protocol/news.h | 51 - protocol/next_kbd.c | 204 --- protocol/next_kbd.h | 63 - protocol/pjrc.mk | 26 - protocol/pjrc/MEMO.txt | 25 - protocol/pjrc/main.c | 72 - protocol/pjrc/pjrc.c | 76 - protocol/pjrc/pjrc.h | 26 - protocol/pjrc/usb.c | 1002 ----------- protocol/pjrc/usb.h | 137 -- protocol/pjrc/usb_debug.c | 102 -- protocol/pjrc/usb_debug.h | 42 - protocol/pjrc/usb_extra.c | 70 - protocol/pjrc/usb_extra.h | 46 - protocol/pjrc/usb_keyboard.c | 110 -- protocol/pjrc/usb_keyboard.h | 40 - protocol/pjrc/usb_mouse.c | 81 - protocol/pjrc/usb_mouse.h | 50 - protocol/ps2.h | 134 -- protocol/ps2_busywait.c | 189 -- protocol/ps2_interrupt.c | 279 --- protocol/ps2_io.h | 15 - protocol/ps2_io_avr.c | 75 - protocol/ps2_io_mbed.c | 60 - protocol/ps2_mouse.c | 220 --- protocol/ps2_mouse.h | 66 - protocol/ps2_usart.c | 223 --- protocol/serial.h | 47 - protocol/serial_mouse.h | 33 - protocol/serial_mouse_microsoft.c | 124 -- protocol/serial_mouse_mousesystems.c | 131 -- protocol/serial_soft.c | 240 --- protocol/serial_uart.c | 112 -- protocol/usb_hid.mk | 74 - protocol/usb_hid/README | 47 - protocol/usb_hid/USB_Host_Shield_2.0 | 1 - .../usb_hid/arduino-1.0.1/cores/arduino/Arduino.h | 215 --- .../usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp | 233 --- .../usb_hid/arduino-1.0.1/cores/arduino/Client.h | 26 - .../usb_hid/arduino-1.0.1/cores/arduino/HID.cpp | 520 ------ .../arduino-1.0.1/cores/arduino/HardwareSerial.cpp | 428 ----- .../arduino-1.0.1/cores/arduino/HardwareSerial.h | 81 - .../arduino-1.0.1/cores/arduino/IPAddress.cpp | 56 - .../arduino-1.0.1/cores/arduino/IPAddress.h | 76 - .../usb_hid/arduino-1.0.1/cores/arduino/Platform.h | 23 - .../usb_hid/arduino-1.0.1/cores/arduino/Print.cpp | 263 --- .../usb_hid/arduino-1.0.1/cores/arduino/Print.h | 78 - .../arduino-1.0.1/cores/arduino/Printable.h | 40 - .../usb_hid/arduino-1.0.1/cores/arduino/Server.h | 9 - .../usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp | 270 --- .../usb_hid/arduino-1.0.1/cores/arduino/Stream.h | 96 -- .../usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp | 601 ------- .../usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h | 195 --- .../arduino-1.0.1/cores/arduino/USBCore.cpp | 672 -------- .../usb_hid/arduino-1.0.1/cores/arduino/USBCore.h | 303 ---- .../usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h | 63 - protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h | 88 - .../arduino-1.0.1/cores/arduino/WCharacter.h | 168 -- .../arduino-1.0.1/cores/arduino/WInterrupts.c | 298 ---- .../usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp | 60 - .../arduino-1.0.1/cores/arduino/WString.cpp | 645 ------- .../usb_hid/arduino-1.0.1/cores/arduino/WString.h | 205 --- .../usb_hid/arduino-1.0.1/cores/arduino/binary.h | 515 ------ .../usb_hid/arduino-1.0.1/cores/arduino/main.cpp | 20 - .../usb_hid/arduino-1.0.1/cores/arduino/new.cpp | 18 - protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h | 22 - .../usb_hid/arduino-1.0.1/cores/arduino/wiring.c | 324 ---- .../arduino-1.0.1/cores/arduino/wiring_analog.c | 282 --- .../arduino-1.0.1/cores/arduino/wiring_digital.c | 178 -- .../arduino-1.0.1/cores/arduino/wiring_private.h | 69 - .../arduino-1.0.1/cores/arduino/wiring_pulse.c | 69 - .../arduino-1.0.1/cores/arduino/wiring_shift.c | 55 - .../variants/eightanaloginputs/pins_arduino.h | 27 - .../arduino-1.0.1/variants/leonardo/pins_arduino.h | 256 --- .../arduino-1.0.1/variants/mega/pins_arduino.h | 363 ---- .../arduino-1.0.1/variants/standard/pins_arduino.h | 218 --- protocol/usb_hid/leonardo_led.h | 10 - protocol/usb_hid/override_Serial.cpp | 51 - protocol/usb_hid/override_wiring.c | 29 - protocol/usb_hid/parser.cpp | 24 - protocol/usb_hid/parser.h | 12 - protocol/usb_hid/test/Makefile | 126 -- protocol/usb_hid/test/config.h | 40 - protocol/usb_hid/test/test.cpp | 92 - protocol/usb_hid/usb_hid.h | 10 - protocol/vusb.mk | 21 - protocol/vusb/main.c | 100 -- protocol/vusb/sendchar_usart.c | 23 - protocol/vusb/usbdrv/Changelog.txt | 308 ---- protocol/vusb/usbdrv/CommercialLicense.txt | 166 -- protocol/vusb/usbdrv/License.txt | 361 ---- protocol/vusb/usbdrv/Readme.txt | 172 -- protocol/vusb/usbdrv/USB-ID-FAQ.txt | 149 -- protocol/vusb/usbdrv/USB-IDs-for-free.txt | 148 -- protocol/vusb/usbdrv/asmcommon.inc | 188 -- protocol/vusb/usbdrv/oddebug.c | 50 - protocol/vusb/usbdrv/oddebug.h | 123 -- protocol/vusb/usbdrv/usbconfig-prototype.h | 376 ---- protocol/vusb/usbdrv/usbdrv.c | 625 ------- protocol/vusb/usbdrv/usbdrv.h | 735 -------- protocol/vusb/usbdrv/usbdrvasm.S | 393 ----- protocol/vusb/usbdrv/usbdrvasm.asm | 21 - protocol/vusb/usbdrv/usbdrvasm12.inc | 393 ----- protocol/vusb/usbdrv/usbdrvasm128.inc | 750 -------- protocol/vusb/usbdrv/usbdrvasm15.inc | 423 ----- protocol/vusb/usbdrv/usbdrvasm16.inc | 346 ---- protocol/vusb/usbdrv/usbdrvasm165.inc | 453 ----- protocol/vusb/usbdrv/usbdrvasm18-crc.inc | 707 -------- protocol/vusb/usbdrv/usbdrvasm20.inc | 360 ---- protocol/vusb/usbdrv/usbportability.h | 144 -- protocol/vusb/vusb.c | 496 ------ protocol/vusb/vusb.h | 27 - 449 files changed, 90783 deletions(-) delete mode 100644 protocol/adb.c delete mode 100644 protocol/adb.h delete mode 100644 protocol/bluefruit.mk delete mode 100644 protocol/bluefruit/bluefruit.c delete mode 100644 protocol/bluefruit/bluefruit.h delete mode 100644 protocol/bluefruit/main.c delete mode 100644 protocol/ibm4704.c delete mode 100644 protocol/ibm4704.h delete mode 100644 protocol/iwrap.mk delete mode 100644 protocol/iwrap/iWRAP4.txt delete mode 100644 protocol/iwrap/iWRAP5.txt delete mode 100644 protocol/iwrap/iwrap.c delete mode 100644 protocol/iwrap/iwrap.h delete mode 100644 protocol/iwrap/main.c delete mode 100644 protocol/iwrap/mux_exit.rb delete mode 100644 protocol/iwrap/suart.S delete mode 100644 protocol/iwrap/suart.h delete mode 100644 protocol/iwrap/wd.h delete mode 100644 protocol/lufa.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk delete mode 100644 protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/Common.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Doxygen.conf delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/License.txt delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/Version.h delete mode 100644 protocol/lufa/LUFA-120730/LUFA/makefile delete mode 100644 protocol/lufa/LUFA-120730/README.txt delete mode 160000 protocol/lufa/LUFA-git delete mode 100644 protocol/lufa/descriptor.c delete mode 100644 protocol/lufa/descriptor.h delete mode 100644 protocol/lufa/lufa.c delete mode 100644 protocol/lufa/lufa.h delete mode 100644 protocol/m0110.c delete mode 100644 protocol/m0110.h delete mode 100644 protocol/mbed/HIDKeyboard.cpp delete mode 100644 protocol/mbed/HIDKeyboard.h delete mode 100644 protocol/mbed/mbed_driver.cpp delete mode 100644 protocol/mbed/mbed_driver.h delete mode 100644 protocol/news.c delete mode 100644 protocol/news.h delete mode 100644 protocol/next_kbd.c delete mode 100644 protocol/next_kbd.h delete mode 100644 protocol/pjrc.mk delete mode 100644 protocol/pjrc/MEMO.txt delete mode 100644 protocol/pjrc/main.c delete mode 100644 protocol/pjrc/pjrc.c delete mode 100644 protocol/pjrc/pjrc.h delete mode 100644 protocol/pjrc/usb.c delete mode 100644 protocol/pjrc/usb.h delete mode 100644 protocol/pjrc/usb_debug.c delete mode 100644 protocol/pjrc/usb_debug.h delete mode 100644 protocol/pjrc/usb_extra.c delete mode 100644 protocol/pjrc/usb_extra.h delete mode 100644 protocol/pjrc/usb_keyboard.c delete mode 100644 protocol/pjrc/usb_keyboard.h delete mode 100644 protocol/pjrc/usb_mouse.c delete mode 100644 protocol/pjrc/usb_mouse.h delete mode 100644 protocol/ps2.h delete mode 100644 protocol/ps2_busywait.c delete mode 100644 protocol/ps2_interrupt.c delete mode 100644 protocol/ps2_io.h delete mode 100644 protocol/ps2_io_avr.c delete mode 100644 protocol/ps2_io_mbed.c delete mode 100644 protocol/ps2_mouse.c delete mode 100644 protocol/ps2_mouse.h delete mode 100644 protocol/ps2_usart.c delete mode 100644 protocol/serial.h delete mode 100644 protocol/serial_mouse.h delete mode 100644 protocol/serial_mouse_microsoft.c delete mode 100644 protocol/serial_mouse_mousesystems.c delete mode 100644 protocol/serial_soft.c delete mode 100644 protocol/serial_uart.c delete mode 100644 protocol/usb_hid.mk delete mode 100644 protocol/usb_hid/README delete mode 160000 protocol/usb_hid/USB_Host_Shield_2.0 delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c delete mode 100644 protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c delete mode 100644 protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h delete mode 100644 protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h delete mode 100644 protocol/usb_hid/leonardo_led.h delete mode 100644 protocol/usb_hid/override_Serial.cpp delete mode 100644 protocol/usb_hid/override_wiring.c delete mode 100644 protocol/usb_hid/parser.cpp delete mode 100644 protocol/usb_hid/parser.h delete mode 100644 protocol/usb_hid/test/Makefile delete mode 100644 protocol/usb_hid/test/config.h delete mode 100644 protocol/usb_hid/test/test.cpp delete mode 100644 protocol/usb_hid/usb_hid.h delete mode 100644 protocol/vusb.mk delete mode 100644 protocol/vusb/main.c delete mode 100644 protocol/vusb/sendchar_usart.c delete mode 100644 protocol/vusb/usbdrv/Changelog.txt delete mode 100644 protocol/vusb/usbdrv/CommercialLicense.txt delete mode 100644 protocol/vusb/usbdrv/License.txt delete mode 100644 protocol/vusb/usbdrv/Readme.txt delete mode 100644 protocol/vusb/usbdrv/USB-ID-FAQ.txt delete mode 100644 protocol/vusb/usbdrv/USB-IDs-for-free.txt delete mode 100644 protocol/vusb/usbdrv/asmcommon.inc delete mode 100644 protocol/vusb/usbdrv/oddebug.c delete mode 100644 protocol/vusb/usbdrv/oddebug.h delete mode 100644 protocol/vusb/usbdrv/usbconfig-prototype.h delete mode 100644 protocol/vusb/usbdrv/usbdrv.c delete mode 100644 protocol/vusb/usbdrv/usbdrv.h delete mode 100644 protocol/vusb/usbdrv/usbdrvasm.S delete mode 100644 protocol/vusb/usbdrv/usbdrvasm.asm delete mode 100644 protocol/vusb/usbdrv/usbdrvasm12.inc delete mode 100644 protocol/vusb/usbdrv/usbdrvasm128.inc delete mode 100644 protocol/vusb/usbdrv/usbdrvasm15.inc delete mode 100644 protocol/vusb/usbdrv/usbdrvasm16.inc delete mode 100644 protocol/vusb/usbdrv/usbdrvasm165.inc delete mode 100644 protocol/vusb/usbdrv/usbdrvasm18-crc.inc delete mode 100644 protocol/vusb/usbdrv/usbdrvasm20.inc delete mode 100644 protocol/vusb/usbdrv/usbportability.h delete mode 100644 protocol/vusb/vusb.c delete mode 100644 protocol/vusb/vusb.h (limited to 'protocol') diff --git a/protocol/adb.c b/protocol/adb.c deleted file mode 100644 index bbff66df03..0000000000 --- a/protocol/adb.c +++ /dev/null @@ -1,456 +0,0 @@ -/* -Copyright 2011 Jun WAKO -Copyright 2013 Shay Green - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include -#include -#include "adb.h" - - -// GCC doesn't inline functions normally -#define data_lo() (ADB_DDR |= (1< - * - */ - -// ADB Bit Cells -// -// bit cell time: 70-130us -// low part of bit0: 60-70% of bit cell -// low part of bit1: 30-40% of bit cell -// -// bit cell time 70us 130us -// -------------------------------------------- -// low part of bit0 42-49 78-91 -// high part of bit0 21-28 39-52 -// low part of bit1 21-28 39-52 -// high part of bit1 42-49 78-91 -// -// -// bit0: -// 70us bit cell: -// ____________~~~~~~ -// 42-49 21-28 -// -// 130us bit cell: -// ____________~~~~~~ -// 78-91 39-52 -// -// bit1: -// 70us bit cell: -// ______~~~~~~~~~~~~ -// 21-28 42-49 -// -// 130us bit cell: -// ______~~~~~~~~~~~~ -// 39-52 78-91 -// -// [from Apple IIgs Hardware Reference Second Edition] - -uint16_t adb_host_kbd_recv(void) -{ - uint16_t data = 0; - cli(); - attention(); - send_byte(0x2C); // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00) - place_bit0(); // Stopbit(0) - if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored - sei(); - return -30; // something wrong - } - if (!wait_data_lo(500)) { // Tlt/Stop to Start(140-260us) - sei(); - return 0; // No data to send - } - - uint8_t n = 17; // start bit + 16 data bits - do { - uint8_t lo = (uint8_t) wait_data_hi(130); - if (!lo) - goto error; - - uint8_t hi = (uint8_t) wait_data_lo(lo); - if (!hi) - goto error; - - hi = lo - hi; - lo = 130 - lo; - - data <<= 1; - if (lo < hi) { - data |= 1; - } - else if (n == 17) { - sei(); - return -20; - } - } - while ( --n ); - - // Stop bit can't be checked normally since it could have service request lenghtening - // and its high state never goes low. - if (!wait_data_hi(351) || wait_data_lo(91)) { - sei(); - return -21; - } - sei(); - return data; - -error: - sei(); - return -n; -} - -void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l) -{ - cli(); - attention(); - send_byte(cmd); - place_bit0(); // Stopbit(0) - _delay_us(200); // Tlt/Stop to Start - place_bit1(); // Startbit(1) - send_byte(data_h); - send_byte(data_l); - place_bit0(); // Stopbit(0); - sei(); -} - -// send state of LEDs -void adb_host_kbd_led(uint8_t led) -{ - // Addr:Keyboard(0010), Cmd:Listen(10), Register2(10) - // send upper byte (not used) - // send lower byte (bit2: ScrollLock, bit1: CapsLock, bit0: - adb_host_listen(0x2A,0,led&0x07); -} - - -#ifdef ADB_PSW_BIT -static inline void psw_lo() -{ - ADB_DDR |= (1<>i)) - place_bit1(); - else - place_bit0(); - } -} - -// These are carefully coded to take 6 cycles of overhead. -// inline asm approach became too convoluted -static inline uint16_t wait_data_lo(uint16_t us) -{ - do { - if ( !data_in() ) - break; - _delay_us(1 - (6 * 1000000.0 / F_CPU)); - } - while ( --us ); - return us; -} - -static inline uint16_t wait_data_hi(uint16_t us) -{ - do { - if ( data_in() ) - break; - _delay_us(1 - (6 * 1000000.0 / F_CPU)); - } - while ( --us ); - return us; -} - - -/* -ADB Protocol -============ - -Resources ---------- -ADB - The Untold Story: Space Aliens Ate My Mouse - http://developer.apple.com/legacy/mac/library/#technotes/hw/hw_01.html -ADB Manager - http://developer.apple.com/legacy/mac/library/documentation/mac/pdf/Devices/ADB_Manager.pdf - Service request(5-17) -Apple IIgs Hardware Reference Second Edition [Chapter6 p121] - ftp://ftp.apple.asimov.net/pub/apple_II/documentation/Apple%20IIgs%20Hardware%20Reference.pdf -ADB Keycode - http://72.0.193.250/Documentation/macppc/adbkeycodes/ - http://m0115.web.fc2.com/m0115.jpg - [Inside Macintosh volume V, pages 191-192] - http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-421.18.3/IOHIDFamily/Cosmo_USB2ADB.c -ADB Signaling - http://kbdbabel.sourceforge.net/doc/kbd_signaling_pcxt_ps2_adb.pdf -ADB Overview & History - http://en.wikipedia.org/wiki/Apple_Desktop_Bus -Microchip Application Note: ADB device(with code for PIC16C) - http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011062 -AVR ATtiny2131 ADB to PS/2 converter(Japanese) - http://hp.vector.co.jp/authors/VA000177/html/KeyBoardA5DEA5CBA5A2II.html - - -Pinouts -------- - ADB female socket from the front: - __________ - | | <--- top - | 4o o3 | - |2o o1| - | == | - |________| <--- bottom - | | <--- 4pins - - - ADB female socket from bottom: - - ========== <--- front - | | - | | - |2o o1| - |4o o3| - ---------- <--- back - - 1: Data - 2: Power SW(low when press Power key) - 3: Vcc(5V) - 4: GND - - -Commands --------- - ADB command is 1byte and consists of 4bit-address, 2bit-command - type and 2bit-register. The commands are always sent by Host. - - Command format: - 7 6 5 4 3 2 1 0 - | | | |------------ address - | |-------- command type - | |---- register - - bits commands - ------------------------------------------------------ - - - - - 0 0 0 0 Send Request(reset all devices) - A A A A 0 0 0 1 Flush(reset a device) - - - - - 0 0 1 0 Reserved - - - - - 0 0 1 1 Reserved - - - - - 0 1 - - Reserved - A A A A 1 0 R R Listen(write to a device) - A A A A 1 1 R R Talk(read from a device) - - The command to read keycodes from keyboard is 0x2C which - consist of keyboard address 2 and Talk against register 0. - - Address: - 2: keyboard - 3: mice - - Registers: - 0: application(keyboard uses this to store its data.) - 1: application - 2: application(keyboard uses this for LEDs and state of modifiers) - 3: status and command - - -Communication -------------- - This is a minimum information for keyboard communication. - See "Resources" for detail. - - Signaling: - - ~~~~____________~~||||||||||||__~~~~~_~~|||||||||||||||__~~~~ - - |800us | |7 Command 0| | | |15-64 Data 0|Stopbit(0) - +Attention | | | +Startbit(1) - +Startbit(1) | +Tlt(140-260us) - +stopbit(0) - - Bit cells: - - bit0: ______~~~ - 65 :35us - - bit1: ___~~~~~~ - 35 :65us - - bit0 low time: 60-70% of bit cell(42-91us) - bit1 low time: 30-40% of bit cell(21-52us) - bit cell time: 70-130us - [from Apple IIgs Hardware Reference Second Edition] - - Criterion for bit0/1: - After 55us if line is low/high then bit is 0/1. - - Attention & start bit: - Host asserts low in 560-1040us then places start bit(1). - - Tlt(Stop to Start): - Bus stays high in 140-260us then device places start bit(1). - - Global reset: - Host asserts low in 2.8-5.2ms. All devices are forced to reset. - - Service request from device(Srq): - Device can request to send at commad(Global only?) stop bit. - Requesting device keeps low for 140-260us at stop bit of command. - - -Keyboard Data(Register0) - This 16bit data can contains two keycodes and two released flags. - First keycode is palced in upper byte. When one keyocode is sent, - lower byte is 0xFF. - Release flag is 1 when key is released. - - 1514 . . . . . 8 7 6 . . . . . 0 - | | | | | | | | | +-+-+-+-+-+-+- Keycode2 - | | | | | | | | +--------------- Released2(1 when the key is released) - | +-+-+-+-+-+-+----------------- Keycode1 - +------------------------------- Released1(1 when the key is released) - - Keycodes: - Scancode consists of 7bit keycode and 1bit release flag. - Device can send two keycodes at once. If just one keycode is sent - keycode1 contains it and keyocode2 is 0xFF. - - Power switch: - You can read the state from PSW line(active low) however - the switch has a special scancode 0x7F7F, so you can - also read from Data line. It uses 0xFFFF for release scancode. - -Keyboard LEDs & state of keys(Register2) - This register hold current state of three LEDs and nine keys. - The state of LEDs can be changed by sending Listen command. - - 1514 . . . . . . 7 6 5 . 3 2 1 0 - | | | | | | | | | | | | | | | +- LED1(NumLock) - | | | | | | | | | | | | | | +--- LED2(CapsLock) - | | | | | | | | | | | | | +----- LED3(ScrollLock) - | | | | | | | | | | +-+-+------- Reserved - | | | | | | | | | +------------- ScrollLock - | | | | | | | | +--------------- NumLock - | | | | | | | +----------------- Apple/Command - | | | | | | +------------------- Option - | | | | | +--------------------- Shift - | | | | +----------------------- Control - | | | +------------------------- Reset/Power - | | +--------------------------- CapsLock - | +----------------------------- Delete - +------------------------------- Reserved - -END_OF_ADB -*/ diff --git a/protocol/adb.h b/protocol/adb.h deleted file mode 100644 index bfe598bbf1..0000000000 --- a/protocol/adb.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2011 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef ADB_H -#define ADB_H - -#include -#include - -#if !(defined(ADB_PORT) && \ - defined(ADB_PIN) && \ - defined(ADB_DDR) && \ - defined(ADB_DATA_BIT)) -# error "ADB port setting is required in config.h" -#endif - -#define ADB_POWER 0x7F -#define ADB_CAPS 0x39 - - -// ADB host -void adb_host_init(void); -bool adb_host_psw(void); -uint16_t adb_host_kbd_recv(void); -void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); -void adb_host_kbd_led(uint8_t led); - -#endif diff --git a/protocol/bluefruit.mk b/protocol/bluefruit.mk deleted file mode 100644 index e1c5fff77f..0000000000 --- a/protocol/bluefruit.mk +++ /dev/null @@ -1,27 +0,0 @@ -BLUEFRUIT_DIR = protocol/bluefruit -PJRC_DIR = protocol/pjrc - -SRC += $(BLUEFRUIT_DIR)/main.c \ - $(BLUEFRUIT_DIR)/bluefruit.c \ - serial_uart.c \ - $(PJRC_DIR)/pjrc.c \ - $(PJRC_DIR)/usb_keyboard.c \ - $(PJRC_DIR)/usb_debug.c \ - $(PJRC_DIR)/usb.c - -# Option modules -ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE) - SRC += $(PJRC_DIR)/usb_mouse.c -endif - -ifdef EXTRAKEY_ENABLE - SRC += $(PJRC_DIR)/usb_extra.c -endif - -# Search Path -VPATH += $(TMK_DIR)/$(BLUEFRUIT_DIR) -#VPATH += $(TMK_DIR)/$(BLUEFRUIT_DIR)/usb_debug_only -VPATH += $(TMK_DIR)/$(PJRC_DIR) - -OPT_DEFS += -DPROTOCOL_BLUEFRUIT -OPT_DEFS += -DPROTOCOL_PJRC diff --git a/protocol/bluefruit/bluefruit.c b/protocol/bluefruit/bluefruit.c deleted file mode 100644 index cf26b83dff..0000000000 --- a/protocol/bluefruit/bluefruit.c +++ /dev/null @@ -1,202 +0,0 @@ -/* -Bluefruit Protocol for TMK firmware -Author: Benjamin Gould, 2013 -Based on code Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -*/ - -#include -#include "host.h" -#include "report.h" -#include "print.h" -#include "debug.h" -#include "host_driver.h" -#include "serial.h" -#include "bluefruit.h" - -#define BLUEFRUIT_TRACE_SERIAL 1 - -static uint8_t bluefruit_keyboard_leds = 0; - -static void bluefruit_serial_send(uint8_t); - -void bluefruit_keyboard_print_report(report_keyboard_t *report) -{ - if (!debug_keyboard) return; - dprintf("keys: "); for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { debug_hex8(report->keys[i]); dprintf(" "); } - dprintf(" mods: "); debug_hex8(report->mods); - dprintf(" reserved: "); debug_hex8(report->reserved); - dprintf("\n"); -} - -#ifdef BLUEFRUIT_TRACE_SERIAL -static void bluefruit_trace_header() -{ - dprintf("+------------------------------------+\n"); - dprintf("| HID report to Bluefruit via serial |\n"); - dprintf("+------------------------------------+\n|"); -} - -static void bluefruit_trace_footer() -{ - dprintf("|\n+------------------------------------+\n\n"); -} -#endif - -static void bluefruit_serial_send(uint8_t data) -{ -#ifdef BLUEFRUIT_TRACE_SERIAL - dprintf(" "); - debug_hex8(data); - dprintf(" "); -#endif - serial_send(data); -} - -/*------------------------------------------------------------------* - * Host driver - *------------------------------------------------------------------*/ - -static uint8_t keyboard_leds(void); -static void send_keyboard(report_keyboard_t *report); -static void send_mouse(report_mouse_t *report); -static void send_system(uint16_t data); -static void send_consumer(uint16_t data); - -static host_driver_t driver = { - keyboard_leds, - send_keyboard, - send_mouse, - send_system, - send_consumer -}; - -host_driver_t *bluefruit_driver(void) -{ - return &driver; -} - -static uint8_t keyboard_leds(void) { - return bluefruit_keyboard_leds; -} - -static void send_keyboard(report_keyboard_t *report) -{ -#ifdef BLUEFRUIT_TRACE_SERIAL - bluefruit_trace_header(); -#endif - bluefruit_serial_send(0xFD); - for (uint8_t i = 0; i < KEYBOARD_REPORT_SIZE; i++) { - bluefruit_serial_send(report->raw[i]); - } -#ifdef BLUEFRUIT_TRACE_SERIAL - bluefruit_trace_footer(); -#endif -} - -static void send_mouse(report_mouse_t *report) -{ -#ifdef BLUEFRUIT_TRACE_SERIAL - bluefruit_trace_header(); -#endif - bluefruit_serial_send(0xFD); - bluefruit_serial_send(0x00); - bluefruit_serial_send(0x03); - bluefruit_serial_send(report->buttons); - bluefruit_serial_send(report->x); - bluefruit_serial_send(report->y); - bluefruit_serial_send(report->v); // should try sending the wheel v here - bluefruit_serial_send(report->h); // should try sending the wheel h here - bluefruit_serial_send(0x00); -#ifdef BLUEFRUIT_TRACE_SERIAL - bluefruit_trace_footer(); -#endif -} - -static void send_system(uint16_t data) -{ -} - -/* -+-----------------+-------------------+-------+ -| Consumer Key | Bit Map | Hex | -+-----------------+-------------------+-------+ -| Home | 00000001 00000000 | 01 00 | -| KeyboardLayout | 00000010 00000000 | 02 00 | -| Search | 00000100 00000000 | 04 00 | -| Snapshot | 00001000 00000000 | 08 00 | -| VolumeUp | 00010000 00000000 | 10 00 | -| VolumeDown | 00100000 00000000 | 20 00 | -| Play/Pause | 01000000 00000000 | 40 00 | -| Fast Forward | 10000000 00000000 | 80 00 | -| Rewind | 00000000 00000001 | 00 01 | -| Scan Next Track | 00000000 00000010 | 00 02 | -| Scan Prev Track | 00000000 00000100 | 00 04 | -| Random Play | 00000000 00001000 | 00 08 | -| Stop | 00000000 00010000 | 00 10 | -+-------------------------------------+-------+ -*/ -#define CONSUMER2BLUEFRUIT(usage) \ - (usage == AUDIO_MUTE ? 0x0000 : \ - (usage == AUDIO_VOL_UP ? 0x1000 : \ - (usage == AUDIO_VOL_DOWN ? 0x2000 : \ - (usage == TRANSPORT_NEXT_TRACK ? 0x0002 : \ - (usage == TRANSPORT_PREV_TRACK ? 0x0004 : \ - (usage == TRANSPORT_STOP ? 0x0010 : \ - (usage == TRANSPORT_STOP_EJECT ? 0x0000 : \ - (usage == TRANSPORT_PLAY_PAUSE ? 0x4000 : \ - (usage == AL_CC_CONFIG ? 0x0000 : \ - (usage == AL_EMAIL ? 0x0000 : \ - (usage == AL_CALCULATOR ? 0x0000 : \ - (usage == AL_LOCAL_BROWSER ? 0x0000 : \ - (usage == AC_SEARCH ? 0x0400 : \ - (usage == AC_HOME ? 0x0100 : \ - (usage == AC_BACK ? 0x0000 : \ - (usage == AC_FORWARD ? 0x0000 : \ - (usage == AC_STOP ? 0x0000 : \ - (usage == AC_REFRESH ? 0x0000 : \ - (usage == AC_BOOKMARKS ? 0x0000 : 0))))))))))))))))))) - -static void send_consumer(uint16_t data) -{ - static uint16_t last_data = 0; - if (data == last_data) return; - last_data = data; - - uint16_t bitmap = CONSUMER2BLUEFRUIT(data); - -#ifdef BLUEFRUIT_TRACE_SERIAL - dprintf("\nData: "); - debug_hex16(data); - dprintf("; bitmap: "); - debug_hex16(bitmap); - dprintf("\n"); - bluefruit_trace_header(); -#endif - bluefruit_serial_send(0xFD); - bluefruit_serial_send(0x00); - bluefruit_serial_send(0x02); - bluefruit_serial_send((bitmap>>8)&0xFF); - bluefruit_serial_send(bitmap&0xFF); - bluefruit_serial_send(0x00); - bluefruit_serial_send(0x00); - bluefruit_serial_send(0x00); - bluefruit_serial_send(0x00); -#ifdef BLUEFRUIT_TRACE_SERIAL - bluefruit_trace_footer(); -#endif -} - diff --git a/protocol/bluefruit/bluefruit.h b/protocol/bluefruit/bluefruit.h deleted file mode 100644 index 4f9b58836d..0000000000 --- a/protocol/bluefruit/bluefruit.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -Bluefruit Protocol for TMK firmware -Author: Benjamin Gould, 2013 -Based on code Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef VUSB_H -#define VUSB_H - -#include "host_driver.h" - - -host_driver_t *bluefruit_driver(void); - -#endif diff --git a/protocol/bluefruit/main.c b/protocol/bluefruit/main.c deleted file mode 100644 index 871062ab11..0000000000 --- a/protocol/bluefruit/main.c +++ /dev/null @@ -1,116 +0,0 @@ -/* -Bluefruit Protocol for TMK firmware -Author: Benjamin Gould, 2013 -Based on code Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include -#include -#include -#include -#include "serial.h" -#include "keyboard.h" -#include "usb.h" -#include "host.h" -#include "timer.h" -#include "print.h" -#include "debug.h" -#include "sendchar.h" -#include "suspend.h" -#include "bluefruit.h" -#include "pjrc.h" - -#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) - -#define HOST_DRIVER_NOT_SET 0 -#define BLUEFRUIT_HOST_DRIVER 1 -#define PJRC_HOST_DRIVER 2 - -int main(void) -{ - - CPU_PRESCALE(0); - - DDRD = _BV(PD5); - DDRB = _BV(PB0); - - PORTD = _BV(PD5); - PORTB = _BV(PB0); - - print_set_sendchar(sendchar); - - usb_init(); - _delay_ms(2000); - // while (!usb_configured()) /* wait */ - - dprintf("Initializing keyboard...\n"); - keyboard_init(); - - // This implementation is pretty simplistic... if the USB connection - // is not configured, choose the Bluefruit, otherwise use USB - // Definitely would prefer to have this driven by an input pin and make - // it switch dynamically - BCG - if (!usb_configured()) { - - // Send power to Bluefruit... Adafruit says it takes 27 mA, I think - // the pins should provide 40 mA, but just in case I switch the - // Bluefruit using a transistor - BCG - DDRB = _BV(PB6); - PORTB |= _BV(PB6); - - dprintf("Setting host driver to bluefruit...\n"); - host_set_driver(bluefruit_driver()); - - dprintf("Initializing serial...\n"); - serial_init(); - - // wait an extra second for the PC's operating system - // to load drivers and do whatever it does to actually - // be ready for input - _delay_ms(1000); - PORTD = ~_BV(PD5); - dprintf("Starting main loop"); - while (1) { - keyboard_task(); - } - - } else { - - // I'm not smart enough to get this done with LUFA - BCG - dprintf("Setting host driver to PJRC...\n"); - host_set_driver(pjrc_driver()); -#ifdef SLEEP_LED_ENABLE - sleep_led_init(); -#endif - // wait an extra second for the PC's operating system - // to load drivers and do whatever it does to actually - // be ready for input - _delay_ms(1000); - PORTB = ~_BV(PB0); - dprintf("Starting main loop"); - while (1) { - while (suspend) { - suspend_power_down(); - if (remote_wakeup && suspend_wakeup_condition()) { - usb_remote_wakeup(); - } - } - keyboard_task(); - } - } - -} diff --git a/protocol/ibm4704.c b/protocol/ibm4704.c deleted file mode 100644 index 10e229fd15..0000000000 --- a/protocol/ibm4704.c +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright 2010,2011,2012,2013 Jun WAKO -*/ -#include -#include -#include "debug.h" -#include "ibm4704.h" - - -#define WAIT(stat, us, err) do { \ - if (!wait_##stat(us)) { \ - ibm4704_error = err; \ - goto ERROR; \ - } \ -} while (0) - - -uint8_t ibm4704_error = 0; - - -void ibm4704_init(void) -{ - inhibit(); -} - -/* -Host to Keyboard ----------------- -Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. - - ____ __ __ __ __ __ __ __ __ __ ________ -Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ - ^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___ -Data ____|__/ X____X____X____X____X____X____X____X____X____X \___ - | Start 0 1 2 3 4 5 6 7 P Stop - Request by host - -Start bit: can be long as 300-350us. -Request: Host pulls Clock line down to request to send a command. -Timing: After Request keyboard pull up Data and down Clock line to low for start bit. - After request host release Clock line once Data line becomes hi. - Host writes a bit while Clock is hi and Keyboard reads while low. -Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keyboard pull down the line to lo. -*/ -uint8_t ibm4704_send(uint8_t data) -{ - bool parity = true; // odd parity - ibm4704_error = 0; - - /* Request to send */ - idle(); - clock_lo(); - - /* wait for Start bit(Clock:lo/Data:hi) */ - WAIT(data_hi, 300, 0x30); - - /* Data bit */ - for (uint8_t i = 0; i < 8; i++) { - WAIT(clock_hi, 100, 0x40+i); - //_delay_us(5); - if (data&(1<= 0x30) { - xprintf("x%02X ", ibm4704_error); - } - _delay_us(200); // wait to recover clock to hi - return -1; -} - -/* receive data when host want else inhibit communication */ -uint8_t ibm4704_recv_response(void) -{ - // 250 * 100us(wait start bit in ibm4704_recv) - uint8_t data = 0; - uint8_t try = 250; - do { - data = ibm4704_recv(); - } while (try-- && ibm4704_error); - return data; -} - -/* -Keyboard to Host ----------------- -Data bits are LSB first and Parity is odd. Clock has around 60us high and 30us low part. - - ____ __ __ __ __ __ __ __ __ __ ________ -Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ - ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ -Data ____/ X____X____X____X____X____X____X____X____X____X________ - Start 0 1 2 3 4 5 6 7 P Stop - -Start bit: can be long as 300-350us. -Inhibit: Pull Data line down to inhibit keyboard to send. -Timing: Host reads bit while Clock is hi. -Stop bit: Keyboard pulls down Data line to lo after 9th clock. -*/ -uint8_t ibm4704_recv(void) -{ - uint8_t data = 0; - bool parity = true; // odd parity - ibm4704_error = IBM4704_ERR_NONE; - - idle(); - _delay_us(5); // wait for line settles - - /* start bit */ - WAIT(clock_lo, 100, 0x11); // wait for keyboard to send - WAIT(data_hi, 100, 0x12); // can be delayed that long - - WAIT(clock_hi, 100, 0x13); // first rising edge which can take longer - /* data */ - for (uint8_t i = 0; i < 8; i++) { - WAIT(clock_hi, 100, 0x20+i); - //_delay_us(5); - if (data_in()) { - parity = !parity; - data |= (1< 0x12) { - xprintf("x%02X ", ibm4704_error); - } - inhibit(); - _delay_us(200); // wait to recover clock to hi - return -1; -} diff --git a/protocol/ibm4704.h b/protocol/ibm4704.h deleted file mode 100644 index 618cce6be0..0000000000 --- a/protocol/ibm4704.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2014 Jun WAKO -*/ -#ifndef IBM4704_H -#define IBM4704_H - -#define IBM4704_ERR_NONE 0 -#define IBM4704_ERR_PARITY 0x70 - - -void ibm4704_init(void); -uint8_t ibm4704_send(uint8_t data); -uint8_t ibm4704_recv_response(void); -uint8_t ibm4704_recv(void); - - -/* Check pin configuration */ -#if !(defined(IBM4704_CLOCK_PORT) && \ - defined(IBM4704_CLOCK_PIN) && \ - defined(IBM4704_CLOCK_DDR) && \ - defined(IBM4704_CLOCK_BIT)) -# error "ibm4704 clock pin configuration is required in config.h" -#endif - -#if !(defined(IBM4704_DATA_PORT) && \ - defined(IBM4704_DATA_PIN) && \ - defined(IBM4704_DATA_DDR) && \ - defined(IBM4704_DATA_BIT)) -# error "ibm4704 data pin configuration is required in config.h" -#endif - - -/*-------------------------------------------------------------------- - * static functions - *------------------------------------------------------------------*/ -static inline void clock_lo(void) -{ - IBM4704_CLOCK_PORT &= ~(1< - : 0:display only 1:display+yes/no button 2:keyboard only 3:none -SET BT SSP 2 1 # 2:keyboard only 1:Man-in-the-middle protection is needed -SET BT SSP 2 0 # 2:keyboard only 0:Man-in-the-middle protection is not needed - - -SET BT SSP 2 1 - bond only if MITM protection is supported by host -SET BT SSP 2 0 - bond even if MITM protection is not supported by host - -On Windows 'Add device' causes SSP PASSKEY event on iWRAP - SSP PASSKEY 78:dd:08:b7:e4:a2 ? - -If device has display(0 or 1) this event occurs. User should be shown this code on the device. - SSP CONFIRM 78:dd:08:b7:e4:a2 517572 - - -SET BT SSP 3 0 - No input/output, No MITM protection. - Without procedure of authentication the divice is bond to host. - - -Connect -======= -CALL 78:dd:08:b7:e4:a2 11 HID - - -Setting -======== -Following settings need to be done before wiring into keyboard. -- UART speed: 38400bps(115200bps didn't work with software serial) -- No SSP procedure(without MITM protection) -- No Power Saving - -# clear pairing record and set default -SET BT PAIR * -SET RESET - -SET CONTROL INIT SET CONTROL MUX 0 -SET CONTROL BAUD 38400,8n1 -SET BT NAME TMK Blootooth WT12 -SET BT CLASS 0005c0 -SET BT AUTH * 0000 -SET BT SSP 3 0 -SET CONTROL CONFIG 4800 -SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12) -SET PROFILE SPP - -# power saving? -SET BT SNIFF 100 20 1 8 - - -# Report Descriptor -# combo keyboard + mouse + consumer -HID SET d2 05010906a1010507850119e029e715002501750195088102950175088101950575010508850119012905910295017503910395067508150025650507190029658100c005010902a1010901a1008502050919012908150025017501950881020501093009311581257f750895028106093895018106050c0a380295018106c0c0050c0901a1018503050c1500250109e909ea09e209cd19b529b87501950881020a8a010a21020a2a021a23022a27027501950881020a83010a96010a92010a9e010a94010a060209b209b4750195088102c0 - - - -SET PROFILE HID ---------------- - SET PROFILE HID 0d c0 100 0 en 0409 HHKB pro Bluetooth keyboard - {function bit} uint8 - {subclass} uint8 - {version} uint16 - {country} uint8 - {BTlang} char[2] - {USBlang} uint16 - {name} string - - -SET BT CLASS ------------- - See Class of Device - composite device: keyboard and mouse - SET BT CLASS 005c0 - - - - - - ----------- -after setting ----------- -set -SET BT BDADDR 00:07:80:47:22:14 -SET BT NAME TMK Blootooth WT12 -SET BT CLASS 0005c0 -SET BT AUTH * 0000 -SET BT IDENT BT:47 f000 5.0.1 Bluegiga iWRAP -SET BT LAP 9e8b33 -SET BT PAGEMODE 4 2000 1 -SET BT PAIR 78:dd:08:b7:e4:a2 9e3d85c91bcae73fef8cc10bec18b42f -SET BT POWER 3 3 3 -SET BT ROLE 0 f 7d00 -SET BT SNIFF 0 20 1 8 -SET BT SSP 3 0 -SET BT MTU 667 -SET CONTROL BAUD 38400,8n1 -SET CONTROL CD 00 0 -SET CONTROL ECHO 7 -SET CONTROL ESCAPE 43 00 1 -SET CONTROL GAIN 0 5 -SET CONTROL INIT SET CONTROL MUX 0 -SET CONTROL MSC DTE 00 00 00 00 00 00 -SET CONTROL MUX 1 -SET CONTROL PIO 00 00 -SET CONTROL READY 00 -SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12) -SET - -set control config list -SET CONTROL CONFIG 0000 0000 0000 4900 KLUDGE INTERACTIVE_PIN UART_LATENCY - - -info config -WRAP THOR AI (5.0.1 build 620) -Copyright (c) 2003-2012 Bluegiga Technologies Inc. -Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31 - BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP MDP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME - - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1) - - Bluetooth version 3.0, Power class 2 - - Loader 8615, firmware 8825 (56-bit encryption), native execution mode - - up 0 days, 01:50, 2 connections (pool 2) - - User configuration: -&028d = 0001 -&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000 -&0298 = c053 -&0299 = 0000 0000 -&02a3 = 0030 0030 0030 0030 -&02a4 = 009d 0000 -&02a5 = 0053 0045 0054 0020 0043 004f 004e 0054 0052 004f 004c 0020 004d 0055 0058 0020 0030 -&02a7 = 0000 05c0 -&02a8 = 0800 0000 0000 0000 -&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000 -&02ad = 4d54 204b 6c42 6f6f 6f74 746f 2068 5457 3231 -&02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5 -&02b3 = 0004 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0005 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0005 -&02b7 = 000f 00c0 0100 0000 0065 006e 0409 4d54 204b 6c42 6575 6f74 746f &02bb = 8000 -READY. ----------- - - - ------ -After 5.0.1 Firmware update -Firmware: ai-5.0.1-620-25b.bc4.dfu -PSR: wt12-a.ai-5.0.1-620-25b.psrf ------ -info config -WRAP THOR AI (5.0.1 build 620) -Copyright (c) 2003-2012 Bluegiga Technologies Inc. -Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31 - BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP MDP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME - - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1) - - Bluetooth version 3.0, Power class 2 - - Loader 8615, firmware 8825 (56-bit encryption), native execution mode - - up 0 days, 00:03, 0 connections (pool 1) - - User configuration: -&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000 -&0299 = 0000 0000 -&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000 -&02ad = 5457 3231 412d -&02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5 -READY. - -set -SET BT BDADDR 00:07:80:47:22:14 -SET BT NAME WT12-A -SET BT CLASS 001f00 -SET BT IDENT BT:47 f000 5.0.1 Bluegiga iWRAP -SET BT LAP 9e8b33 -SET BT PAGEMODE 4 2000 1 -SET BT PAIR 78:dd:08:b7:e4:a2 af18f81faa107e6dd068762ef921f48b -SET BT POWER 3 3 3 -SET BT ROLE 0 f 7d00 -SET BT SNIFF 0 20 1 8 -SET BT SSP 3 0 -SET BT MTU 667 -SET CONTROL BAUD 115200,8n1 -SET CONTROL CD 00 0 -SET CONTROL ECHO 7 -SET CONTROL ESCAPE 43 00 1 -SET CONTROL GAIN 0 5 -SET CONTROL MSC DTE 00 00 00 00 00 00 -SET CONTROL PIO 00 00 -SET CONTROL READY 00 -SET PROFILE SPP Bluetooth Serial Port -SET - -set control config list -SET CONTROL CONFIG 0000 0000 0000 0100 KLUDGE ---------- diff --git a/protocol/iwrap/iwrap.c b/protocol/iwrap/iwrap.c deleted file mode 100644 index 6a404116a1..0000000000 --- a/protocol/iwrap/iwrap.c +++ /dev/null @@ -1,469 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -/* host driver for Bulegiga iWRAP */ -/* Bluegiga BT12 - * Connections - * Hardware UART Software UART BlueTooth - * PC=====UART=======AVR=====SUART====iWRAP(BT12)-----------PC - * - * - Hardware UART for Debug Console to communicate iWRAP - * - Software UART for iWRAP control to send keyboard/mouse data - */ - -#include -#include -#include -#include -#include "keycode.h" -#include "suart.h" -#include "uart.h" -#include "report.h" -#include "host_driver.h" -#include "iwrap.h" -#include "print.h" - - -/* iWRAP MUX mode utils. 3.10 HID raw mode(iWRAP_HID_Application_Note.pdf) */ -#define MUX_HEADER(LINK, LENGTH) do { \ - xmit(0xbf); /* SOF */ \ - xmit(LINK); /* Link */ \ - xmit(0x00); /* Flags */ \ - xmit(LENGTH); /* Length */ \ -} while (0) -#define MUX_FOOTER(LINK) xmit(LINK^0xff) - - -static uint8_t connected = 0; -//static uint8_t channel = 1; - -/* iWRAP buffer */ -#define MUX_BUF_SIZE 64 -static char buf[MUX_BUF_SIZE]; -static uint8_t snd_pos = 0; - -#define MUX_RCV_BUF_SIZE 256 -static char rcv_buf[MUX_RCV_BUF_SIZE]; -static uint8_t rcv_head = 0; -static uint8_t rcv_tail = 0; - - -/* receive buffer */ -static void rcv_enq(char c) -{ - uint8_t next = (rcv_head + 1) % MUX_RCV_BUF_SIZE; - if (next != rcv_tail) { - rcv_buf[rcv_head] = c; - rcv_head = next; - } -} - -static char rcv_deq(void) -{ - char c = 0; - if (rcv_head != rcv_tail) { - c = rcv_buf[rcv_tail++]; - rcv_tail %= MUX_RCV_BUF_SIZE; - } - return c; -} - -/* -static char rcv_peek(void) -{ - if (rcv_head == rcv_tail) - return 0; - return rcv_buf[rcv_tail]; -} -*/ - -static void rcv_clear(void) -{ - rcv_tail = rcv_head = 0; -} - -/* iWRAP response */ -ISR(PCINT1_vect, ISR_BLOCK) // recv() runs away in case of ISR_NOBLOCK -{ - if ((SUART_IN_PIN & (1<mods); - xmit(0x00); // reserved byte(always 0) - xmit(report->keys[0]); - xmit(report->keys[1]); - xmit(report->keys[2]); - xmit(report->keys[3]); - xmit(report->keys[4]); - xmit(report->keys[5]); - MUX_FOOTER(0x01); -} - -static void send_mouse(report_mouse_t *report) -{ -#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) - if (!iwrap_connected() && !iwrap_check_connection()) return; - MUX_HEADER(0x01, 0x09); - // HID raw mode header - xmit(0x9f); - xmit(0x07); // Length - xmit(0xa1); // DATA(Input) - xmit(0x02); // Report ID - xmit(report->buttons); - xmit(report->x); - xmit(report->y); - xmit(report->v); - xmit(report->h); - MUX_FOOTER(0x01); -#endif -} - -static void send_system(uint16_t data) -{ - /* not supported */ -} - -static void send_consumer(uint16_t data) -{ -#ifdef EXTRAKEY_ENABLE - static uint16_t last_data = 0; - uint8_t bits1 = 0; - uint8_t bits2 = 0; - uint8_t bits3 = 0; - - if (!iwrap_connected() && !iwrap_check_connection()) return; - if (data == last_data) return; - last_data = data; - - // 3.10 HID raw mode(iWRAP_HID_Application_Note.pdf) - switch (data) { - case AUDIO_VOL_UP: - bits1 = 0x01; - break; - case AUDIO_VOL_DOWN: - bits1 = 0x02; - break; - case AUDIO_MUTE: - bits1 = 0x04; - break; - case TRANSPORT_PLAY_PAUSE: - bits1 = 0x08; - break; - case TRANSPORT_NEXT_TRACK: - bits1 = 0x10; - break; - case TRANSPORT_PREV_TRACK: - bits1 = 0x20; - break; - case TRANSPORT_STOP: - bits1 = 0x40; - break; - case TRANSPORT_EJECT: - bits1 = 0x80; - break; - case AL_EMAIL: - bits2 = 0x01; - break; - case AC_SEARCH: - bits2 = 0x02; - break; - case AC_BOOKMARKS: - bits2 = 0x04; - break; - case AC_HOME: - bits2 = 0x08; - break; - case AC_BACK: - bits2 = 0x10; - break; - case AC_FORWARD: - bits2 = 0x20; - break; - case AC_STOP: - bits2 = 0x40; - break; - case AC_REFRESH: - bits2 = 0x80; - break; - case AL_CC_CONFIG: - bits3 = 0x01; - break; - case AL_CALCULATOR: - bits3 = 0x04; - break; - case AL_LOCK: - bits3 = 0x08; - break; - case AL_LOCAL_BROWSER: - bits3 = 0x10; - break; - case AC_MINIMIZE: - bits3 = 0x20; - break; - case TRANSPORT_RECORD: - bits3 = 0x40; - break; - case TRANSPORT_REWIND: - bits3 = 0x80; - break; - } - - MUX_HEADER(0x01, 0x07); - xmit(0x9f); - xmit(0x05); // Length - xmit(0xa1); // DATA(Input) - xmit(0x03); // Report ID - xmit(bits1); - xmit(bits2); - xmit(bits3); - MUX_FOOTER(0x01); -#endif -} diff --git a/protocol/iwrap/iwrap.h b/protocol/iwrap/iwrap.h deleted file mode 100644 index ffaad9395d..0000000000 --- a/protocol/iwrap/iwrap.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef IWRAP_H -#define IWRAP_H - -#include -#include -#include "host_driver.h" - - -/* enable iWRAP MUX mode */ -#define MUX_MODE - - -host_driver_t *iwrap_driver(void); - -void iwrap_init(void); -void iwrap_send(const char *s); -void iwrap_mux_send(const char *s); -void iwrap_buf_send(void); -void iwrap_buf_add(uint8_t c); -void iwrap_buf_del(void); - -void iwrap_call(void); -void iwrap_kill(void); -void iwrap_unpair(void); -void iwrap_sleep(void); -void iwrap_sniff(void); -void iwrap_subrate(void); -bool iwrap_failed(void); -uint8_t iwrap_connected(void); -uint8_t iwrap_check_connection(void); - -#endif diff --git a/protocol/iwrap/main.c b/protocol/iwrap/main.c deleted file mode 100644 index 3abdce8dfc..0000000000 --- a/protocol/iwrap/main.c +++ /dev/null @@ -1,376 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include -#include -#include -//#include -#include "wd.h" // in order to use watchdog in interrupt mode -#include -#include -#include -#include "keyboard.h" -#include "matrix.h" -#include "host.h" -#include "action.h" -#include "iwrap.h" -#ifdef PROTOCOL_VUSB -# include "vusb.h" -# include "usbdrv.h" -#endif -#include "uart.h" -#include "suart.h" -#include "timer.h" -#include "debug.h" -#include "keycode.h" -#include "command.h" - - -static void sleep(uint8_t term); -static bool console(void); -static bool console_command(uint8_t c); -static uint8_t key2asc(uint8_t key); - - -/* -static void set_prr(void) -{ - power_adc_disable(); - power_spi_disable(); - power_twi_disable(); -#ifndef TIMER_H - //power_timer0_disable(); // used in timer.c -#endif - power_timer1_disable(); - power_timer2_disable(); -} -*/ - -/* -static void pullup_pins(void) -{ - // DDRs are set to 0(input) by default. -#ifdef PORTA - PORTA = 0xFF; -#endif - PORTB = 0xFF; - PORTC = 0xFF; - PORTD = 0xFF; -#ifdef PORTE - PORTE = 0xFF; -#endif -#ifdef PORTE - PORTF = 0xFF; -#endif -} -*/ - - -#ifdef PROTOCOL_VUSB -static void disable_vusb(void) -{ - // disable interrupt & disconnect to prevent host from enumerating - USB_INTR_ENABLE &= ~(1 << USB_INTR_ENABLE_BIT); - usbDeviceDisconnect(); -} - -static void enable_vusb(void) -{ - USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); - usbDeviceConnect(); -} - -static void init_vusb(void) -{ - uint8_t i = 0; - - usbInit(); - disable_vusb(); - /* fake USB disconnect for > 250 ms */ - while(--i){ - _delay_ms(1); - } - enable_vusb(); -} -#endif - -void change_driver(host_driver_t *driver) -{ - /* - host_clear_keyboard_report(); - host_swap_keyboard_report(); - host_clear_keyboard_report(); - host_send_keyboard_report(); - */ - clear_keyboard(); - _delay_ms(1000); - host_set_driver(driver); -} - - -static bool sleeping = false; -static bool insomniac = false; // TODO: should be false for power saving -static uint16_t last_timer = 0; - -int main(void) -{ - MCUSR = 0; - clock_prescale_set(clock_div_1); - WD_SET(WD_OFF); - - // power saving: the result is worse than nothing... why? - //pullup_pins(); - //set_prr(); - -#ifdef PROTOCOL_VUSB - disable_vusb(); -#endif - uart_init(115200); - keyboard_init(); - print("\nSend BREAK for UART Console Commands.\n"); - - // TODO: move to iWRAP/suart file - print("suart init\n"); - // suart init - // PC4: Tx Output IDLE(Hi) - PORTC |= (1<<4); - DDRC |= (1<<4); - // PC5: Rx Input(pull-up) - PORTC |= (1<<5); - DDRC &= ~(1<<5); - // suart receive interrut(PC5/PCINT13) - PCMSK1 = 0b00100000; - PCICR = 0b00000010; - - host_set_driver(iwrap_driver()); - - print("iwrap_init()\n"); - iwrap_init(); - iwrap_call(); - - last_timer = timer_read(); - while (true) { -#ifdef PROTOCOL_VUSB - if (host_get_driver() == vusb_driver()) - usbPoll(); -#endif - keyboard_task(); -#ifdef PROTOCOL_VUSB - if (host_get_driver() == vusb_driver()) - vusb_transfer_keyboard(); -#endif - // TODO: depricated - if (matrix_is_modified() || console()) { - last_timer = timer_read(); - sleeping = false; - } else if (!sleeping && timer_elapsed(last_timer) > 4000) { - sleeping = true; - iwrap_check_connection(); - } - - // TODO: suspend.h - if (host_get_driver() == iwrap_driver()) { - if (sleeping && !insomniac) { - _delay_ms(1); // wait for UART to send - iwrap_sleep(); - sleep(WDTO_60MS); - } - } - } -} - -static void sleep(uint8_t term) -{ - WD_SET(WD_IRQ, term); - - cli(); - set_sleep_mode(SLEEP_MODE_PWR_DOWN); - sleep_enable(); - sleep_bod_disable(); - sei(); - sleep_cpu(); - sleep_disable(); - - WD_SET(WD_OFF); -} - -static bool console(void) -{ - // Send to Bluetoot module WT12 - static bool breaked = false; - if (!uart_available()) - return false; - else { - uint8_t c; - c = uart_getchar(); - uart_putchar(c); - switch (c) { - case 0x00: // BREAK signal - if (!breaked) { - print("break(? for help): "); - breaked = true; - } - break; - case '\r': - uart_putchar('\n'); - iwrap_buf_send(); - break; - case '\b': - iwrap_buf_del(); - break; - default: - if (breaked) { - print("\n"); - console_command(c); - breaked = false; - } else { - iwrap_buf_add(c); - } - break; - } - return true; - } -} - -bool command_extra(uint8_t code) -{ - return console_command(key2asc(code)); -} - -static bool console_command(uint8_t c) -{ - switch (c) { - case 'h': - case '?': - print("\nCommands for Bluetooth(WT12/iWRAP):\n"); - print("r: reset. software reset by watchdog\n"); - print("i: insomniac. prevent KB from sleeping\n"); - print("c: iwrap_call. CALL for BT connection.\n"); -#ifdef PROTOCOL_VUSB - print("u: USB mode. switch to USB.\n"); - print("w: BT mode. switch to Bluetooth.\n"); -#endif - print("k: kill first connection.\n"); - print("Del: unpair first pairing.\n"); - print("\n"); - return 0; - case 'r': - print("reset\n"); - WD_AVR_RESET(); - return 1; - case 'i': - insomniac = !insomniac; - if (insomniac) - print("insomniac\n"); - else - print("not insomniac\n"); - return 1; - case 'c': - print("iwrap_call()\n"); - iwrap_call(); - return 1; -#ifdef PROTOCOL_VUSB - case 'u': - print("USB mode\n"); - init_vusb(); - change_driver(vusb_driver()); - //iwrap_kill(); - //iwrap_sleep(); - // disable suart receive interrut(PC5/PCINT13) - PCMSK1 &= ~(0b00100000); - PCICR &= ~(0b00000010); - return 1; - case 'w': - print("iWRAP mode\n"); - change_driver(iwrap_driver()); - disable_vusb(); - // enable suart receive interrut(PC5/PCINT13) - PCMSK1 |= 0b00100000; - PCICR |= 0b00000010; - return 1; -#endif - case 'k': - print("kill\n"); - iwrap_kill(); - return 1; - case 0x7F: // DELETE - print("unpair\n"); - iwrap_unpair(); - return 1; - } - return 0; -} - -// convert keycode into ascii charactor -static uint8_t key2asc(uint8_t key) -{ - switch (key) { - case KC_A: return 'a'; - case KC_B: return 'b'; - case KC_C: return 'c'; - case KC_D: return 'd'; - case KC_E: return 'e'; - case KC_F: return 'f'; - case KC_G: return 'g'; - case KC_H: return 'h'; - case KC_I: return 'i'; - case KC_J: return 'j'; - case KC_K: return 'k'; - case KC_L: return 'l'; - case KC_M: return 'm'; - case KC_N: return 'n'; - case KC_O: return 'o'; - case KC_P: return 'p'; - case KC_Q: return 'q'; - case KC_R: return 'r'; - case KC_S: return 's'; - case KC_T: return 't'; - case KC_U: return 'u'; - case KC_V: return 'v'; - case KC_W: return 'w'; - case KC_X: return 'x'; - case KC_Y: return 'y'; - case KC_Z: return 'z'; - case KC_1: return '1'; - case KC_2: return '2'; - case KC_3: return '3'; - case KC_4: return '4'; - case KC_5: return '5'; - case KC_6: return '6'; - case KC_7: return '7'; - case KC_8: return '8'; - case KC_9: return '9'; - case KC_0: return '0'; - case KC_ENTER: return '\n'; - case KC_ESCAPE: return 0x1B; - case KC_BSPACE: return '\b'; - case KC_TAB: return '\t'; - case KC_SPACE: return ' '; - case KC_MINUS: return '-'; - case KC_EQUAL: return '='; - case KC_LBRACKET: return '['; - case KC_RBRACKET: return ']'; - case KC_BSLASH: return '\\'; - case KC_NONUS_HASH: return '\\'; - case KC_SCOLON: return ';'; - case KC_QUOTE: return '\''; - case KC_GRAVE: return '`'; - case KC_COMMA: return ','; - case KC_DOT: return '.'; - case KC_SLASH: return '/'; - default: return 0x00; - } -} diff --git a/protocol/iwrap/mux_exit.rb b/protocol/iwrap/mux_exit.rb deleted file mode 100644 index 1f6be48afd..0000000000 --- a/protocol/iwrap/mux_exit.rb +++ /dev/null @@ -1,7 +0,0 @@ -# -# Rescue from Bluegiga iWRAP MUX mode -# 6.75 of iWRAP5_User_Guid.pdf -# -[0xBF, 0xFF, 0x00, 0x11, 0x53, 0x45, 0x54, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x4f, 0x4c, 0x20, 0x4d, 0x55, 0x58, 0x20, 0x30, 0x00].each do |x| - print x.chr -end diff --git a/protocol/iwrap/suart.S b/protocol/iwrap/suart.S deleted file mode 100644 index 1b02909638..0000000000 --- a/protocol/iwrap/suart.S +++ /dev/null @@ -1,156 +0,0 @@ -;---------------------------------------------------------------------------; -; Software implemented UART module ; -; (C)ChaN, 2005 (http://elm-chan.org/) ; -;---------------------------------------------------------------------------; -; Bit rate settings: -; -; 1MHz 2MHz 4MHz 6MHz 8MHz 10MHz 12MHz 16MHz 20MHz -; 2.4kbps 138 - - - - - - - - -; 4.8kbps 68 138 - - - - - - - -; 9.6kbps 33 68 138 208 - - - - - -; 19.2kbps - 33 68 102 138 173 208 - - -; 38.4kbps - - 33 50 68 85 102 138 172 -; 57.6kbps - - 21 33 44 56 68 91 114 -; 115.2kbps - - - - 21 27 33 44 56 - -.nolist -#include -.list - -#define BPS 102 /* Bit delay. (see above table) */ -#define BIDIR 0 /* 0:Separated Tx/Rx, 1:Shared Tx/Rx */ - -#define OUT_1 sbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 1 */ -#define OUT_0 cbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 0 */ -#define SKIP_IN_1 sbis _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 1 */ -#define SKIP_IN_0 sbic _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 0 */ - - - -#ifdef SPM_PAGESIZE -.macro _LPMI reg - lpm \reg, Z+ -.endm -.macro _MOVW dh,dl, sh,sl - movw \dl, \sl -.endm -#else -.macro _LPMI reg - lpm - mov \reg, r0 - adiw ZL, 1 -.endm -.macro _MOVW dh,dl, sh,sl - mov \dl, \sl - mov \dh, \sh -.endm -#endif - - - -;---------------------------------------------------------------------------; -; Transmit a byte in serial format of N81 -; -;Prototype: void xmit (uint8_t data); -;Size: 16 words - -.global xmit -.func xmit -xmit: -#if BIDIR - ldi r23, BPS-1 ;Pre-idle time for bidirectional data line -5: dec r23 ; - brne 5b ;/ -#endif - in r0, _SFR_IO_ADDR(SREG) ;Save flags - - com r24 ;C = start bit - ldi r25, 10 ;Bit counter - cli ;Start critical section - -1: ldi r23, BPS-1 ;----- Bit transferring loop -2: dec r23 ;Wait for a bit time - brne 2b ;/ - brcs 3f ;MISO = bit to be sent - OUT_1 ; -3: brcc 4f ; - OUT_0 ;/ -4: lsr r24 ;Get next bit into C - dec r25 ;All bits sent? - brne 1b ; no, coutinue - - out _SFR_IO_ADDR(SREG), r0 ;End of critical section - ret -.endfunc - - - -;---------------------------------------------------------------------------; -; Receive a byte -; -;Prototype: uint8_t rcvr (void); -;Size: 19 words - -.global rcvr -.func rcvr -rcvr: - in r0, _SFR_IO_ADDR(SREG) ;Save flags - - ldi r24, 0x80 ;Receiving shift reg - cli ;Start critical section - -1: SKIP_IN_1 ;Wait for idle - rjmp 1b -2: SKIP_IN_0 ;Wait for start bit - rjmp 2b - ldi r25, BPS/2 ;Wait for half bit time -3: dec r25 - brne 3b - -4: ldi r25, BPS ;----- Bit receiving loop -5: dec r25 ;Wait for a bit time - brne 5b ;/ - lsr r24 ;Next bit - SKIP_IN_0 ;Get a data bit into r24.7 - ori r24, 0x80 - brcc 4b ;All bits received? no, continue - - out _SFR_IO_ADDR(SREG), r0 ;End of critical section - ret -.endfunc - - -; Not wait for start bit. This should be called after detecting start bit. -.global recv -.func recv -recv: - in r0, _SFR_IO_ADDR(SREG) ;Save flags - - ldi r24, 0x80 ;Receiving shift reg - cli ;Start critical section - -;1: SKIP_IN_1 ;Wait for idle -; rjmp 1b -;2: SKIP_IN_0 ;Wait for start bit -; rjmp 2b - ldi r25, BPS/2 ;Wait for half bit time -3: dec r25 - brne 3b - -4: ldi r25, BPS ;----- Bit receiving loop -5: dec r25 ;Wait for a bit time - brne 5b ;/ - lsr r24 ;Next bit - SKIP_IN_0 ;Get a data bit into r24.7 - ori r24, 0x80 - brcc 4b ;All bits received? no, continue - - ldi r25, BPS/2 ;Wait for half bit time -6: dec r25 - brne 6b -7: SKIP_IN_1 ;Wait for stop bit - rjmp 7b - - out _SFR_IO_ADDR(SREG), r0 ;End of critical section - ret -.endfunc diff --git a/protocol/iwrap/suart.h b/protocol/iwrap/suart.h deleted file mode 100644 index 72725b998f..0000000000 --- a/protocol/iwrap/suart.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SUART -#define SUART - -void xmit(uint8_t); -uint8_t rcvr(void); -uint8_t recv(void); - -#endif /* SUART */ diff --git a/protocol/iwrap/wd.h b/protocol/iwrap/wd.h deleted file mode 100644 index 99058f0331..0000000000 --- a/protocol/iwrap/wd.h +++ /dev/null @@ -1,159 +0,0 @@ -/* This is from http://www.mtcnet.net/~henryvm/wdt/ */ -#ifndef _AVR_WD_H_ -#define _AVR_WD_H_ - -#include - -/* -Copyright (c) 2009, Curt Van Maanen - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - -include usage- - #include "wd.h" //if in same directory as project - #include //if wd.h is in avr directory - -set watchdog modes and prescale - -usage- - WD_SET(mode,[timeout]); //prescale always set - -modes- - WD_OFF disabled - WD_RST normal reset mode - WD_IRQ interrupt only mode (if supported) - WD_RST_IRQ interrupt+reset mode (if supported) - -timeout- - WDTO_15MS default if no timeout provided - WDTO_30MS - WDTO_60MS - WDTO_120MS - WDTO_250MS - WDTO_500MS - WDTO_1S - WDTO_2S - WDTO_4S (if supported) - WDTO_8S (if supported) - -examples- - WD_SET(WD_RST,WDTO_1S); //reset mode, 1s timeout - WD_SET(WD_OFF); //watchdog disabled (if not fused on) - WD_SET(WD_RST); //reset mode, 15ms (default timeout) - WD_SET(WD_IRQ,WDTO_120MS); //interrupt only mode, 120ms timeout - WD_SET(WD_RST_IRQ,WDTO_2S); //interrupt+reset mode, 2S timeout - - -for enhanced watchdogs, if the watchdog is not being used WDRF should be -cleared on every power up or reset, along with disabling the watchdog- - WD_DISABLE(); //clear WDRF, then turn off watchdog - -*/ - -//reset registers to the same name (MCUCSR) -#if !defined(MCUCSR) -#define MCUCSR MCUSR -#endif - -//watchdog registers to the same name (WDTCSR) -#if !defined(WDTCSR) -#define WDTCSR WDTCR -#endif - -//if enhanced watchdog, define irq values, create disable macro -#if defined(WDIF) -#define WD_IRQ 0xC0 -#define WD_RST_IRQ 0xC8 -#define WD_DISABLE() do{ \ - MCUCSR &= ~(1< -#include -#include - -/* References to the binary EEPROM data linked in the AVR's FLASH memory space */ -extern const char _binary_InputEEData_bin_start[]; -extern const char _binary_InputEEData_bin_end[]; -extern const char _binary_InputEEData_bin_size[]; - -/* Friendly names for the embedded binary data stored in FLASH memory space */ -#define InputEEData _binary_InputEEData_bin_start -#define InputEEData_size ((int)_binary_InputEEData_bin_size) - -int main(void) -{ - /* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */ - for (uint16_t i = 0; i < InputEEData_size; i++) - eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i])); - - /* Infinite loop once complete */ - for (;;); -} diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile b/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile deleted file mode 100644 index f6dcbea677..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile +++ /dev/null @@ -1,40 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# -------------------------------------- -# LUFA Project Makefile. -# -------------------------------------- - -MCU = at90usb1287 -ARCH = AVR8 -F_CPU = 1000000 -F_USB = $(F_CPU) -OPTIMIZATION = s -TARGET = HID_EEPROM_Loader -SRC = $(TARGET).c -LUFA_PATH = ../../../LUFA -CC_FLAGS = -LD_FLAGS = -OBJECT_FILES = InputEEData.o - -# Default target -all: - -# Determine the AVR sub-architecture of the build main application object file -FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1) - -# Create a linkable object file with the input binary EEPROM data stored in the FLASH section -InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST) - @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\" - avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@ - -# Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa_core.mk -include $(LUFA_PATH)/Build/lufa_build.mk -include $(LUFA_PATH)/Build/lufa_cppcheck.mk -include $(LUFA_PATH)/Build/lufa_doxygen.mk -include $(LUFA_PATH)/Build/lufa_hid.mk diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk deleted file mode 100644 index 4e15e3997a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk +++ /dev/null @@ -1,101 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += ATPROGRAM -LUFA_BUILD_TARGETS += atprogram atprogram-ee -LUFA_BUILD_MANDATORY_VARS += MCU TARGET -LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA ATPROGRAM Programmer Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to re-program a device using the Atmel atprogram -# utility in AVR Studio 5.x and Atmel Studio 6.0 onwards. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# atprogram - Program target FLASH with application using -# atprogram -# atprogram-ee - Program target EEPROM with application data -# using atprogram -# -# MANDATORY PARAMETERS: -# -# MCU - Microcontroller device model name -# TARGET - Application name -# -# OPTIONAL PARAMETERS: -# -# ATPROGRAM_PROGRAMMER - Name of programming hardware to use -# ATPROGRAM_INTERFACE - Name of programming interface to use -# ATPROGRAM_PORT - Name of communication port to use -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Default values of optionally user-supplied variables -ATPROGRAM_PROGRAMMER ?= jtagice3 -ATPROGRAM_INTERFACE ?= jtag -ATPROGRAM_PORT ?= - -# Sanity check user supplied values -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, MCU) -$(call ERROR_IF_EMPTY, TARGET) -$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER) -$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE) - -# Output Messages -MSG_ATPROGRAM_CMD := ' [ATPRGRM] :' - -# Construct base atprogram command flags -BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU) -ifneq ($(ATPROGRAM_PORT),) - BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT) -endif - -# Construct the flags to use for the various memory spaces -ifeq ($(ARCH), AVR8) - ATPROGRAM_FLASH_FLAGS := --chiperase --flash - ATPROGRAM_EEPROM_FLAGS := --eeprom -else ifeq ($(ARCH), XMEGA) - ATPROGRAM_FLASH_FLAGS := --erase --flash - ATPROGRAM_EEPROM_FLAGS := --eeprom -else ifeq ($(ARCH), UC3) - ATPROGRAM_FLASH_FLAGS := --erase - ATPROGRAM_EEPROM_FLAGS := --eeprom -else - $(error Unsupported architecture "$(ARCH)") -endif - -atprogram: $(TARGET).elf $(MAKEFILE_LIST) - @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\" - atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $< - -atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST) - @echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\" - atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $< - -# Phony build targets for this module -.PHONY: atprogram atprogram-ee diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk deleted file mode 100644 index 839362528c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk +++ /dev/null @@ -1,84 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += AVRDUDE -LUFA_BUILD_TARGETS += avrdude avrdude-ee -LUFA_BUILD_MANDATORY_VARS += MCU TARGET -LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA AVRDUDE Programmer Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to re-program a device using the open source -# avr-dude utility. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# avrdude - Program target FLASH with application using -# avrdude -# avrdude-ee - Program target EEPROM with application data -# using avrdude -# -# MANDATORY PARAMETERS: -# -# MCU - Microcontroller device model name -# TARGET - Application name -# -# OPTIONAL PARAMETERS: -# -# AVRDUDE_PROGRAMMER - Name of programming hardware to use -# AVRDUDE_PORT - Name of communication port to use -# AVRDUDE_FLAGS - Flags to pass to avr-dude -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Default values of optionally user-supplied variables -AVRDUDE_PROGRAMMER ?= jtagicemkii -AVRDUDE_PORT ?= usb -AVRDUDE_FLAGS ?= - -# Sanity check user supplied values -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, MCU) -$(call ERROR_IF_EMPTY, TARGET) -$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER) -$(call ERROR_IF_EMPTY, AVRDUDE_PORT) - -# Output Messages -MSG_AVRDUDE_CMD := ' [AVRDUDE] :' - -# Construct base avrdude command flags -BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) - -avrdude: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" - avrdude $(BASE_AVRDUDE_FLAGS) -U flash:w:$< $(AVRDUDE_FLAGS) - -avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\" - avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS) - -# Phony build targets for this module -.PHONY: avrdude avrdude-ee diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk deleted file mode 100644 index 8788606270..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk +++ /dev/null @@ -1,296 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += BUILD -LUFA_BUILD_TARGETS += size check-source symbol-sizes all lib elf hex lss clean mostlyclean -LUFA_BUILD_MANDATORY_VARS += TARGET ARCH MCU SRC F_USB LUFA_PATH -LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS OBJDIR OBJECT_FILES DEBUG_TYPE DEBUG_LEVEL -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA GCC Compiler Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to build a C, C++ and/or Assembly application -# via the AVR-GCC compiler. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# size - List built application size -# symbol-sizes - Print application symbols from the binary ELF -# file as a list sorted by size in bytes -# check-source - Print a list of SRC source files that cannot -# be found -# all - Build application and list size -# lib - Build and archive source files into a library -# elf - Build application ELF debug object file -# hex - Build application HEX object files -# lss - Build application LSS assembly listing file -# clean - Remove all project intermediatary and binary -# output files -# mostlyclean - Remove intermediatary output files, but -# preserve binaries -# -# MANDATORY PARAMETERS: -# -# TARGET - Application name -# ARCH - Device architecture name -# MCU - Microcontroller device model name -# SRC - List of input source files (*.c, *.cpp, *.S) -# F_USB - Speed of the input clock of the USB controller -# in Hz -# LUFA_PATH - Path to the LUFA library core -# -# OPTIONAL PARAMETERS: -# -# BOARD - LUFA board hardware -# OPTIMIZATION - Optimization level -# C_STANDARD - C Language Standard to use -# CPP_STANDARD - C++ Language Standard to use -# F_CPU - Speed of the CPU, in Hz -# C_FLAGS - Flags to pass to the C compiler only -# CPP_FLAGS - Flags to pass to the C++ compiler only -# ASM_FLAGS - Flags to pass to the assembler only -# CC_FLAGS - Common flags to pass to the C/C++ compiler and -# assembler -# LD_FLAGS - Flags to pass to the linker -# OBJDIR - Directory for the output object and dependency -# files; if equal to ".", the output files will -# be generated in the same folder as the sources -# OBJECT_FILES - Extra object files to link in to the binaries -# DEBUG_FORMAT - Format of the debugging information to -# generate in the compiled object files -# DEBUG_LEVEL - Level the debugging information to generate in -# the compiled object files -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Default values of optionally user-supplied variables -BOARD ?= NONE -OPTIMIZATION ?= s -F_CPU ?= -C_STANDARD ?= gnu99 -CPP_STANDARD ?= gnu++98 -C_FLAGS ?= -CPP_FLAGS ?= -ASM_FLAGS ?= -CC_FLAGS ?= -OBJDIR ?= . -OBJECT_FILES ?= -DEBUG_FORMAT ?= dwarf-2 -DEBUG_LEVEL ?= 3 - -# Sanity check user supplied values -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, MCU) -$(call ERROR_IF_EMPTY, TARGET) -$(call ERROR_IF_EMPTY, ARCH) -$(call ERROR_IF_EMPTY, F_USB) -$(call ERROR_IF_EMPTY, LUFA_PATH) -$(call ERROR_IF_EMPTY, BOARD) -$(call ERROR_IF_EMPTY, OPTIMIZATION) -$(call ERROR_IF_EMPTY, C_STANDARD) -$(call ERROR_IF_EMPTY, CPP_STANDARD) -$(call ERROR_IF_EMPTY, OBJDIR) -$(call ERROR_IF_EMPTY, DEBUG_FORMAT) -$(call ERROR_IF_EMPTY, DEBUG_LEVEL) - -# Determine the utility prefix to use for the selected architecture -ifeq ($(ARCH), AVR8) - CROSS := avr -else ifeq ($(ARCH), XMEGA) - CROSS := avr - $(warning The XMEGA device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.) -else ifeq ($(ARCH), UC3) - CROSS := avr32 - $(warning The UC3 device support is currently EXPERIMENTAL (incomplete and/or non-functional), and is included for preview purposes only.) -else - $(error Unsupported architecture "$(ARCH)") -endif - -# Output Messages -MSG_COMPILE_CMD := ' [GCC] :' -MSG_ASSEMBLE_CMD := ' [GAS] :' -MSG_NM_CMD := ' [NM] :' -MSG_REMOVE_CMD := ' [RM] :' -MSG_LINK_CMD := ' [LNK] :' -MSG_ARCHIVE_CMD := ' [AR] :' -MSG_SIZE_CMD := ' [SIZE] :' -MSG_OBJCPY_CMD := ' [OBJCPY] :' -MSG_OBJDMP_CMD := ' [OBJDMP] :' - -# Convert input source file list to differentiate them by type -C_SOURCE := $(filter %.c, $(SRC)) -CPP_SOURCE := $(filter %.cpp, $(SRC)) -ASM_SOURCE := $(filter %.S, $(SRC)) - -# Create a list of unknown source file types, if any are found throw an error -UNKNOWN_SOURCE := $(filter-out $(C_SOURCE) $(CPP_SOURCE) $(ASM_SOURCE), $(SRC)) -ifneq ($(UNKNOWN_SOURCE),) - $(error Unknown input source file formats: $(UNKNOWN_SOURCE)) -endif - -# Convert input source filenames into a list of required output object files -OBJECT_FILES += $(addsuffix .o, $(basename $(SRC))) -ifneq ($(OBJDIR),.) - $(shell mkdir $(OBJDIR) 2> /dev/null) - VPATH += $(dir $(SRC)) - OBJECT_FILES := $(addprefix $(patsubst %/,%,$(OBJDIR))/, $(notdir $(OBJECT_FILES))) - - # Check if any object file (without path) appears more than once in the object file list - ifneq ($(words $(sort $(OBJECT_FILES))), $(words $(OBJECT_FILES))) - $(error Cannot build with OBJDIR parameter set - one or more object file name is not unique) - endif -endif - -# Create a list of dependency files from the list of object files -DEPENDENCY_FILES := $(OBJECT_FILES:%.o=%.d) - -# Create a list of common flags to pass to the compiler/linker/assembler -BASE_CC_FLAGS := -pipe -g$(DEBUG_FORMAT) -g$(DEBUG_LEVEL) -ifeq ($(ARCH), AVR8) - BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct -else ifeq ($(ARCH), XMEGA) - BASE_CC_FLAGS += -mmcu=$(MCU) -fshort-enums -fno-inline-small-functions -fpack-struct -else ifeq ($(ARCH), UC3) - BASE_CC_FLAGS += -mpart=$(MCU:at32%=%) -masm-addr-pseudos -endif -BASE_CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -BASE_CC_FLAGS += -I. -I$(patsubst %/,%,$(LUFA_PATH))/.. -BASE_CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL -ifneq ($(F_CPU),) - BASE_CC_FLAGS += -DF_CPU=$(F_CPU)UL -endif - -# Additional language specific compiler flags -BASE_C_FLAGS := -x c -O$(OPTIMIZATION) -std=$(C_STANDARD) -Wstrict-prototypes -BASE_CPP_FLAGS := -x c++ -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -BASE_ASM_FLAGS := -x assembler-with-cpp - -# Create a list of flags to pass to the linker -BASE_LD_FLAGS := -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections -Wl,--relax -ifeq ($(ARCH), AVR8) - BASE_LD_FLAGS += -mmcu=$(MCU) -else ifeq ($(ARCH), XMEGA) - BASE_LD_FLAGS += -mmcu=$(MCU) -else ifeq ($(ARCH), UC3) - BASE_LD_FLAGS += -mpart=$(MCU:at32%=%) --rodata-writable --direct-data -endif - -# Determine flags to pass to the size utility based on its reported features (only invoke if size target required) -size: SIZE_MCU_FLAG := $(shell $(CROSS)-size --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) -size: SIZE_FORMAT_FLAG := $(shell $(CROSS)-size --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) - - -build_begin: - @echo "" - @echo Begin compilation of project \"$(TARGET)\"... - @echo "" - -build_end: - @echo Finished building project \"$(TARGET)\". - @echo "" - -gcc-version: - @$(CROSS)-gcc --version - -check-source: - @for f in $(SRC); do \ - if [ ! -f $$f ]; then \ - echo "Error: Source file not found: $$f"; \ - exit 1; \ - fi; \ - done - -size: $(TARGET).elf - @echo $(MSG_SIZE_CMD) Determining size of \"$<\" - @echo "" - $(CROSS)-size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $< ; 2>/dev/null; - -symbol-sizes: $(TARGET).elf - @echo $(MSG_NM_CMD) Extracting \"$<\" symbols with decimal byte sizes - $(CROSS)-nm --size-sort --demangle --radix=d $< - -mostlyclean: - @echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\" - rm -f $(OBJECT_FILES) - @echo $(MSG_REMOVE_CMD) Removing dependency files of \"$(TARGET)\" - rm -f $(DEPENDENCY_FILES) - -clean: mostlyclean - @echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\" - rm -f $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym $(TARGET).a - -all: build_begin check-source gcc-version elf hex lss sym size build_end - -lib: lib$(TARGET).a -elf: $(TARGET).elf -hex: $(TARGET).hex $(TARGET).eep -lss: $(TARGET).lss -sym: $(TARGET).sym - -$(OBJDIR)/%.o: %.c $(MAKEFILE_LIST) - @echo $(MSG_COMPILE_CMD) Compiling C file \"$(notdir $<)\" - $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_C_FLAGS) $(CC_FLAGS) $(C_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@ - -$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST) - @echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\" - $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@ - -$(OBJDIR)/%.o: %.S $(MAKEFILE_LIST) - @echo $(MSG_ASSEMBLE_CMD) Assembling \"$(notdir $<)\" - $(CROSS)-gcc -c $(BASE_CC_FLAGS) $(BASE_ASM_FLAGS) $(CC_FLAGS) $(ASM_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@ - -.PRECIOUS : $(OBJECT_FILES) -.SECONDARY : %.a -%.a: $(OBJECT_FILES) - @echo $(MSG_ARCHIVE_CMD) Archiving object files into \"$@\" - $(CROSS)-ar rcs $@ $(OBJECT_FILES) - -.PRECIOUS : $(OBJECT_FILES) -.SECONDARY : %.elf -%.elf: $(OBJECT_FILES) - @echo $(MSG_LINK_CMD) Linking object files into \"$@\" - $(CROSS)-gcc $(BASE_LD_FLAGS) $(LD_FLAGS) $^ -o $@ - -%.hex: %.elf - @echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\" - $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@ - -%.eep: %.elf - @echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\" - $(CROSS)-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex $< $@ || exit 0 - -%.lss: %.elf - @echo $(MSG_OBJDMP_CMD) Extracting LSS file data from \"$<\" - $(CROSS)-objdump -h -S -z $< > $@ - -%.sym: %.elf - @echo $(MSG_NM_CMD) Extracting SYM file data from \"$<\" - $(CROSS)-nm -n $< > $@ - -# Include build dependency files --include $(DEPENDENCY_FILES) - -# Phony build targets for this module -.PHONY: build_begin build_end gcc-version check-source size symbol-sizes lib elf hex lss clean mostlyclean diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk deleted file mode 100644 index bde1e11c96..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk +++ /dev/null @@ -1,152 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += CORE -LUFA_BUILD_TARGETS += help list_targets list_modules list_mandatory list_optional list_provided list_macros -LUFA_BUILD_MANDATORY_VARS += -LUFA_BUILD_OPTIONAL_VARS += -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA Core Build System Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of core build targets for the LUFA build system -# ----------------------------------------------------------------------------- -# TARGETS: -# -# help - Build system help -# list_targets - List all build targets -# list_modules - List all build modules -# list_mandatory - List all mandatory make variables required by -# the included build modules of the application -# list_optional - List all optional make variables required by -# the included build modules of the application -# list_provided - List all provided make variables from the -# included build modules of the application -# list_macros - List all provided make macros from the -# included build modules of the application -# -# MANDATORY PARAMETERS: -# -# (None) -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -# Build sorted and filtered lists of the included build module data -SORTED_LUFA_BUILD_MODULES = $(sort $(LUFA_BUILD_MODULES)) -SORTED_LUFA_BUILD_TARGETS = $(sort $(LUFA_BUILD_TARGETS)) -SORTED_LUFA_MANDATORY_VARS = $(sort $(LUFA_BUILD_MANDATORY_VARS)) -SORTED_LUFA_OPTIONAL_VARS = $(filter-out $(SORTED_LUFA_MANDATORY_VARS), $(sort $(LUFA_BUILD_OPTIONAL_VARS))) -SORTED_LUFA_PROVIDED_VARS = $(sort $(LUFA_BUILD_PROVIDED_VARS)) -SORTED_LUFA_PROVIDED_MACROS = $(sort $(LUFA_BUILD_PROVIDED_MACROS)) - -# Create printable versions of the sorted build module data (use "(None)" when no data is available) -PRINTABLE_LUFA_BUILD_MODULES = $(if $(strip $(SORTED_LUFA_BUILD_MODULES)), $(SORTED_LUFA_BUILD_MODULES), (None)) -PRINTABLE_LUFA_BUILD_TARGETS = $(if $(strip $(SORTED_LUFA_BUILD_TARGETS)), $(SORTED_LUFA_BUILD_TARGETS), (None)) -PRINTABLE_LUFA_MANDATORY_VARS = $(if $(strip $(SORTED_LUFA_MANDATORY_VARS)), $(SORTED_LUFA_MANDATORY_VARS), (None)) -PRINTABLE_LUFA_OPTIONAL_VARS = $(if $(strip $(SORTED_LUFA_OPTIONAL_VARS)), $(SORTED_LUFA_OPTIONAL_VARS), (None)) -PRINTABLE_LUFA_PROVIDED_VARS = $(if $(strip $(SORTED_LUFA_PROVIDED_VARS)), $(SORTED_LUFA_PROVIDED_VARS), (None)) -PRINTABLE_LUFA_PROVIDED_MACROS = $(if $(strip $(SORTED_LUFA_PROVIDED_MACROS)), $(SORTED_LUFA_PROVIDED_MACROS), (None)) - -help: - @echo "===================================================================" - @echo " LUFA Build System 2.0 " - @echo " (C) Dean Camera, 2012 { dean @ fourwalledcubicle . com } " - @echo "===================================================================" - @echo "DESCRIPTION: " - @echo " This build system is a set of makefile modules for (GNU) Make, to " - @echo " provide a simple system for building LUFA powered applications. " - @echo " Each makefile module can be included from within a user makefile, " - @echo " to expose the build rules documented in the comments at the top of" - @echo " each build module. " - @echo " " - @echo "USAGE: " - @echo " To execute a rule, define all variables indicated in the desired " - @echo " module as a required parameter before including the build module " - @echo " in your project makefile. Parameters marked as optional will " - @echo " assume a default value in the modules if not user-assigned. " - @echo " " - @echo " By default the target output shows both a friendly summary, as " - @echo " well as the actual invoked command. To suppress the output of the " - @echo " invoked commands and show only the friendly command output, run " - @echo " make with the \"-s\" switch added before the target(s). " - @echo "===================================================================" - @echo " " - @echo " Currently used build system modules in this application: " - @echo " " - @printf " %b" "$(PRINTABLE_LUFA_BUILD_MODULES:%= - %\n)" - @echo " " - @echo " " - @echo " Currently available build targets in this application: " - @echo " " - @printf " %b" "$(PRINTABLE_LUFA_BUILD_TARGETS:%= - %\n)" - @echo " " - @echo " " - @echo " Mandatory variables required by the selected build Modules: " - @echo " " - @printf " %b" "$(PRINTABLE_LUFA_MANDATORY_VARS:%= - %\n)" - @echo " " - @echo " " - @echo " Optional variables required by the selected build Modules: " - @echo " " - @printf " %b" "$(PRINTABLE_LUFA_OPTIONAL_VARS:%= - %\n)" - @echo " " - @echo " " - @echo " Variables provided by the selected build Modules: " - @echo " " - @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_VARS:%= - %\n)" - @echo " " - @echo " " - @echo " Macros provided by the selected build Modules: " - @echo " " - @printf " %b" "$(PRINTABLE_LUFA_PROVIDED_MACROS:%= - %\n)" - @echo " " - @echo "===================================================================" - @echo " The LUFA BuildSystem 2.0 - Powered By Unicorns (tm) " - @echo "===================================================================" - -list_modules: - @echo Currently Used Build System Modules: $(PRINTABLE_LUFA_BUILD_MODULES) - -list_targets: - @echo Currently Available Build Targets: $(PRINTABLE_LUFA_BUILD_TARGETS) - -list_mandatory: - @echo Mandatory Variables for Included Modules: $(PRINTABLE_LUFA_MANDATORY_VARS) - -list_optional: - @echo Optional Variables for Included Modules: $(PRINTABLE_LUFA_OPTIONAL_VARS) - -list_provided: - @echo Variables Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_VARS) - -list_macros: - @echo Macros Provided by the Included Modules: $(PRINTABLE_LUFA_PROVIDED_MACROS) - -# Disable default in-built make rules (those that are needed are explicitly -# defined, and doing so has performance benefits when recursively building) -.SUFFIXES: - -# Phony build targets for this module -.PHONY: help list_modules list_targets list_mandatory list_optional list_provided list_macros diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk deleted file mode 100644 index 1e3604c7d8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk +++ /dev/null @@ -1,104 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += CPPCHECK -LUFA_BUILD_TARGETS += cppcheck cppcheck-config -LUFA_BUILD_MANDATORY_VARS += SRC -LUFA_BUILD_OPTIONAL_VARS += CPPCHECK_INCLUDES CPPCHECK_EXCLUDES CPPCHECK_MSG_TEMPLATE CPPCHECK_ENABLE \ - CPPCHECK_SUPPRESS CPPCHECK_FAIL_ON_WARNING CPPCHECK_QUIET CPPCHECK_FLAGS -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA CPPCheck Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to scan a project with the free "cppcheck" static -# analysis tool, to check for code errors at runtime (see http://cppcheck.sourceforge.net). -# ----------------------------------------------------------------------------- -# TARGETS: -# -# cppcheck - Scan the project with CPPCheck -# cppcheck-config - Use CPPCheck to look for missing include files -# -# MANDATORY PARAMETERS: -# -# SRC - List of source files to statically analyze -# -# OPTIONAL PARAMETERS: -# -# CPPCHECK_INCLUDES - Extra include paths to search for missing -# header files -# CPPCHECK_EXCLUDES - Source file paths to exclude checking (can be -# a path fragment if desired) -# CPPCHECK_MSG_TEMPLATE - Template for cppcheck error and warning output -# CPPCHECK_ENABLE - General cppcheck category checks to enable -# CPPCHECK_SUPPRESS - Specific cppcheck warnings to disable by ID -# CPPCHECK_FAIL_ON_WARNING - Set to Y to fail the build on cppcheck -# warnings, N to continue even if warnings occur -# CPPCHECK_QUIET - Enable cppcheck verbose or quiet output mode -# CPPCHECK_FLAGS - Additional flags to pass to cppcheck -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Default values of optionally user-supplied variables -CPPCHECK_INCLUDES ?= -CPPCHECK_EXCLUDES ?= -CPPCHECK_MSG_TEMPLATE ?= {file}:{line}: {severity} ({id}): {message} -CPPCHECK_ENABLE ?= all -CPPCHECK_SUPPRESS ?= variableScope missingInclude -CPPCHECK_FAIL_ON_WARNING ?= Y -CPPCHECK_QUIET ?= Y -CPPCHECK_FLAGS ?= - -# Sanity check user supplied values -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, SRC) -$(call ERROR_IF_EMPTY, CPPCHECK_MSG_TEMPLATE) -$(call ERROR_IF_EMPTY, CPPCHECK_ENABLE) -$(call ERROR_IF_NONBOOL, CPPCHECK_FAIL_ON_WARNING) -$(call ERROR_IF_NONBOOL, CPPCHECK_QUIET) - -# Build a default argument list for cppcheck -BASE_CPPCHECK_FLAGS := --template="$(CPPCHECK_MSG_TEMPLATE)" $(CPPCHECK_INCLUDES:%=-I%) $(CPPCHECK_EXCLUDES:%=-i%) --inline-suppr --force --std=c99 - -# Sanity check parameters and construct additional command line arguments to cppcheck -ifeq ($(CPPCHECK_FAIL_ON_WARNING), Y) - BASE_CPPCHECK_FLAGS += --error-exitcode=1 -endif -ifeq ($(CPPCHECK_QUIET), Y) - BASE_CPPCHECK_FLAGS += --quiet -endif - -# Output Messages -MSG_CPPCHECK_CMD := ' [CPPCHECK]:' - -cppcheck-config: - @echo $(MSG_CPPCHECK_CMD) Checking cppcheck configuration check on source files - cppcheck $(BASE_CPPCHECK_FLAGS) --check-config $(CPPCHECK_FLAGS) $(SRC) - -cppcheck: - @echo $(MSG_CPPCHECK_CMD) Performing static analysis on source files - cppcheck $(BASE_CPPCHECK_FLAGS) --enable=$(CPPCHECK_ENABLE) $(CPPCHECK_SUPPRESS:%=--suppress=%) $(CPPCHECK_FLAGS) $(SRC) - -# Phony build targets for this module -.PHONY: cppcheck-config cppcheck diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk deleted file mode 100644 index 6bfe979428..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk +++ /dev/null @@ -1,93 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += DFU -LUFA_BUILD_TARGETS += flip flip-ee dfu dfu-ee -LUFA_BUILD_MANDATORY_VARS += MCU TARGET -LUFA_BUILD_OPTIONAL_VARS += -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA DFU Bootloader Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to re-program a device currently running a DFU -# class bootloader with a project's FLASH and EEPROM files. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# flip - Program FLASH into target via Atmel FLIP -# flip-ee - Program EEPROM into target via Atmel FLIP -# dfu - Program FLASH into target via dfu-programmer -# dfu-ee - Program EEPROM into target via dfu-programmer -# -# MANDATORY PARAMETERS: -# -# MCU - Microcontroller device model name -# TARGET - Application name -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Sanity-check values of mandatory user-supplied variables -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, MCU) -$(call ERROR_IF_EMPTY, TARGET) - -# Output Messages -MSG_COPY_CMD := ' [CP] :' -MSG_REMOVE_CMD := ' [RM] :' -MSG_DFU_CMD := ' [DFU] :' - -flip: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_DFU_CMD) Programming FLASH with batchisp using \"$<\" - batchisp -hardware usb -device $(MCU) -operation erase f - batchisp -hardware usb -device $(MCU) -operation loadbuffer $< program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - -flip-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_DFU_CMD) Copying EEP file to temporary file \"$<.hex\" - cp $< $<.hex - @echo $(MSG_DFU_CMD) Programming EEPROM with batchisp using \"$<.hex\" - batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase - batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $<.hex program - batchisp -hardware usb -device $(MCU) -operation start reset 0 - @echo $(MSG_DFU_CMD) Removing temporary file \"$<.hex\" - rm $<.hex - -dfu: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_DFU_CMD) Programming FLASH with dfu-programmer using \"$<\" - dfu-programmer $(MCU) erase - dfu-programmer $(MCU) flash $< - dfu-programmer $(MCU) reset - -dfu-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_DFU_CMD) Programming EEPROM with dfu-programmer using \"$<\" - dfu-programmer $(MCU) eeprom-flash $< - dfu-programmer $(MCU) reset - -# Phony build targets for this module -.PHONY: flip flip-ee dfu dfu-ee diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk deleted file mode 100644 index 87427fd277..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk +++ /dev/null @@ -1,81 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += DOXYGEN -LUFA_BUILD_TARGETS += doxygen -LUFA_BUILD_MANDATORY_VARS += LUFA_PATH -LUFA_BUILD_OPTIONAL_VARS += DOXYGEN_CONF DOXYGEN_FAIL_ON_WARNING DOXYGEN_OVERRIDE_PARAMS -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA Doxygen Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to automatically build Doxygen documentation for -# a project (see www.doxygen.org). -# ----------------------------------------------------------------------------- -# TARGETS: -# -# doxygen - Build Doxygen Documentation -# -# MANDATORY PARAMETERS: -# -# LUFA_PATH - Path to the LUFA library core -# -# OPTIONAL PARAMETERS: -# -# DOXYGEN_CONF - Doxygen configuration filename -# DOXYGEN_FAIL_ON_WARNING - Set to Y to fail the build on Doxygen warnings, -# N to continue even if warnings occur -# DOXYGEN_OVERRIDE_PARAMS - Parameters to override in the doxygen -# configuration file -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Default values of optionally user-supplied variables -DOXYGEN_CONF ?= Doxygen.conf -DOXYGEN_FAIL_ON_WARNING ?= Y -DOXYGEN_OVERRIDE_PARAMS ?= QUIET=YES HTML_STYLESHEET=$(patsubst %/,%,$(LUFA_PATH))/DoxygenPages/Style/Style.css - -# Sanity check user supplied values -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, DOXYGEN_CONF) -$(call ERROR_IF_EMPTY, LUFA_PATH) -$(call ERROR_IF_NONBOOL, DOXYGEN_FAIL_ON_WARNING) - -# Output Messages -MSG_DOXYGEN_CMD := ' [DOXYGEN] :' - -# Determine Doxygen invocation command -BASE_DOXYGEN_CMD := ( cat $(DOXYGEN_CONF) $(DOXYGEN_OVERRIDE_PARAMS:%=; echo "%") ) | doxygen - -ifeq ($(DOXYGEN_FAIL_ON_WARNING), Y) - DOXYGEN_CMD := if ( $(BASE_DOXYGEN_CMD) 2>&1 | grep -v "warning: ignoring unsupported tag" ;); then exit 1; fi; -else - DOXYGEN_CMD := $(BASE_DOXYGEN_CMD) -endif - -doxygen: - @echo $(MSG_DOXYGEN_CMD) Configuration file \"$(DOXYGEN_CONF)\" with parameters \"$(DOXYGEN_OVERRIDE_PARAMS)\" - $(DOXYGEN_CMD) - -# Phony build targets for this module -.PHONY: doxygen diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk deleted file mode 100644 index b8f6f26822..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk +++ /dev/null @@ -1,88 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += HID -LUFA_BUILD_TARGETS += hid hid-ee teensy teensy-ee -LUFA_BUILD_MANDATORY_VARS += MCU TARGET -LUFA_BUILD_OPTIONAL_VARS += -LUFA_BUILD_PROVIDED_VARS += -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA HID Bootloader Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of targets to re-program a device currently running a HID -# class bootloader with a project's FLASH files. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# hid - Program FLASH into target via -# hid_bootloader_cli -# hid-ee - Program EEPROM into target via a temporary -# AVR application and hid_bootloader_cli -# teensy - Program FLASH into target via -# teensy_loader_cli -# teensy-ee - Program EEPROM into target via a temporary -# AVR application and teensy_loader_cli -# -# MANDATORY PARAMETERS: -# -# MCU - Microcontroller device model name -# TARGET - Application name -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# PROVIDED VARIABLES: -# -# (None) -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Sanity-check values of mandatory user-supplied variables -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, MCU) -$(call ERROR_IF_EMPTY, TARGET) - -# Output Messages -MSG_HID_BOOTLOADER_CMD := ' [HID] :' -MSG_OBJCPY_CMD := ' [OBJCPY] :' -MSG_MAKE_CMD := ' [MAKE] :' - -hid: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with hid_bootloader_cli using \"$<\" - hid_bootloader_cli -mmcu=$(MCU) -v $< - -hid-ee: $(TARGET).eep $(MAKEFILE_LIST) - @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\" - avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin - @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\" - make -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid - -teensy: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_HID_BOOTLOADER_CMD) Programming FLASH with teensy_loader_cli using \"$<\" - teensy_loader_cli -mmcu=$(MCU) -v $< - -teensy-ee: $(TARGET).hex $(MAKEFILE_LIST) - @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a binary file \"InputEEData.bin\" - avr-objcopy -I ihex -O binary $< $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/InputEEData.bin - @echo $(MSG_MAKE_CMD) Making EEPROM loader application for \"$<\" - make -s -C $(patsubst %/,%,$(LUFA_PATH))/Build/HID_EEPROM_Loader/ MCU=$(MCU) clean hid-teensy - -# Phony build targets for this module -.PHONY: hid hid-ee teensy teensy-ee diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk b/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk deleted file mode 100644 index 663c930244..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk +++ /dev/null @@ -1,116 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# - -LUFA_BUILD_MODULES += SOURCES -LUFA_BUILD_TARGETS += -LUFA_BUILD_MANDATORY_VARS += LUFA_PATH ARCH -LUFA_BUILD_OPTIONAL_VARS += -LUFA_BUILD_PROVIDED_VARS += LUFA_SRC_USB LUFA_SRC_USBCLASS LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL LUFA_SRC_TWI LUFA_SRC_PLATFORM -LUFA_BUILD_PROVIDED_MACROS += - -# ----------------------------------------------------------------------------- -# LUFA Sources Buildsystem Makefile Module. -# ----------------------------------------------------------------------------- -# DESCRIPTION: -# Provides a set of makefile variables for the various LUFA module sources. -# Once included, the sources required to use a given LUFA module will become -# available using the makefile variable names listed in the LUFA project -# documentation. -# ----------------------------------------------------------------------------- -# TARGETS: -# -# (None) -# -# MANDATORY PARAMETERS: -# -# LUFA_PATH - Path to the LUFA library core -# ARCH - Device architecture name -# -# OPTIONAL PARAMETERS: -# -# (None) -# -# PROVIDED VARIABLES: -# -# LUFA_SRC_USB - List of LUFA USB driver source files -# LUFA_SRC_USBCLASS - List of LUFA USB Class driver source files -# LUFA_SRC_TEMPERATURE - List of LUFA temperature sensor driver source -# files -# LUFA_SRC_SERIAL - List of LUFA Serial U(S)ART driver source files -# LUFA_SRC_TWI - List of LUFA TWI driver source files -# LUFA_SRC_PLATFORM - List of LUFA architecture specific platform -# management source files -# -# PROVIDED MACROS: -# -# (None) -# -# ----------------------------------------------------------------------------- - -SHELL = /bin/sh - -ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) -ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) -ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) - -# Sanity check user supplied values -$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) -$(call ERROR_IF_EMPTY, LUFA_PATH) -$(call ERROR_IF_EMPTY, ARCH) - -# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles -LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH)) - -# Construct LUFA module source variables -LUFA_SRC_USB := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptors.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c -LUFA_SRC_USBCLASS := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c \ - $(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c -LUFA_SRC_TEMPERATURE := $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c -LUFA_SRC_SERIAL := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c -LUFA_SRC_TWI := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c - -ifeq ($(ARCH), UC3) - LUFA_SRC_PLATFORM := $(LUFA_ROOT_PATH)/Platform/UC3/Exception.S \ - $(LUFA_ROOT_PATH)/Platform/UC3/InterruptManagement.c -else - LUFA_SRC_PLATFORM := -endif - -# Build a list of all available module sources -LUFA_SRC_ALL_FILES := $(LUFA_SRC_USB) \ - $(LUFA_SRC_USBCLASS) \ - $(LUFA_SRC_TEMPERATURE) \ - $(LUFA_SRC_SERIAL) \ - $(LUFA_SRC_TWI) \ - $(LUFA_SRC_PLATFORM) diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h deleted file mode 100644 index ca4c7a5eb5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Custom Board Button Hardware Driver (Template) - * - * This is a stub driver header file, for implementing custom board - * layout hardware with compatible LUFA board specific drivers. If - * the library is configured to use the BOARD_USER board mode, this - * driver file should be completed and copied into the "/Board/" folder - * inside the application's folder. - * - * This stub is for the board-specific component of the LUFA Buttons driver, - * for the control of physical board-mounted GPIO pushbuttons. - */ - -#ifndef __BUTTONS_USER_H__ -#define __BUTTONS_USER_H__ - - /* Includes: */ - // TODO: Add any required includes here - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 // TODO: Add mask for first board button here - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - // TODO: Initialize the appropriate port pins as an inputs here, with pull-ups - } - - static inline void Buttons_Disable(void) - { - // TODO: Clear the appropriate port pins as high impedance inputs here - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - // TODO: Return current button status here, debounced if required - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h deleted file mode 100644 index d397f77edb..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Custom Board Dataflash Hardware Driver (Template) - * - * This is a stub driver header file, for implementing custom board - * layout hardware with compatible LUFA board specific drivers. If - * the library is configured to use the BOARD_USER board mode, this - * driver file should be completed and copied into the "/Board/" folder - * inside the application's folder. - * - * This stub is for the board-specific component of the LUFA Dataflash - * driver. -*/ - -#ifndef __DATAFLASH_USER_H__ -#define __DATAFLASH_USER_H__ - - /* Includes: */ - // TODO: Add any required includes here - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK // TODO: Replace this with a mask of all the /CS pins of all Dataflashes - #define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs - #define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 // TODO: Replace with the number of Dataflashes on the board, max 2 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 // TODO: Replace with mask to hold /CS of first Dataflash low, and all others high - - /** Mask for the second dataflash chip selected. */ - #define DATAFLASH_CHIP2 // TODO: Replace with mask to hold /CS of second Dataflash low, and all others high - - /** Internal main memory page size for the board's dataflash ICs. */ - #define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs - - /** Total number of pages inside each of the board's dataflash ICs. */ - #define DATAFLASH_PAGES // TODO: Replace with the total number of pages inside one of the Dataflash ICs - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - // TODO - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - // TODO - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - // TODO - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) - return; - - #if (DATAFLASH_TOTALCHIPS == 2) - if (PageAddress & 0x01) - Dataflash_SelectChip(DATAFLASH_CHIP2); - else - Dataflash_SelectChip(DATAFLASH_CHIP1); - #else - Dataflash_SelectChip(DATAFLASH_CHIP1); - #endif - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte) - { - #if (DATAFLASH_TOTALCHIPS == 2) - PageAddress >>= 1; - #endif - - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h deleted file mode 100644 index 31c79d9ebc..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Custom Board Joystick Hardware Driver (Template) - * - * This is a stub driver header file, for implementing custom board - * layout hardware with compatible LUFA board specific drivers. If - * the library is configured to use the BOARD_USER board mode, this - * driver file should be completed and copied into the "/Board/" folder - * inside the application's folder. - * - * This stub is for the board-specific component of the LUFA Joystick - * driver, for a digital four-way (plus button) joystick. -*/ - -#ifndef __JOYSTICK_USER_H__ -#define __JOYSTICK_USER_H__ - - /* Includes: */ - // TODO: Add any required includes here - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT // TODO: Add mask to indicate joystick left position here - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT // TODO: Add mask to indicate joystick right position here - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP // TODO: Add mask to indicate joystick up position here - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN // TODO: Add mask to indicate joystick down position here - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - // TODO: Initialize joystick port pins as inputs with pull-ups - } - - static inline void Joystick_Disable(void) - { - // TODO: Clear the joystick pins as high impedance inputs here - } - - static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Joystick_GetStatus(void) - { - // TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h deleted file mode 100644 index d485346328..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Custom Board LED Hardware Driver (Template) - * - * This is a stub driver header file, for implementing custom board - * layout hardware with compatible LUFA board specific drivers. If - * the library is configured to use the BOARD_USER board mode, this - * driver file should be completed and copied into the "/Board/" folder - * inside the application's folder. - * - * This stub is for the board-specific component of the LUFA LEDs driver, - * for the LEDs (up to four) mounted on most development boards. -*/ - -#ifndef __LEDS_USER_H__ -#define __LEDS_USER_H__ - - /* Includes: */ - // TODO: Add any required includes here - -/* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 // TODO: Add mask for first board LED here - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 // TODO: Add mask for second board LED here - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 // TODO: Add mask for third board LED here - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 // TODO: Add mask for fourth board LED here - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - // TODO: Add code to initialize LED port pins as outputs here - } - - static inline void LEDs_Disable(void) - { - // TODO: Clear the LED port pins as high impedance inputs here - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - // TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - // TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - // TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) - { - // TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - // TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - // TODO: Add code to return the current LEDs status' here which can be masked against LED_LED* macros - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h b/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h deleted file mode 100644 index 6c98d03a44..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LUFA Library Configuration Header File (Template) - * - * This is a header file which can be used to configure LUFA's - * compile time options, as an alternative to the compile time - * constants supplied through a makefile. To use this configuration - * header, copy this into your project's root directory and supply - * the \c USE_LUFA_CONFIG_HEADER token to the compiler so that it is - * defined in all compiled source files. - * - * For information on what each token does, refer to the LUFA - * manual section "Summary of Compile Tokens". - */ - -#ifndef __LUFA_CONFIG_H__ -#define __LUFA_CONFIG_H__ - - #if (ARCH == ARCH_AVR8) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ -// #define ORDERED_EP_CONFIG -// #define USE_STATIC_OPTIONS {Insert Value Here} -// #define USB_DEVICE_ONLY -// #define USB_HOST_ONLY -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define USE_RAM_DESCRIPTORS -// #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS -// #define NO_INTERNAL_SERIAL -// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here} -// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} -// #define FIXED_NUM_CONFIGURATIONS {Insert Value Here} -// #define CONTROL_ONLY_DEVICE -// #define INTERRUPT_CONTROL_ENDPOINT -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - /* USB Host Mode Driver Related Tokens: */ -// #define HOST_STATE_AS_GPIOR {Insert Value Here} -// #define USB_HOST_TIMEOUT_MS {Insert Value Here} -// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} -// #define NO_AUTO_VBUS_MANAGEMENT -// #define INVERTED_VBUS_ENABLE_LINE - - #elif (ARCH == ARCH_XMEGA) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ -// #define USE_STATIC_OPTIONS {Insert Value Here} -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define USE_RAM_DESCRIPTORS -// #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS -// #define NO_INTERNAL_SERIAL -// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here} -// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} -// #define FIXED_NUM_CONFIGURATIONS {Insert Value Here} -// #define CONTROL_ONLY_DEVICE -// #define MAX_ENDPOINT_INDEX {Insert Value Here} -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - #elif (ARCH == ARCH_UC3) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ -// #define ORDERED_EP_CONFIG -// #define USE_STATIC_OPTIONS {Insert Value Here} -// #define USB_DEVICE_ONLY -// #define USB_HOST_ONLY -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define NO_INTERNAL_SERIAL -// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here} -// #define FIXED_NUM_CONFIGURATIONS {Insert Value Here} -// #define CONTROL_ONLY_DEVICE -// #define INTERRUPT_CONTROL_ENDPOINT -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - /* USB Host Mode Driver Related Tokens: */ -// #define USB_HOST_TIMEOUT_MS {Insert Value Here} -// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} -// #define NO_AUTO_VBUS_MANAGEMENT -// #define INVERTED_VBUS_ENABLE_LINE - - #else - - #error Unsupported architecture for this LUFA configuration file. - - #endif -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template b/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template deleted file mode 100644 index ae6cfd3e25..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template +++ /dev/null @@ -1,36 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# -------------------------------------- -# LUFA Project Makefile. -# -------------------------------------- - -MCU = at90usb1287 -ARCH = AVR8 -BOARD = USBKEY -F_CPU = 8000000 -F_USB = $(F_CPU) -OPTIMIZATION = s -TARGET = Target -SRC = $(TARGET).c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) $(LUFA_SRC_PLATFORM) -LUFA_PATH = ../../LUFA -CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig -LD_FLAGS = - -# Default target -all: - -# Include LUFA build script makefiles -include $(LUFA_PATH)/Build/lufa_core.mk -include $(LUFA_PATH)/Build/lufa_sources.mk -include $(LUFA_PATH)/Build/lufa_build.mk -include $(LUFA_PATH)/Build/lufa_cppcheck.mk -include $(LUFA_PATH)/Build/lufa_doxygen.mk -include $(LUFA_PATH)/Build/lufa_dfu.mk -include $(LUFA_PATH)/Build/lufa_hid.mk -include $(LUFA_PATH)/Build/lufa_avrdude.mk -include $(LUFA_PATH)/Build/lufa_atprogram.mk diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h b/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h deleted file mode 100644 index 1e09edf29b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Architecture specific definitions relating to specific processor architectures. - * - * \copydetails Group_ArchitectureSpecific - * - * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's - * functionality. - */ - -/** \ingroup Group_Common - * \defgroup Group_ArchitectureSpecific Architecture Specific Definitions - * \brief Architecture specific definitions relating to specific processor architectures. - * - * Architecture specific macros, functions and other definitions, which relate to specific architectures. This - * definitions may or may not be available in some form on other architectures, and thus should be protected by - * preprocessor checks in portable code to prevent compile errors. - * - * @{ - */ - -#ifndef __LUFA_ARCHSPEC_H__ -#define __LUFA_ARCHSPEC_H__ - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_COMMON_H) - #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. - #endif - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if (ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA) || defined(__DOXYGEN__) - #if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__) - /** Re-enables the AVR's JTAG bus in software, until a system reset. This will re-enable JTAG debugging - * interface after is has been disabled in software via \ref JTAG_DISABLE(). - * - * \note This macro is not available for all architectures. - */ - #define JTAG_ENABLE() MACROS{ \ - __asm__ __volatile__ ( \ - "in __tmp_reg__,__SREG__" "\n\t" \ - "cli" "\n\t" \ - "out %1, %0" "\n\t" \ - "out __SREG__, __tmp_reg__" "\n\t" \ - "out %1, %0" "\n\t" \ - : \ - : "r" (MCUCR & ~(1 << JTD)), \ - "M" (_SFR_IO_ADDR(MCUCR)) \ - : "r0"); \ - }MACROE - - /** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG - * status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO - * mode. - * - * \note This macro is not available for all architectures. - */ - #define JTAG_DISABLE() MACROS{ \ - __asm__ __volatile__ ( \ - "in __tmp_reg__,__SREG__" "\n\t" \ - "cli" "\n\t" \ - "out %1, %0" "\n\t" \ - "out __SREG__, __tmp_reg__" "\n\t" \ - "out %1, %0" "\n\t" \ - : \ - : "r" (MCUCR | (1 << JTD)), \ - "M" (_SFR_IO_ADDR(MCUCR)) \ - : "r0"); \ - }MACROE - #endif - - /** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always - * be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer - * removes/reorders code to the point where break points cannot reliably be set. - * - * \note This macro is not available for all architectures. - */ - #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::) - - /** Defines an explicit JTAG break point in the resulting binary via the assembly \c BREAK statement. When - * a JTAG is used, this causes the program execution to halt when reached until manually resumed. - * - * \note This macro is not available for all architectures. - */ - #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("break" ::) - - /** Macro for testing condition "x" and breaking via \ref JTAG_DEBUG_BREAK() if the condition is false. - * - * \note This macro is not available for all architectures. - * - * \param[in] Condition Condition that will be evaluated. - */ - #define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE - - /** Macro for testing condition \c "x" and writing debug data to the stdout stream if \c false. The stdout stream - * must be pre-initialized before this macro is run and linked to an output device, such as the microcontroller's - * USART peripheral. - * - * The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed." - * - * \note This macro is not available for all architectures. - * - * \param[in] Condition Condition that will be evaluated, - */ - #define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { \ - printf_P(PSTR("%s: Function \"%s\", Line %d: " \ - "Assertion \"%s\" failed.\r\n"), \ - __FILE__, __func__, __LINE__, #Condition); } }MACROE - - #if !defined(pgm_read_ptr) || defined(__DOXYGEN__) - /** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is currently a wrapper for the - * avr-libc \c pgm_read_ptr() macro with a \c void* cast, so that its value can be assigned directly - * to a pointer variable or used in pointer arithmetic without further casting in C. In a future - * avr-libc distribution this will be part of the standard API and will be implemented in a more formal - * manner. - * - * \note This macro is not available for all architectures. - * - * \param[in] Address Address of the pointer to read. - * - * \return Pointer retrieved from PROGMEM space. - */ - #define pgm_read_ptr(Address) (void*)pgm_read_word(Address) - #endif - #elif (ARCH == ARCH_UC3) - #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::) - #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("breakpoint" ::) - #define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE - #define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { \ - printf("%s: Function \"%s\", Line %d: " \ - "Assertion \"%s\" failed.\r\n"), \ - __FILE__, __func__, __LINE__, #Condition); } }MACROE - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h b/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h deleted file mode 100644 index 8941f7c0c7..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Supported library architecture defines. - * - * \copydetails Group_Architectures - * - * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's - * functionality. - */ - -/** \ingroup Group_Common - * \defgroup Group_Architectures Hardware Architectures - * \brief Supported library architecture defines. - * - * Architecture macros for selecting the desired target microcontroller architecture. One of these values should be - * defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the - * target architecture. - * - * The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the - * underlying driver source files for each architecture. - * - * @{ - */ - -#ifndef __LUFA_ARCHITECTURES_H__ -#define __LUFA_ARCHITECTURES_H__ - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_COMMON_H) - #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Selects the Atmel 8-bit AVR (AT90USB* and ATMEGA*U* chips) architecture. */ - #define ARCH_AVR8 0 - - /** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */ - #define ARCH_UC3 1 - - /** Selects the Atmel XMEGA AVR (ATXMEGA*U chips) architecture. */ - #define ARCH_XMEGA 2 - - #if !defined(__DOXYGEN__) - #define ARCH_ ARCH_AVR8 - - #if !defined(ARCH) - #define ARCH ARCH_AVR8 - #endif - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h b/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h deleted file mode 100644 index fce75d0ed2..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Special function/variable attribute macros. - * - * \copydetails Group_FuncVarAttributes - * - * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's - * functionality. - */ - -/** \ingroup Group_Common - * \defgroup Group_FuncVarAttributes Function/Variable Attributes - * \brief Special function/variable attribute macros. - * - * This module contains macros for applying specific attributes to functions and variables to control various - * optimizer and code generation features of the compiler. Attributes may be placed in the function prototype - * or variable declaration in any order, and multiple attributes can be specified for a single item via a space - * separated list. - * - * On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are - * critical to the code's function and thus must throw a compile error when used. - * - * @{ - */ - -#ifndef __LUFA_ATTR_H__ -#define __LUFA_ATTR_H__ - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_COMMON_H) - #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if (__GNUC__ >= 3) || defined(__DOXYGEN__) - /** Indicates to the compiler that the function can not ever return, so that any stack restoring or - * return code may be omitted by the compiler in the resulting binary. - */ - #define ATTR_NO_RETURN __attribute__ ((noreturn)) - - /** Indicates that the function returns a value which should not be ignored by the user code. When - * applied, any ignored return value from calling the function will produce a compiler warning. - */ - #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) - - /** Indicates that the specified parameters of the function are pointers which should never be \c NULL. - * When applied as a 1-based comma separated list the compiler will emit a warning if the specified - * parameters are known at compiler time to be \c NULL at the point of calling the function. - */ - #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__))) - - /** Removes any preamble or postamble from the function. When used, the function will not have any - * register or stack saving code. This should be used with caution, and when used the programmer - * is responsible for maintaining stack and register integrity. - */ - #define ATTR_NAKED __attribute__ ((naked)) - - /** Prevents the compiler from considering a specified function for in-lining. When applied, the given - * function will not be in-lined under any circumstances. - */ - #define ATTR_NO_INLINE __attribute__ ((noinline)) - - /** Forces the compiler to inline the specified function. When applied, the given function will be - * in-lined under all circumstances. - */ - #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) - - /** Indicates that the specified function is pure, in that it has no side-effects other than global - * or parameter variable access. - */ - #define ATTR_PURE __attribute__ ((pure)) - - /** Indicates that the specified function is constant, in that it has no side effects other than - * parameter access. - */ - #define ATTR_CONST __attribute__ ((const)) - - /** Marks a given function as deprecated, which produces a warning if the function is called. */ - #define ATTR_DEPRECATED __attribute__ ((deprecated)) - - /** Marks a function as a weak reference, which can be overridden by other functions with an - * identical name (in which case the weak reference is discarded at link time). - */ - #define ATTR_WEAK __attribute__ ((weak)) - #endif - - /** Forces the compiler to not automatically zero the given global variable on startup, so that the - * current RAM contents is retained. Under most conditions this value will be random due to the - * behavior of volatile memory once power is removed, but may be used in some specific circumstances, - * like the passing of values back after a system watchdog reset. - */ - #define ATTR_NO_INIT __attribute__ ((section (".noinit"))) - - /** Places the function in one of the initialization sections, which execute before the main function - * of the application. Refer to the avr-libc manual for more information on the initialization sections. - * - * \param[in] SectionIndex Initialization section number where the function should be placed. - */ - #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((used, naked, section (".init" #SectionIndex ))) - - /** Marks a function as an alias for another function. - * - * \param[in] Func Name of the function which the given function name should alias. - */ - #define ATTR_ALIAS(Func) __attribute__ ((alias( #Func ))) - - /** Marks a variable or struct element for packing into the smallest space available, omitting any - * alignment bytes usually added between fields to optimize field accesses. - */ - #define ATTR_PACKED __attribute__ ((packed)) - - /** Indicates the minimum alignment in bytes for a variable or struct element. - * - * \param[in] Bytes Minimum number of bytes the item should be aligned to. - */ - #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h b/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h deleted file mode 100644 index 4c152dab29..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Supported pre-made board hardware defines. - * - * \copydetails Group_BoardTypes - * - * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's - * functionality. - */ - -/** \ingroup Group_Common - * \defgroup Group_BoardTypes Board Types - * \brief Supported pre-made board hardware defines. - * - * Board macros for indicating the chosen physical board hardware to the library. These macros should be used when - * defining the \c BOARD token to the chosen hardware via the \c -D switch in the project makefile. If a custom - * board is used, the \ref BOARD_NONE or \ref BOARD_USER values should be selected. - * - * @{ - */ - -#ifndef __LUFA_BOARDTYPES_H__ -#define __LUFA_BOARDTYPES_H__ - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_COMMON_H) - #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Selects the user-defined board drivers, which should be placed in the user project's folder - * under a directory named \c /Board/. Each board driver should be named identically to the LUFA - * master board driver (i.e., driver in the \c LUFA/Drivers/Board directory) so that the library - * can correctly identify it. - */ - #define BOARD_USER 0 - - /** Disables board drivers when operation will not be adversely affected (e.g. LEDs) - use of board drivers - * such as the Joystick driver, where the removal would adversely affect the code's operation is still disallowed. */ - #define BOARD_NONE 1 - - /** Selects the USBKEY specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ - #define BOARD_USBKEY 2 - - /** Selects the STK525 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ - #define BOARD_STK525 3 - - /** Selects the STK526 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ - #define BOARD_STK526 4 - - /** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */ - #define BOARD_RZUSBSTICK 5 - - /** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */ - #define BOARD_ATAVRUSBRF01 6 - - /** Selects the BUMBLEB specific board drivers, using the officially recommended peripheral layout. */ - #define BOARD_BUMBLEB 7 - - /** Selects the XPLAIN (Revision 2 or newer) specific board drivers, including LED and Dataflash drivers. */ - #define BOARD_XPLAIN 8 - - /** Selects the XPLAIN (Revision 1) specific board drivers, including LED and Dataflash drivers. */ - #define BOARD_XPLAIN_REV1 9 - - /** Selects the EVK527 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ - #define BOARD_EVK527 10 - - /** Selects the Teensy version 1.x specific board drivers, including the driver for the board LEDs. */ - #define BOARD_TEENSY 11 - - /** Selects the USBTINY MKII specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_USBTINYMKII 12 - - /** Selects the Benito specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_BENITO 13 - - /** Selects the JM-DB-U2 specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_JMDBU2 14 - - /** Selects the Olimex AVR-USB-162 specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_OLIMEX162 15 - - /** Selects the UDIP specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_UDIP 16 - - /** Selects the BUI specific board drivers, including the driver for the board LEDs. */ - #define BOARD_BUI 17 - - /** Selects the Arduino Uno specific board drivers, including the driver for the board LEDs. */ - #define BOARD_UNO 18 - - /** Selects the Busware CUL V3 specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_CULV3 19 - - /** Selects the Blackcat USB JTAG specific board drivers, including the driver for the board LEDs. */ - #define BOARD_BLACKCAT 20 - - /** Selects the Maximus specific board drivers, including the driver for the board LEDs. */ - #define BOARD_MAXIMUS 21 - - /** Selects the Minimus specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_MINIMUS 22 - - /** Selects the Adafruit U4 specific board drivers, including the Button driver. */ - #define BOARD_ADAFRUITU4 23 - - /** Selects the Microsin AVR-USB162 specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_MICROSIN162 24 - - /** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_USBFOO 25 - - /** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */ - #define BOARD_SPARKFUN8U2 26 - - /** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */ - #define BOARD_EVK1101 27 - - /** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */ - #define BOARD_TUL 28 - - /** Selects the Atmel EVK1100 specific board drivers, including the Button, Joystick and LED drivers. */ - #define BOARD_EVK1100 29 - - /** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */ - #define BOARD_EVK1104 30 - - /** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */ - #define BOARD_A3BU_XPLAINED 31 - - /** Selects the Teensy version 2.x specific board drivers, including the driver for the board LEDs. */ - #define BOARD_TEENSY2 32 - - /** Selects the USB2AX version 1 and 2 specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_USB2AX 33 - - /** Selects the USB2AX version 3 specific board drivers, including the Button and LEDs drivers. */ - #define BOARD_USB2AX_V3 34 - - /** Selects the Micropendous 32U2 specific board drivers, including the Button and LED drivers. */ - #define BOARD_MICROPENDOUS_32U2 35 - - /** Selects the Micropendous A specific board drivers, including the driver for the board Button. */ - #define BOARD_MICROPENDOUS_A 36 - - /** Selects the Micropendous 1 specific board drivers, including the driver for the board Button. */ - #define BOARD_MICROPENDOUS_1 37 - - /** Selects the Micropendous 2 specific board drivers, including the driver for the board Button. */ - #define BOARD_MICROPENDOUS_2 38 - - /** Selects the Micropendous 3 specific board drivers, including the driver for the board Button. */ - #define BOARD_MICROPENDOUS_3 39 - - /** Selects the Micropendous 4 specific board drivers, including the driver for the board Button. */ - #define BOARD_MICROPENDOUS_4 40 - - /** Selects the Micropendous DIP specific board drivers, including the driver for the board Button. */ - #define BOARD_MICROPENDOUS_DIP 41 - - /** Selects the Micropendous (Arduino-like) revision 1 specific board drivers, including the Button and LED drivers. */ - #define BOARD_MICROPENDOUS_REV1 42 - - /** Selects the Micropendous (Arduino-like) revision 2 specific board drivers, including the Button and LED drivers. */ - #define BOARD_MICROPENDOUS_REV2 43 - - /** Selects the XMEGA B1 Xplained specific board drivers, including the Button and LED drivers. */ - #define BOARD_B1_XPLAINED 44 - - /** Selects the Bitwizard Multio specific board drivers, including the driver for the board LEDs. */ - #define BOARD_MULTIO 45 - - /** Selects the Bitwizard Big-Multio specific board drivers, including the driver for the board LEDs. */ - #define BOARD_BIGMULTIO 46 - - /** Selects the DorkbotPDX Duce specific board drivers, including the driver for the board LEDs. */ - #define BOARD_DUCE 47 - - /** Selects the Olimex AVR-USB-32U4 specific board drivers, including the Button and LED drivers. */ - #define BOARD_OLIMEX32U4 48 - - /** Selects the Olimex AVR-USB-T32U4 specific board drivers, including the Button and LED drivers. */ - #define BOARD_OLIMEXT32U4 49 - - /** Selects the Olimex AVR-ISP-MK2 specific board drivers, including the Button and LED drivers. */ - #define BOARD_OLIMEXISPMK2 50 - - - #if !defined(__DOXYGEN__) - #define BOARD_ BOARD_NONE - - #if !defined(BOARD) - #define BOARD BOARD_NONE - #endif - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Common.h b/protocol/lufa/LUFA-120730/LUFA/Common/Common.h deleted file mode 100644 index cf1f49b9da..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/Common.h +++ /dev/null @@ -1,381 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \dir - * \brief Common library header files. - * - * This folder contains header files which are common to all parts of the LUFA library. They may be used freely in - * user applications. - */ - -/** \file - * \brief Common library convenience headers, macros and functions. - * - * \copydetails Group_Common - */ - -/** \defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h - * \brief Common library convenience headers, macros and functions. - * - * Common utility headers containing macros, functions, enums and types which are common to all - * aspects of the library. - * - * @{ - */ - -/** \defgroup Group_GlobalInt Global Interrupt Macros - * \brief Convenience macros for the management of interrupts globally within the device. - * - * Macros and functions to create and control global interrupts within the device. - */ - -#ifndef __LUFA_COMMON_H__ -#define __LUFA_COMMON_H__ - - /* Macros: */ - #define __INCLUDE_FROM_COMMON_H - - /* Includes: */ - #include - #include - #include - #include - - #include "Architectures.h" - #include "BoardTypes.h" - #include "ArchitectureSpecific.h" - #include "CompilerSpecific.h" - #include "Attributes.h" - - #if defined(USE_LUFA_CONFIG_HEADER) - #include "LUFAConfig.h" - #endif - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Architecture specific utility includes: */ - #if defined(__DOXYGEN__) - /** Type define for an unsigned integer the same width as the selected architecture's machine register. - * This is distinct from the non-specific standard int data type, whose width is machine dependant but - * which may not reflect the actual machine register width on some targets (e.g. AVR8). - */ - typedef MACHINE_REG_t uint_reg_t; - #elif (ARCH == ARCH_AVR8) - #include - #include - #include - #include - #include - #include - #include - - typedef uint8_t uint_reg_t; - - #define ARCH_HAS_EEPROM_ADDRESS_SPACE - #define ARCH_HAS_FLASH_ADDRESS_SPACE - #define ARCH_HAS_MULTI_ADDRESS_SPACE - #define ARCH_LITTLE_ENDIAN - - #include "Endianness.h" - #elif (ARCH == ARCH_UC3) - #include - #include - - // === TODO: Find abstracted way to handle these === - #define PROGMEM - #define pgm_read_byte(x) *x - #define memcmp_P(...) memcmp(__VA_ARGS__) - #define memcpy_P(...) memcpy(__VA_ARGS__) - // ================================================= - - typedef uint32_t uint_reg_t; - - #define ARCH_BIG_ENDIAN - - #include "Endianness.h" - #elif (ARCH == ARCH_XMEGA) - #include - #include - #include - #include - #include - #include - - typedef uint8_t uint_reg_t; - - #define ARCH_HAS_EEPROM_ADDRESS_SPACE - #define ARCH_HAS_FLASH_ADDRESS_SPACE - #define ARCH_HAS_MULTI_ADDRESS_SPACE - #define ARCH_LITTLE_ENDIAN - - #include "Endianness.h" - #else - #error Unknown device architecture specified. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Macro for encasing other multi-statement macros. This should be used along with an opening brace - * before the start of any multi-statement macro, so that the macros contents as a whole are treated - * as a discrete block and not as a list of separate statements which may cause problems when used as - * a block (such as inline \c if statements). - */ - #define MACROS do - - /** Macro for encasing other multi-statement macros. This should be used along with a preceding closing - * brace at the end of any multi-statement macro, so that the macros contents as a whole are treated - * as a discrete block and not as a list of separate statements which may cause problems when used as - * a block (such as inline \c if statements). - */ - #define MACROE while (0) - - /** Convenience macro to determine the larger of two values. - * - * \attention This macro should only be used with operands that do not have side effects from being evaluated - * multiple times. - * - * \param[in] x First value to compare - * \param[in] y First value to compare - * - * \return The larger of the two input parameters - */ - #if !defined(MAX) || defined(__DOXYGEN__) - #define MAX(x, y) (((x) > (y)) ? (x) : (y)) - #endif - - /** Convenience macro to determine the smaller of two values. - * - * \attention This macro should only be used with operands that do not have side effects from being evaluated - * multiple times. - * - * \param[in] x First value to compare - * \param[in] y First value to compare - * - * \return The smaller of the two input parameters - */ - #if !defined(MIN) || defined(__DOXYGEN__) - #define MIN(x, y) (((x) < (y)) ? (x) : (y)) - #endif - - #if !defined(STRINGIFY) || defined(__DOXYGEN__) - /** Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation - * marks around the input, converting the source into a string literal. - * - * \param[in] x Input to convert into a string literal. - * - * \return String version of the input. - */ - #define STRINGIFY(x) #x - - /** Converts the given input into a string after macro expansion, via the C Preprocessor. This macro puts - * literal quotation marks around the expanded input, converting the source into a string literal. - * - * \param[in] x Input to expand and convert into a string literal. - * - * \return String version of the expanded input. - */ - #define STRINGIFY_EXPANDED(x) STRINGIFY(x) - #endif - - #if !defined(ISR) || defined(__DOXYGEN__) - /** Macro for the definition of interrupt service routines, so that the compiler can insert the required - * prologue and epilogue code to properly manage the interrupt routine without affecting the main thread's - * state with unintentional side-effects. - * - * Interrupt handlers written using this macro may still need to be registered with the microcontroller's - * Interrupt Controller (if present) before they will properly handle incoming interrupt events. - * - * \note This macro is only supplied on some architectures, where the standard library does not include a valid - * definition. If an existing definition exists, the alternative definition here will be ignored. - * - * \ingroup Group_GlobalInt - * - * \param[in] Name Unique name of the interrupt service routine. - */ - #define ISR(Name, ...) void Name (void) __attribute__((__interrupt__)) __VA_ARGS__; void Name (void) - #endif - - /* Inline Functions: */ - /** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1, - * etc. - * - * \param[in] Byte Byte of data whose bits are to be reversed. - * - * \return Input data with the individual bits reversed (mirrored). - */ - static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST; - static inline uint8_t BitReverse(uint8_t Byte) - { - Byte = (((Byte & 0xF0) >> 4) | ((Byte & 0x0F) << 4)); - Byte = (((Byte & 0xCC) >> 2) | ((Byte & 0x33) << 2)); - Byte = (((Byte & 0xAA) >> 1) | ((Byte & 0x55) << 1)); - - return Byte; - } - - /** Function to perform a blocking delay for a specified number of milliseconds. The actual delay will be - * at a minimum the specified number of milliseconds, however due to loop overhead and internal calculations - * may be slightly higher. - * - * \param[in] Milliseconds Number of milliseconds to delay - */ - static inline void Delay_MS(uint16_t Milliseconds) ATTR_ALWAYS_INLINE; - static inline void Delay_MS(uint16_t Milliseconds) - { - #if (ARCH == ARCH_AVR8) - if (GCC_IS_COMPILE_CONST(Milliseconds)) - { - _delay_ms(Milliseconds); - } - else - { - while (Milliseconds--) - _delay_ms(1); - } - #elif (ARCH == ARCH_UC3) - while (Milliseconds--) - { - __builtin_mtsr(AVR32_COUNT, 0); - while ((uint32_t)__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000)); - } - #elif (ARCH == ARCH_XMEGA) - if (GCC_IS_COMPILE_CONST(Milliseconds)) - { - _delay_ms(Milliseconds); - } - else - { - while (Milliseconds--) - _delay_ms(1); - } - #endif - } - - /** Retrieves a mask which contains the current state of the global interrupts for the device. This - * value can be stored before altering the global interrupt enable state, before restoring the - * flag(s) back to their previous values after a critical section using \ref SetGlobalInterruptMask(). - * - * \ingroup Group_GlobalInt - * - * \return Mask containing the current Global Interrupt Enable Mask bit(s). - */ - static inline uint_reg_t GetGlobalInterruptMask(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint_reg_t GetGlobalInterruptMask(void) - { - GCC_MEMORY_BARRIER(); - - #if (ARCH == ARCH_AVR8) - return SREG; - #elif (ARCH == ARCH_UC3) - return __builtin_mfsr(AVR32_SR); - #elif (ARCH == ARCH_XMEGA) - return SREG; - #endif - } - - /** Sets the global interrupt enable state of the microcontroller to the mask passed into the function. - * This can be combined with \ref GetGlobalInterruptMask() to save and restore the Global Interrupt Enable - * Mask bit(s) of the device after a critical section has completed. - * - * \ingroup Group_GlobalInt - * - * \param[in] GlobalIntState Global Interrupt Enable Mask value to use - */ - static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE; - static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState) - { - GCC_MEMORY_BARRIER(); - - #if (ARCH == ARCH_AVR8) - SREG = GlobalIntState; - #elif (ARCH == ARCH_UC3) - if (GlobalIntState & AVR32_SR_GM) - __builtin_ssrf(AVR32_SR_GM_OFFSET); - else - __builtin_csrf(AVR32_SR_GM_OFFSET); - #elif (ARCH == ARCH_XMEGA) - SREG = GlobalIntState; - #endif - - GCC_MEMORY_BARRIER(); - } - - /** Enables global interrupt handling for the device, allowing interrupts to be handled. - * - * \ingroup Group_GlobalInt - */ - static inline void GlobalInterruptEnable(void) ATTR_ALWAYS_INLINE; - static inline void GlobalInterruptEnable(void) - { - GCC_MEMORY_BARRIER(); - - #if (ARCH == ARCH_AVR8) - sei(); - #elif (ARCH == ARCH_UC3) - __builtin_csrf(AVR32_SR_GM_OFFSET); - #elif (ARCH == ARCH_XMEGA) - sei(); - #endif - - GCC_MEMORY_BARRIER(); - } - - /** Disabled global interrupt handling for the device, preventing interrupts from being handled. - * - * \ingroup Group_GlobalInt - */ - static inline void GlobalInterruptDisable(void) ATTR_ALWAYS_INLINE; - static inline void GlobalInterruptDisable(void) - { - GCC_MEMORY_BARRIER(); - - #if (ARCH == ARCH_AVR8) - cli(); - #elif (ARCH == ARCH_UC3) - __builtin_ssrf(AVR32_SR_GM_OFFSET); - #elif (ARCH == ARCH_XMEGA) - cli(); - #endif - - GCC_MEMORY_BARRIER(); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h b/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h deleted file mode 100644 index 22afe940b3..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Compiler specific definitions for code optimization and correctness. - * - * \copydetails Group_CompilerSpecific - * - * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's - * functionality. - */ - -/** \ingroup Group_Common - * \defgroup Group_CompilerSpecific Compiler Specific Definitions - * \brief Compiler specific definitions for code optimization and correctness. - * - * Compiler specific definitions to expose certain compiler features which may increase the level of code optimization - * for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction - * with atomic variable access. - * - * Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value - * so that they can be used in existing code without the need for extra compiler checks in the user application code. - * - * @{ - */ - -#ifndef __LUFA_COMPILERSPEC_H__ -#define __LUFA_COMPILERSPEC_H__ - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_COMMON_H) - #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if defined(__GNUC__) || defined(__DOXYGEN__) - /** Forces GCC to use pointer indirection (via the device's pointer register pairs) when accessing the given - * struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through - * a pointer, resulting in a larger binary. When this macro is used on a (non \c const) structure pointer before - * use, it will force GCC to use pointer indirection on the elements rather than direct store and load - * instructions. - * - * \param[in, out] StructPtr Pointer to a structure which is to be forced into indirect access mode. - */ - #define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr)) - - /** Forces GCC to create a memory barrier, ensuring that memory accesses are not reordered past the barrier point. - * This can be used before ordering-critical operations, to ensure that the compiler does not re-order the resulting - * assembly output in an unexpected manner on sections of code that are ordering-specific. - */ - #define GCC_MEMORY_BARRIER() __asm__ __volatile__("" ::: "memory"); - - /** Determines if the specified value can be determined at compile-time to be a constant value when compiling under GCC. - * - * \param[in] x Value to check compile-time constantness of. - * - * \return Boolean true if the given value is known to be a compile time constant, false otherwise. - */ - #define GCC_IS_COMPILE_CONST(x) __builtin_constant_p(x) - #else - #define GCC_FORCE_POINTER_ACCESS(StructPtr) - #define GCC_MEMORY_BARRIER() - #define GCC_IS_COMPILE_CONST(x) 0 - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h b/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h deleted file mode 100644 index d0812e4e3b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h +++ /dev/null @@ -1,489 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endianness and Byte Ordering macros and functions. - * - * \copydetails Group_Endianness - */ - -/** \ingroup Group_Endianness - * \defgroup Group_ByteSwapping Byte Reordering - * \brief Macros and functions for forced byte reordering. - */ - -/** \ingroup Group_Endianness - * \defgroup Group_EndianConversion Endianness Conversion - * \brief Macros and functions for automatic endianness conversion. - */ - -/** \ingroup Group_Common - * \defgroup Group_Endianness Endianness and Byte Ordering - * \brief Convenience macros and functions relating to byte (re-)ordering - * - * Common library convenience macros and functions relating to byte (re-)ordering. - * - * @{ - */ - -#ifndef __LUFA_ENDIANNESS_H__ -#define __LUFA_ENDIANNESS_H__ - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_COMMON_H) - #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. - #endif - - #if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN)) - #error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Swaps the byte ordering of a 16-bit value at compile-time. Do not use this macro for swapping byte orderings - * of dynamic values computed at runtime, use \ref SwapEndian_16() instead. The result of this macro can be used - * inside struct or other variable initializers outside of a function, something that is not possible with the - * inline function variant. - * - * \ingroup Group_ByteSwapping - * - * \param[in] x 16-bit value whose byte ordering is to be swapped. - * - * \return Input value with the byte ordering reversed. - */ - #define SWAPENDIAN_16(x) (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) - - /** Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings - * of dynamic values computed at runtime- use \ref SwapEndian_32() instead. The result of this macro can be used - * inside struct or other variable initializers outside of a function, something that is not possible with the - * inline function variant. - * - * \ingroup Group_ByteSwapping - * - * \param[in] x 32-bit value whose byte ordering is to be swapped. - * - * \return Input value with the byte ordering reversed. - */ - #define SWAPENDIAN_32(x) (uint32_t)((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \ - (((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL)) - - #if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu) - #define le16_to_cpu(x) SwapEndian_16(x) - #define le32_to_cpu(x) SwapEndian_32(x) - #define be16_to_cpu(x) (x) - #define be32_to_cpu(x) (x) - #define cpu_to_le16(x) SwapEndian_16(x) - #define cpu_to_le32(x) SwapEndian_32(x) - #define cpu_to_be16(x) (x) - #define cpu_to_be32(x) (x) - #define LE16_TO_CPU(x) SWAPENDIAN_16(x) - #define LE32_TO_CPU(x) SWAPENDIAN_32(x) - #define BE16_TO_CPU(x) (x) - #define BE32_TO_CPU(x) (x) - #define CPU_TO_LE16(x) SWAPENDIAN_16(x) - #define CPU_TO_LE32(x) SWAPENDIAN_32(x) - #define CPU_TO_BE16(x) (x) - #define CPU_TO_BE32(x) (x) - #elif !defined(le16_to_cpu) - /** \name Run-time endianness conversion */ - //@{ - - /** Performs a conversion between a Little Endian encoded 16-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref LE16_TO_CPU instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define le16_to_cpu(x) (x) - - /** Performs a conversion between a Little Endian encoded 32-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref LE32_TO_CPU instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define le32_to_cpu(x) (x) - - /** Performs a conversion between a Big Endian encoded 16-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref BE16_TO_CPU instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define be16_to_cpu(x) SwapEndian_16(x) - - /** Performs a conversion between a Big Endian encoded 32-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref BE32_TO_CPU instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define be32_to_cpu(x) SwapEndian_32(x) - - /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it - * is in Little Endian format regardless of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref CPU_TO_LE16 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define cpu_to_le16(x) (x) - - /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it - * is in Little Endian format regardless of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref CPU_TO_LE32 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define cpu_to_le32(x) (x) - - /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it - * is in Big Endian format regardless of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref CPU_TO_BE16 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define cpu_to_be16(x) SwapEndian_16(x) - - /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it - * is in Big Endian format regardless of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for run-time conversion of data - for compile-time endianness - * conversion, use \ref CPU_TO_BE32 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define cpu_to_be32(x) SwapEndian_32(x) - - //@} - - /** \name Compile-time endianness conversion */ - //@{ - - /** Performs a conversion between a Little Endian encoded 16-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run time endianness - * conversion, use \ref le16_to_cpu instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define LE16_TO_CPU(x) (x) - - /** Performs a conversion between a Little Endian encoded 32-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run time endianness - * conversion, use \ref le32_to_cpu instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define LE32_TO_CPU(x) (x) - - /** Performs a conversion between a Big Endian encoded 16-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run-time endianness - * conversion, use \ref be16_to_cpu instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define BE16_TO_CPU(x) SWAPENDIAN_16(x) - - /** Performs a conversion between a Big Endian encoded 32-bit piece of data and the - * Endianness of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run-time endianness - * conversion, use \ref be32_to_cpu instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define BE32_TO_CPU(x) SWAPENDIAN_32(x) - - /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it - * is in Little Endian format regardless of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run-time endianness - * conversion, use \ref cpu_to_le16 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define CPU_TO_LE16(x) (x) - - /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it - * is in Little Endian format regardless of the currently selected CPU architecture. - * - * On little endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run-time endianness - * conversion, use \ref cpu_to_le32 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define CPU_TO_LE32(x) (x) - - /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it - * is in Big Endian format regardless of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run-time endianness - * conversion, use \ref cpu_to_be16 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define CPU_TO_BE16(x) SWAPENDIAN_16(x) - - /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it - * is in Big Endian format regardless of the currently selected CPU architecture. - * - * On big endian architectures, this macro does nothing. - * - * \note This macro is designed for compile-time conversion of data - for run-time endianness - * conversion, use \ref cpu_to_be32 instead. - * - * \ingroup Group_EndianConversion - * - * \param[in] x Data to perform the endianness conversion on. - * - * \return Endian corrected version of the input value. - */ - #define CPU_TO_BE32(x) SWAPENDIAN_32(x) - - //! @} - #endif - - /* Inline Functions: */ - /** Function to reverse the byte ordering of the individual bytes in a 16 bit value. - * - * \ingroup Group_ByteSwapping - * - * \param[in] Word Word of data whose bytes are to be swapped. - * - * \return Input data with the individual bytes reversed. - */ - static inline uint16_t SwapEndian_16(const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST; - static inline uint16_t SwapEndian_16(const uint16_t Word) - { - if (GCC_IS_COMPILE_CONST(Word)) - return SWAPENDIAN_16(Word); - - uint8_t Temp; - - union - { - uint16_t Word; - uint8_t Bytes[2]; - } Data; - - Data.Word = Word; - - Temp = Data.Bytes[0]; - Data.Bytes[0] = Data.Bytes[1]; - Data.Bytes[1] = Temp; - - return Data.Word; - } - - /** Function to reverse the byte ordering of the individual bytes in a 32 bit value. - * - * \ingroup Group_ByteSwapping - * - * \param[in] DWord Double word of data whose bytes are to be swapped. - * - * \return Input data with the individual bytes reversed. - */ - static inline uint32_t SwapEndian_32(const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST; - static inline uint32_t SwapEndian_32(const uint32_t DWord) - { - if (GCC_IS_COMPILE_CONST(DWord)) - return SWAPENDIAN_32(DWord); - - uint8_t Temp; - - union - { - uint32_t DWord; - uint8_t Bytes[4]; - } Data; - - Data.DWord = DWord; - - Temp = Data.Bytes[0]; - Data.Bytes[0] = Data.Bytes[3]; - Data.Bytes[3] = Temp; - - Temp = Data.Bytes[1]; - Data.Bytes[1] = Data.Bytes[2]; - Data.Bytes[2] = Temp; - - return Data.DWord; - } - - /** Function to reverse the byte ordering of the individual bytes in a n byte value. - * - * \ingroup Group_ByteSwapping - * - * \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed. - * \param[in] Length Length of the data in bytes. - * - * \return Input data with the individual bytes reversed. - */ - static inline void SwapEndian_n(void* const Data, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(1); - static inline void SwapEndian_n(void* const Data, - uint8_t Length) - { - uint8_t* CurrDataPos = (uint8_t*)Data; - - while (Length > 1) - { - uint8_t Temp = *CurrDataPos; - *CurrDataPos = *(CurrDataPos + Length - 1); - *(CurrDataPos + Length - 1) = Temp; - - CurrDataPos++; - Length -= 2; - } - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf b/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf deleted file mode 100644 index 89b2a33274..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf +++ /dev/null @@ -1,1809 +0,0 @@ -# Doxyfile 1.8.1.2 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = "LUFA Library" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 000000 - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = ./DoxygenPages/Images/LUFA_thumb.png - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ./Documentation/ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = NO - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. - -MARKDOWN_SUPPORT = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -SYMBOL_CACHE_SIZE = 0 - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = NO - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = NO - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = NO - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 15 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ./ - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.h \ - *.txt - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = Documentation/ \ - License.txt - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = _* \ - __* - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ./ \ - CodeTemplates/ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = ./ - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = NO - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = ./DoxygenPages/Style/Footer.htm - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# style sheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = ./DoxygenPages/Style/Style.css - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 120 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. - -HTML_DYNAMIC_SECTIONS = YES - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = com.lufa-lib.library.documentation - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = DeanCamera - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = ../LUFA.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = YES - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 1 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 300 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. -# However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. - -MATHJAX_RELPATH = http://www.mathjax.org/mathjax - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = __DOXYGEN__ \ - PROGMEM \ - EEMEM \ - ATTR_PACKED - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. For each -# tag file the location of the external documentation should be added. The -# format of a tag file without this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths -# or URLs. Note that each tag file must have a unique name (where the name does -# NOT include the path). If a tag file is not located in the directory in which -# doxygen is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = NO - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = NO - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = NO - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside -# the class node. If there are many fields or methods and many nodes the -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS -# threshold limits the number of items for each type to make the size more -# managable. Set this to 0 for no limit. Note that the threshold may be -# exceeded by 50% before the limit is enforced. - -UML_LIMIT_NUM_FIELDS = 10 - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = NO - -# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 15 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 2 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt deleted file mode 100644 index c30a88bb4d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt +++ /dev/null @@ -1,846 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_BuildSystem The LUFA Build System - * - * \section Sec_BuildSystemOverview Overview of the LUFA Build System - * The LUFA build system is an attempt at making a set of re-usable, modular build make files which - * can be referenced in a LUFA powered project, to minimise the amount of code required in an - * application makefile. The system is written in GNU Make, and each module is independant of - * one-another. - * - * For details on the prerequisites needed for Linux and Windows machines to be able to use the LUFA - * build system, see \ref Sec_Prerequisites. - * - * To use a LUFA build system module, simply add an include to your project makefile: - * \code - * include $(LUFA_PATH)/Build/lufa_core.mk - * \endcode - * - * And the associated build module targets will be added to your project's build makefile automatically. - * To call a build target, run make {TARGET_NAME} from the command line, substituting in - * the appropriate target name. - * - * \see \ref Sec_AppConfigParams for a copy of the sample LUFA project makefile. - * - * Each build module may have one or more mandatory parameters (GNU Make variables) which must - * be supplied in the project makefile for the module to work, and one or more optional parameters which - * may be defined and which will assume a sensible default if not. - * - * \section SSec_BuildSystemModules Available Modules - * - * The following modules are included in this LUFA release: - * - * \li \subpage Page_BuildModule_ATPROGRAM - Device Programming - * \li \subpage Page_BuildModule_AVRDUDE - Device Programming - * \li \subpage Page_BuildModule_BUILD - Compiling/Assembling/Linking - * \li \subpage Page_BuildModule_CORE - Core Build System Functions - * \li \subpage Page_BuildModule_CPPCHECK - Static Code Analysis - * \li \subpage Page_BuildModule_DFU - Device Programming - * \li \subpage Page_BuildModule_DOXYGEN - Automated Source Code Documentation - * \li \subpage Page_BuildModule_HID - Device Programming - * \li \subpage Page_BuildModule_SOURCES - LUFA Module Source Code Variables - */ - - /** \page Page_BuildModule_BUILD The BUILD build module - * - * The BUILD LUFA build system module, providing targets for the compilation, - * assembling and linking of an application from source code into binary files - * suitable for programming into a target device. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_build.mk - * \endcode - * - * \section SSec_BuildModule_BUILD_Requirements Requirements - * This module requires the the architecture appropriate binaries of the GCC compiler are available in your - * system's PATH variable. The GCC compiler and associated toolchain is distributed in Atmel AVR Studio - * 5.x and Atmel Studio 6.x installation directories, as well as in many third party distribution packages. - * - * \section SSec_BuildModule_BUILD_Targets Targets - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
sizeDisplay size of the compiled application FLASH and SRAM segments.
symbol-sizesDisplay a size-sorted list of symbols from the compiled application, in decimal bytes.
check-sourceDisplay a list of input SRC source files which cannot be found (if any).
libBuild and archive all source files into a library A binary file.
allBuild and link the application into ELF debug and HEX binary files.
elfBuild and link the application into an ELF debug file.
hexBuild and link the application and produce HEX and EEP binary files.
lssBuild and link the application and produce a LSS source code/assembly code mixed listing file.
cleanRemove all intermediatary files and binary output files.
mostlycleanRemove all intermediatary files but preserve any binary output files.
- * - * \section SSec_BuildModule_BUILD_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
TARGETName of the application output file prefix (e.g. TestApplication).
ARCHArchitecture of the target processor (see \ref Page_DeviceSupport).
MCUName of the Atmel processor model (e.g. at90usb1287).
SRCList of relative or absolute paths to the application C (.c), C++ (.cpp) and Assembly (.S) source files.
F_USBSpeed in Hz of the input clock frequency to the target's USB controller.
LUFA_PATHPath to the LUFA library core, either relative or absolute (e.g. ../LUFA-000000/LUFA/).
- * - * \section SSec_BuildModule_BUILD_OptionalParams Optional Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
BOARDLUFA board hardware drivers to use (see \ref Page_DeviceSupport).
OPTIMIZATIONOptimization level to use when compiling source files (see GCC manual).
C_STANDARDVersion of the C standard to apply when compiling C++ source files (see GCC manual).
CPP_STANDARDVersion of the C++ standard to apply when compiling C++ source files (see GCC manual).
DEBUG_FORMATFormat of the debug information to embed in the generated object files (see GCC manual).
DEBUG_LEVELLevel of the debugging information to embed in the generated object files (see GCC manual).
F_CPUSpeed of the processor CPU clock, in Hz.
C_FLAGSFlags to pass to the C compiler only, after the automatically generated flags.
CPP_FLAGSFlags to pass to the C++ compiler only, after the automatically generated flags.
ASM_FLAGSFlags to pass to the assembler only, after the automatically generated flags.
CC_FLAGSCommon flags to pass to the C/C++ compiler and assembler, after the automatically generated flags.
LD_FLAGSFlags to pass to the linker, after the automatically generated flags.
OBJDIRDirectory to place the generated object and dependency files. If set to "." the same folder as the source file will be used. - * \note When this option is enabled, all source filenames must be unique.
OBJECT_FILESList of additional object files that should be linked into the resulting binary.
- * - * \section SSec_BuildModule_BUILD_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_BUILD_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - -/** \page Page_BuildModule_CORE The CORE build module - * - * The core LUFA build system module, providing common build system help and information targets. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_core.mk - * \endcode - * - * \section SSec_BuildModule_CORE_Requirements Requirements - * This module has no requirements outside a standard *nix shell like environment; the sh - * shell, GNU make and *nix CoreUtils (echo, printf, etc.). - * - * \section SSec_BuildModule_CORE_Targets Targets - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
helpDisplay build system help and configuration information.
list_targetsList all available build targets from the build system.
list_modulesList all available build modules from the build system.
list_mandatoryList all mandatory parameters required by the included modules.
list_optionalList all optional parameters required by the included modules.
list_providedList all variables provided by the included modules.
list_macrosList all macros provided by the included modules.
- * - * \section SSec_BuildModule_CORE_MandatoryParams Mandatory Parameters - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_CORE_OptionalParams Optional Parameters - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_CORE_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_CORE_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - -/** \page Page_BuildModule_ATPROGRAM The ATPROGRAM build module - * - * The ATPROGRAM programming utility LUFA build system module, providing targets to reprogram an - * Atmel processor FLASH and EEPROM memories with a project's compiled binary output files. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_atprogram.mk - * \endcode - * - * \section SSec_BuildModule_ATPROGRAM_Requirements Requirements - * This module requires the atprogram.exe utility to be available in your system's PATH - * variable. The atprogram.exe utility is distributed in Atmel AVR Studio 5.x and Atmel Studio 6.x - * inside the application install folder's "\avrdbg" subdirectory. - * - * \section SSec_BuildModule_ATPROGRAM_Targets Targets - * - * - * - * - * - * - * - * - * - * - *
atprogramProgram the device FLASH memory with the application's executable data.
atprogram-eeProgram the device EEPROM memory with the application's EEPROM data.
- * - * \section SSec_BuildModule_ATPROGRAM_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - * - * - * - * - *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
- * - * \section SSec_BuildModule_ATPROGRAM_OptionalParams Optional Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ATPROGRAM_PROGRAMMERName of the Atmel programmer or debugger tool to communicate with (e.g. jtagice3).
ATPROGRAM_INTERFACEName of the programming interface to use when programming the target (e.g. spi).
ATPROGRAM_PORTName of the communication port to use when when programming with a serially connected tool (e.g. COM2).
- * - * \section SSec_BuildModule_ATPROGRAM_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_ATPROGRAM_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - -/** \page Page_BuildModule_AVRDUDE The AVRDUDE build module - * - * The AVRDUDE programming utility LUFA build system module, providing targets to reprogram an - * Atmel processor FLASH and EEPROM memories with a project's compiled binary output files. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_avrdude.mk - * \endcode - * - * \section SSec_BuildModule_AVRDUDE_Requirements Requirements - * This module requires the avrdude utility to be available in your system's PATH - * variable. The avrdude utility is distributed in the old WinAVR project releases for - * Windows (winavr.sourceforge.net) or can be installed on *nix systems via the project's - * source code (https://savannah.nongnu.org/projects/avrdude) or through the package manager. - * - * \section SSec_BuildModule_AVRDUDE_Targets Targets - * - * - * - * - * - * - * - * - * - * - *
avrdudeProgram the device FLASH memory with the application's executable data.
avrdudeProgram the device EEPROM memory with the application's EEPROM data.
- * - * \section SSec_BuildModule_AVRDUDE_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - * - * - * - * - *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
- * - * \section SSec_BuildModule_AVRDUDE_OptionalParams Optional Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AVRDUDE_PROGRAMMERName of the programmer or debugger tool to communicate with (e.g. jtagicemkii).
ATPROGRAM_PORTName of the communication port to use when when programming with the connected tool (e.g. COM2, /dev/ttyUSB0 or usb).
ATPROGRAM_FLAGSAdditional flags to pass to avrdude when programming, applied after the automatically generated flags.
- * - * \section SSec_BuildModule_AVRDUDE_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_AVRDUDE_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - - /** \page Page_BuildModule_CPPCHECK The CPPCHECK build module - * - * The CPPCHECK programming utility LUFA build system module, providing targets to statically - * analyze C and C++ source code for errors and performance/style issues. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_cppcheck.mk - * \endcode - * - * \section SSec_BuildModule_CPPCHECK_Requirements Requirements - * This module requires the cppcheck utility to be available in your system's PATH - * variable. The cppcheck utility is distributed through the project's home page - * (http://cppcheck.sourceforge.net) for Windows, and can be installed on *nix systems via - * the project's source code or through the package manager. - * - * \section SSec_BuildModule_CPPCHECK_Targets Targets - * - * - * - * - * - * - * - * - * - * - *
cppcheckStatically analyze the project source code for issues.
cppcheck-configCheck the cppcheck configuration - scan source code and warn about missing header files and other issues.
- * - * \section SSec_BuildModule_CPPCHECK_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - *
SRCList of source files to statically analyze.
- * - * \section SSec_BuildModule_CPPCHECK_OptionalParams Optional Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
CPPCHECK_INCLUDESPath of extra directories to check when attemting to resolve C/C++ header file includes.
CPPCHECK_EXCLUDESPaths or path fragments to exclude when analyzing.
CPPCHECK_MSG_TEMPLATEOutput message template to use when printing errors, warnings and information (see cppcheck documentation).
CPPCHECK_ENABLEAnalysis rule categories to enable (see cppcheck documentation).
CPPCHECK_SUPPRESSSpecific analysis rules to suppress (see cppcheck documentation).
CPPCHECK_FAIL_ON_WARNINGSet to Y to fail the analysis job with an error exit code if warnings are found, N to continue without failing.
CPPCHECK_QUIETSet to Y to suppress all output except warnings and errors, N to show verbose output information.
CPPCHECK_FLAGSExtra flags to pass to cppcheck, after the automatically generated flags.
- * - * \section SSec_BuildModule_CPPCHECK_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_CPPCHECK_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - - /** \page Page_BuildModule_DFU The DFU build module - * - * The DFU programming utility LUFA build system module, providing targets to reprogram an - * Atmel processor FLASH and EEPROM memories with a project's compiled binary output files. - * This module requires a DFU class bootloader to be running in the target, compatible with - * the DFU bootloader protocol as published by Atmel. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_dfu.mk - * \endcode - * - * \section SSec_BuildModule_DFU_Requirements Requirements - * This module requires either the batchisp utility from Atmel's FLIP utility, or the open - * source dfu-programmer utility (http://dfu-programmer.sourceforge.net/) to be - * available in your system's PATH variable. On *nix systems the dfu-programmer utility - * can be installed via the project's source code or through the package manager. - * - * \section SSec_BuildModule_DFU_Targets Targets - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
dfuProgram the device FLASH memory with the application's executable data using dfu-programmer.
dfu-eeProgram the device EEPROM memory with the application's EEPROM data using dfu-programmer.
flipProgram the device FLASH memory with the application's executable data using batchisp.
flip-eeProgram the device EEPROM memory with the application's EEPROM data using batchisp.
- * - * \section SSec_BuildModule_DFU_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - * - * - * - * - *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
- * - * \section SSec_BuildModule_DFU_OptionalParams Optional Parameters - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_DFU_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_DFU_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - - /** \page Page_BuildModule_DOXYGEN The DOXYGEN build module - * - * The DOXYGEN code documentation utility LUFA build system module, providing targets to generate - * project HTML and other format documentation from a set of source files that include special - * Doxygen comments. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_doxygen.mk - * \endcode - * - * \section SSec_BuildModule_DOXYGEN_Requirements Requirements - * This module requires the doxygen utility from the Doxygen website - * (http://www.stack.nl/~dimitri/doxygen/) to be available in your system's PATH - * variable. On *nix systems the doxygen utility can be installed via the project's source - * code or through the package manager. - * - * \section SSec_BuildModule_DOXYGEN_Targets Targets - * - * - * - * - * - * - *
doxygenGenerate project documentation.
- * - * \section SSec_BuildModule_DOXYGEN_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - *
LUFA_PATHPath to the LUFA library core, either relative or absolute (e.g. ../LUFA-000000/LUFA/).
- * - * \section SSec_BuildModule_DOXYGEN_OptionalParams Optional Parameters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
DOXYGEN_CONFName and path of the base Doxygen configuration file for the project.
DOXYGEN_FAIL_ON_WARNINGSet to Y to fail the generation with an error exit code if warnings are found other than unsupported configuration parameters, N to continue without failing.
DOXYGEN_OVERRIDE_PARAMSExtra Doxygen configuration parameters to apply, overriding the corresponding config entry in the project's configuration file (e.g. QUIET=YES).
- * - * \section SSec_BuildModule_DOXYGEN_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_DOXYGEN_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - - /** \page Page_BuildModule_HID The HID build module - * - * The HID programming utility LUFA build system module, providing targets to reprogram an - * Atmel processor's FLASH memory with a project's compiled binary output file. This module - * requires a HID class bootloader to be running in the target, using a protocol compatible - * with the PJRC "HalfKay" protocol (http://www.pjrc.com/teensy/halfkay_protocol.html). - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_hid.mk - * \endcode - * - * \section SSec_BuildModule_HID_Requirements Requirements - * This module requires either the hid_bootloader_cli utility from the included LUFA HID - * class bootloader API subdirectory, or the teensy_loader_cli utility from PJRC - * (http://www.pjrc.com/teensy/loader_cli.html) to be available in your system's PATH - * variable. - * - * \section SSec_BuildModule_HID_Targets Targets - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
hidProgram the device FLASH memory with the application's executable data using hid_bootloader_cli.
hid-eeProgram the device EEPROM memory with the application's EEPROM data using hid_bootloader_cli and - * a temporary AVR application programmed into the target's FLASH. - * \note This will erase the currently loaded application in the target.
teensyProgram the device FLASH memory with the application's executable data using teensy_loader_cli.
teensy-eeProgram the device EEPROM memory with the application's EEPROM data using teensy_loader_cli and - * a temporary AVR application programmed into the target's FLASH. - * \note This will erase the currently loaded application in the target.
- * - * \section SSec_BuildModule_HID_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - * - * - * - * - *
MCUName of the Atmel processor model (e.g. at90usb1287).
TARGETName of the application output file prefix (e.g. TestApplication).
- * - * \section SSec_BuildModule_HID_OptionalParams Optional Parameters - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_HID_ProvidedVariables Module Provided Variables - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_HID_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ - - /** \page Page_BuildModule_SOURCES The SOURCES build module - * - * The SOURCES LUFA build system module, providing variables listing the various LUFA source files - * required to be build by a project for a given LUFA module. This module gives a way to reference - * LUFA source files symbollically, so that changes to the library structure do not break the library - * makefile. - * - * To use this module in your application makefile, add the following code: - * \code - * include $(LUFA_PATH)/Build/lufa_sources.mk - * \endcode - * - * \section SSec_BuildModule_SOURCES_Requirements Requirements - * None. - * - * \section SSec_BuildModule_SOURCES_Targets Targets - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_SOURCES_MandatoryParams Mandatory Parameters - * - * - * - * - * - * - * - * - * - * - *
LUFA_PATHPath to the LUFA library core, either relative or absolute (e.g. ../LUFA-000000/LUFA/).
ARCHArchitecture of the target processor (see \ref Page_DeviceSupport).
- * - * \section SSec_BuildModule_SOURCES_OptionalParams Optional Parameters - * - * - * - * - * - *
None
- * - * \section SSec_BuildModule_SOURCES_ProvidedVariables Module Provided Variables - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
LUFA_SRC_USBList of LUFA USB driver source files.
LUFA_SRC_USBCLASSList of LUFA USB Class driver source files.
LUFA_SRC_TEMPERATUREList of LUFA temperature sensor driver source files.
LUFA_SRC_SERIALList of LUFA Serial U(S)ART driver source files.
LUFA_SRC_TWIList of LUFA TWI driver source files.
LUFA_SRC_PLATFORMList of LUFA architecture specific platform management source files.
- * - * \section SSec_BuildModule_SOURCES_ProvidedMacros Module Provided Macros - * - * - * - * - * - *
None
- */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt deleted file mode 100644 index ff5fdc5230..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt +++ /dev/null @@ -1,23 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_BuildLibrary Building as a Linkable Library - * - * The LUFA library can be built as a proper linkable library (with the extention .a) under AVR-GCC, so that - * the library does not need to be recompiled with each revision of a user project. Instructions for creating - * a library from a given source tree can be found in the AVR-GCC user manual included in the WinAVR install - * /Docs/ directory. - * - * However, building the library is not recommended, as the static (compile-time) options will be - * unable to be changed without a recompilation of the LUFA code. Therefore, if the library is to be built - * from the LUFA source, it should be made to be application-specific and compiled with the static options - * that are required for each project (which should be recorded along with the library). - * - * Normal library use has the library components compiled in at the same point as the application code, as - * demonstrated in the library demos and applications. This is the preferred method, as the library is recompiled - * each time to ensure that all static options for a particular application are applied. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt deleted file mode 100644 index 51786b9bee..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt +++ /dev/null @@ -1,1444 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - - /** \page Page_ChangeLog Project Changelog - * - * \section Sec_ChangeLog120730 Version 120730 - * New: - * - Core: - * - Added new, revamped modular build system with new makefile templates - * - Added support for the BitWizard Multio and Big-Multio boards - * - Added support for the DorkbotPDX Duce board - * - Added support for the Olimex AVR-USB-32U4 board - * - Added support for the Olimex AVR-USB-T32U4 board - * - Added support for the Olimex AVR-ISP-MK2 board - * - Added new Endpoint_ConfigureEndpointTable() function - * - Added new Pipe_ConfigurePipeTable() function - * - Added build test to verify correct compilation of all board drivers using all driver APIs - * - Added build test to verify correct compilation of all bootloaders using all supported devices - * - Added build test to verify that there are no detectable errors in the codebase via static analysis - * - Added new JTAG_ENABLE() macro for the AVR8 architecture - * - Library Applications: - * - Modified the CDC Host demos to set a default CDC Line Encoding on enumerated devices - * - Added Dataflash operational checks and aborts to all projects using the Dataflash to ensure it is working correctly before use - * - Added new SerialToLCD user project contributed by Simon Foster - * - Added new RESET_TOGGLES_LIBUSB_COMPAT compile time option to the AVRISP-MKII clone programmer project (thanks to Robert Spitzenpfeil) - * - * Changed: - * - Core: - * - Android Accessory Host property strings changed from a struct of pointer to an array to prevent unaligned access on greater than 8-bit architectures - * - Audio Device Class driver changed to also require the index of the Audio Control interface within the device, for SET/GET/CUR/MIN/MAX/RES property adjustments - * - Removed variable axis support from the HID_DESCRIPTOR_JOYSTICK() macro due to OS incompatibilities, replaced with fixed 3-axis joystick report structure - * - Removed the old pseudo-scheduler from the library as it was unused and deprecated since the 090810 release - * - Endpoint indexes are now specified as full endpoint addresses within the device in device mode, rather than a logical index - * - The Endpoint_ConfigureEndpoint() function no longer takes an endpoint direction as a parameter, as this is now deduced from the specified full endpoint - * address and type - * - The Endpoint_ConfigureEndpoint() function no longer takes a number of banks as a special mask; the number of banks is now specified as an integer parameter - * - Endpoints are now configured via instances of a new struct USB_Endpoint_Table_t in all device mode class drivers, rather than a list of endpoint parameters - * - Pipe indexes are now specified as full pipe addresses within the host in host mode, rather than a logical index - * - The Pipe_ConfigurePipe() function no longer takes an pipe token as a parameter, as this is now deduced from the specified full pipe address and type - * - The Pipe_ConfigurePipe() function no longer takes a number of banks as a special mask; the number of banks is now specified as an integer parameter - * - Pipes are now configured via instances of a new struct USB_Pipe_Table_t in all host mode class drivers, rather than a list of pipe parameters - * - Added support for various assert and debugging macros for the UC3 devices - * - Changed MIDI event structure MIDI_EventPacket_t to use a single field for the combined virtual cable index and command ID, to prevent bitfield packing issues - * on some architectures (thanks to Darren Gibbs) - * - Changed board LED driver implementations of LEDs_ToggleLEDs() for the AVR8 architecture to use the fast PIN register toggle alternative function for speed - * - Library Applications: - * - Raised the guard bits in the AVRISP-MKII clone project when in PDI and TPI to 32, to prevent communication errors on low quality connections to a target - * - Added additional bootloader API data to expose the bootloader start address and class to the DFU and CDC class bootloaders - * - Reverted AVRISP-MKII clone project watchdog based command timeout patch in favour of a hardware timer, to allow for use in devices with WDTRST fuse programmed - * - The library bootloaders will now correctly start the user application after a watchdog-based application start, even if the /HWB line is held low externally - * during the reset phase - * - Increased endpoint polling interval for all demos and projects to 5ms, as 1ms was causing some enumeration issues on some machines (thanks to Riku Salminen) - * - * Fixed: - * - Core: - * - Fixed possible enumeration error if the user application selects a pipe other than the default Control pipe between the Powered and Default states of - * the host state machine - * - Fixed incorrect call to the user callback CALLBACK_Audio_Device_GetSetInterfaceProperty() in the Audio Class device driver (thanks to Tiit Ratsep) - * - Fixed compile error for the UC3 architecture when INTERRUPT_CONTROL_ENDPOINT is specified (thanks to Andrus Aaslaid) - * - Fixed compile error if LEDs_Disable() is called and BOARD=NONE is set (thanks to Sam Lin) - * - Fixed inverted LED logic in the OLIMEX162 board LED driver - * - Fixed incorrect reponse to GET STATUS requests in device mode if NO_DEVICE_SELF_POWER or NO_DEVICE_REMOTE_WAKEUP tokens are defined (thanks to Georg Glock) - * - Fixed inverted LED logic in the USB2AX board LED driver - * - Fixed possible deadlock in the CDC device driver if the USB connection is dropped while the CDC_REQ_SetLineEncoding control request is being processed by - * the stack (thanks to Jonathan Hudgins) - * - Fixed broken MIDI host driver MIDI_Host_ReceiveEventPacket() function due to not unfreezing the MIDI data IN pipe before use (thanks to Michael Brown) - * - Fixed swapped Little Endian/Big Endian endpoint and pipe write code for the UC3 devices (thanks to Andrew Chu) - * - Fixed the JTAG_DISABLE() macro clearing all other bits in MCUSR when called - * - Fixed incorrect Micropendous board LED driver LEDs_SetAllLEDs() and LEDs_ChangeLEDs() function implementations (thanks to MitchJS) - * - Fixed endianess issues in the RNDIS host class driver for UC3 devices (thanks to Andrew Chu) - * - Library Applications: - * - Fixed error in the AVRISP-MKII programmer when ISP mode is used at 64KHz (thanks to Ben R. Porter) - * - Fixed AVRISP-MKII programmer project failing to compile for the U4 chips when VTARGET_ADC_CHANNEL is defined to an invalid channel and NO_VTARGET_DETECT is - * defined (thanks to Steven Morehouse) - * - Fixed AVRISP-MKII programmer project reset line polarity inverted when the generated EEP file is loaded into the USB AVR's EEPROM and avr-dude is used - * - Fixed CDC and DFU bootloaders failing to compile when the bootloader section size is 8KB or more (thanks to Georg Glock) - * - Fixed CDC and DFU bootloaders API function offsets incorrect on some devices (thanks to Rod DeMay) - * - Fixed incorrect DFU version number reported to the host in the DFU bootloader descriptors (thanks to Georg Glock) - * - Fixed incorrect version hundredths value encoding in VERSION_BCD() macro (thanks to Georg Glock) - * - Fixed invalid configuration descriptor in the low level KeyboardMouse device demo (thanks to Jun Wako) - * - Fixed CDC and DFU bootloaders API page erase and write function failures (thanks to Martin Lambert) - * - * \section Sec_ChangeLog120219 Version 120219 - * New: - * - Core: - * - Added support for the XMEGA A3BU Xplained board - * - Added support for the new B series XMEGA devices - * - Added support for version 2 of the Teensy boards (thanks to Christoph Redecker) - * - Added support for the USB2AX boards, hardware revision 1-3 - * - Added new Android Accessory Host class driver - * - Added new USB_Host_GetDescriptor(), USB_Host_GetDeviceConfiguration() and USB_Host_GetInterfaceAltSetting() functions - * - Added new CALLBACK_Audio_Device_GetSetInterfaceProperty() callback to the Audio Device Class driver - * - Added new LEDs_Disable(), Buttons_Disable() and Joystick_Disable() functions to the board hardware drivers - * - Added support for the Micropendous family of boards (Arduino-like revisions 1 and 2, DIP, 32U2, A, 1, 2, 3 and 4) - * - Added INVERTED_VBUS_ENABLE_LINE and NO_AUTO_VBUS_MANAGEMENT compile time options (thanks to Opendous Inc.) - * - Added support for the Atmel XMEGA B1 Xplained board - * - Added Serial USART peripheral driver for the XMEGA architecture - * - Added Master Mode SPI USART peripheral driver for the XMEGA and AVR8 architectures - * - Added build test to verify correct compilation of as many modules as possible under as many architectures as possible under the C and C++ languages - * - Added build test to verify correct compilation of the USB driver when forced into single USB mode under as many architectures as possible - * - Library Applications: - * - Added User Application APIs to the CDC and DFU class bootloaders - * - Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs) - * - Added new Android Accessory Host demo (thanks to Opendous Inc.) - * - * Changed: - * - Core: - * - When automatic PLL management mode is enabled on the U4 series AVR8 chips, the PLL is now configured for 48MHz and not - * a divided 96MHz, to lower power consumption and to keep the system within the datasheet specs for 3.3V operation (thanks to Scott Vitale) - * - Added Class, ClassDevice, ClassHost and ClassCommon to the internal class driver source filenames to prevent ambiguities - * - Altered the Mass Storage Host class driver so that SCSI data STALLs from the attached device can be recovered from automatically without - * having to reset the Mass Storage interface - * - USB_CONFIG_ATTR_BUSPOWERED constant renamed to USB_CONFIG_ATTR_RESERVED, as this was misnamed (thanks to NXP Semiconductors) - * - Reordered board name definition indexes so that a mispelled BOARD compile option will default to BOARD_USER rather than BOARD_USBKEY - * - Altered the HID class driver to only try to construct at maximum one packet per USB frame, to reduce CPU usage - * - All USB Class Driver configuration struct values are now non-const, to allow for run-time modifications if required before configuring an instance - * - Library Applications: - * - Altered the Mass Storage Host LowLevel demo so that SCSI data STALLs from the attached device can be recovered from automatically without - * having to reset the Mass Storage interface - * - Updated the AVRISP-MKII Clone programmer project to be compatible with the latest version of AVR Studio (version 5.1) - * - Changed the AVRISP-MKII Clone programmer project to report a fixed 3.3V VTARGET voltage on USB AVRs lacking an ADC instead of 5V to prevent - * warnings in AVR Studio 5.1 when programming XMEGA devices - * - Allow serial strings to be generated on the older AVR8 devices which do not explicitly state they contain unique values in the datasheet, - * as this appears to be implemented in hardware - * - * Fixed: - * - Core: - * - Fixed ring buffer size limited to 255 elements, instead of the intended 65535 elements. - * - Fixed CDC class drivers not saving and sending all 16-bits of the control line states (thanks to Matthew Swabey) - * - Fixed race conditions in the CDC, HID and Mass Storage class drivers when processing some control requests - * - Fixed misspelled HID_KEYBOARD_MODIFIER_* macros in the HID class driver (thanks to Laszlo Monda) - * - Fixed broken AVR32 endpoint/pipe communications when ORDERED_EP_CONFIG compile time option is not enabled (thanks to Matthias Jahr) - * - Fixed broken compilation for the AVR32 devices if the NO_SOF_EVENTS compile time option was not enabled (thanks to Matthias Jahr) - * - Fixed compiler warning on GCC with \c -wundef compile flag is used (thanks to Georg Glock) - * - Fixed incorrect implementation of LEDs_ToggleLEDs() for the Adafruit-U4 board (thanks to Caroline Saliman) - * - Fixed broken compilation of LUFA under C++ compilers when the Serial peripheral module header file is included in a C++ source file - * - Fixed missing semicolon in the UC3 architecture host pipe functions - * - Fixed failed compilation for the XMEGA architecture if USB_DEVICE_ONLY us not specified - * - Fixed UC3 architecture ignoring the pipe size when Pipe_ConfigurePipe() is called - * - Library Applications: - * - Added reliability patches to the AVRISP-MKII Clone project's PDI/TPI protocols (thanks to Justin Mattair) - * - Fixed AVRISP-MKII Clone compile warning on AVR8 U4 targets even when NO_VTARGET_DETECT is enabled - * - Fixed AVRISP-MKII Clone failing to start application firmware once a TPI programming session is exited - * - Fixed DFU class bootloader not resetting the LED pins as high impedance inputs when a software jump to the user applications is requested - * - Fixed AVRISP-MKII Clone timing out on long programming commands such as programming the EEPROM on an ATMEGA8 (thanks to Martin Kelling) - * - Fixed invalid PID value used in the TempDataLogger project host application (thanks to Anupam Pathak) - * - * \section Sec_ChangeLog111009 Version 111009 - * New: - * - Core: - * - Added USE_LUFA_CONFIG_HEADER compile time option to include a LUFAConfig.h header in the user director for LUFA configuration - * tokens as an alternative to tokens defined in the project makefile - * - Added new USB_Host_SetInterfaceAltSetting() convenience function for the selection of an interface's alternative setting - * - Added Audio class control request definitions - * - Added new CALLBACK_Audio_Device_GetSetEndpointProperty() callback to the Audio Device Class driver to allow for endpoint control manipulations - * such as data sample rates - * - Added support for the Audio class GET STATUS request in the Audio Device Class driver so that it is correctly ACKed when sent by the host - * - Added new EVENT_Audio_Device_StreamStartStop() event to the Audio Device Class driver to detect stream start/stop events - * - Added board driver support for the Busware TUL board - * - Added board hardware driver support for the EVK1100 board - * - Added board hardware driver support for the EVK1104 board - * - Added new Host mode Audio Class driver - * - Added new SPI_GetCurrentMode() function to the SPI peripheral driver - * - Added RingBuffer_GetFreeCount() function to the Ring Buffer driver - * - Added new HID_Host_SetIdlePeriod() function to the HID Host Class driver - * - Added new USB_Host_ConfigurationNumber global variable to indicate the selected configuration in an attached device - * - Added new USB_Host_GetDeviceStatus() function to the host standard request function set - * - Added AVR USB XMEGA architecture port (currently incomplete/experimental) - * - Added new STRINGIFY() and STRINGIFY_EXPANDED() convenience macros - * - Added new JTAG_DISABLE() macro for the AVR8 architecture - * - Added Device Qualifier standard descriptor structure definitions USB_StdDescriptor_DeviceQualifier_t and USB_Descriptor_DeviceQualifier_t - * - Library Applications: - * - Added RNDIS device mode to the Webserver project - * - Added new incomplete AndroidAccessoryHost Host LowLevel demo - * - Added new HIDReportViewer project - * - Added new MediaControl project - * - Added new AudioInputHost Host ClassDriver demo - * - Added new AudioOutputHost Host ClassDriver demo - * - Added new AudioInputHost Host LowLevel demo - * - Added new AudioOutputHost Host LowLevel demo - * - Added new "checksource" target to all library project makefiles - * - Added new VTARGET_USE_INTERNAL_REF configuration option to the AVRISP-MKII clone project (thanks to Volker Bosch) - * - * Changed: - * - Core: - * - Altered the definition of the USB_Audio_Descriptor_Format_t descriptor so that the user is now responsible for supplying - * the supported audio sampling rates, to allow for multiple audio interfaces with different numbers of supported rates and/or - * continuous sample rates - * - Pipe_BoundEndpointNumber() has been renamed to Pipe_GetBoundEndpointAddress(), and now returns the correct endpoint direction - * as part of the endpoint address - * - Renamed global state variables that are specific to a certain USB mode to clearly indicate which mode the variable relates to, - * by changing the USB_* prefix to USB_Device_* or USB_Host_* - * - Removed the HOST_STATE_WaitForDeviceRemoval and HOST_STATE_Suspended host state machine states, as these are no longer required - * - Altered the USB_Host_SetDeviceConfiguration() function to update the global Host state machine state and the new - * USB_Host_ConfigurationNumber global as required - * - Added endian correcting code to the library USB class drivers for multiple architecture support - * - Removed the ENDPOINT_DESCRIPTOR_DIR_* macros, replaced by ENDPOINT_DIR_* instead - * - Renamed the JTAG_DEBUG_ASSERT() macro to JTAG_ASSERT() - * - Added variable number of axis to HID_DESCRIPTOR_JOYSTICK() for multi-axis joysticks above just X and Y - * - Renamed USB_Host_ClearPipeStall() to USB_Host_ClearEndpointStall() as the function works on an endpoint address within the attached device, - * and not a Pipe within the host - * - The MS_Host_ResetMSInterface() now performs a full Mass Storage reset sequence to prevent data corruption in the event of a device - * lock up or timeout (thanks to David Lyons) - * - Added endian-correction to the CDC driver's Line Encoding control request handlers. - * - Library Applications: - * - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple audio sample rates - * - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration - * instead of manual host state machine manipulations in the main application task - * - Changed the reports in the GenericHID device demos to control the board LEDs, to reduce user confusion over the callback routines - * - Added reliability patches to the AVRISP-MKII Clone project's ISP and PDI/TPI protocols (thanks to Justin Mattair) - * - * Fixed: - * - Core: - * - Large number of documentation and code comment corrections (thanks to Andrey from Microsin.ru) - * - Fixed possibility of the AVR's SPI interface being pulled out of master mode if the /SS pin is a input and pulled low (thanks - * to Andrey from Microsin.ru) - * - Fixed compile error when FIXED_CONTROL_ENDPOINT_SIZE compile time option was disabled, and a USE_*_DESCRIPTORS compile time - * option was not enabled on the AVR8s - * - Fixed lack of C++ compatibility in some internal header files causing compile errors when using LUFA in C++ projects - * - Fixed error in the pipe unordered allocation algorithm for the AVR8 devices breaking compatibility with some devices - * - Fixed USB_USBTask not being called internally in stream transfers between packets when Partial Stream Transfers are used - * - Fixed swapped TWI_ADDRESS_READ and TWI_ADDRESS_WRITE values - * - Fixed TWI_ReadPacket() not releasing the TWI bus on read completion - * - Fixed optimization error in the HID Parser item value USB_SetHIDReportItemInfo() and USB_GetHIDReportItemInfo() routines if the report item was - * \c NULL (which should be allowable according to the API) - * - Fixed HID Parser CALLBACK_HIDParser_FilterHIDReportItem() callback function not being passed a cacheable report item pointer - * - Fixed HID Parser's largest report size bit count not including the size of the last parsed report item - * - Fixed HID host driver's largest HID report size count corrupt when the number of report bits exceeds 255 - * - Library Applications: - * - Fixed incorrect signature in the CDC and DFU class bootloaders for the ATMEGA8U2 - * - Fixed KeyboardHost and KeyboardHostWithParser demos displaying incorrect values when numerical keys were pressed - * - Fixed compile errors in the incomplete BluetoothHost demo application (thanks to Timo Lindfors) - * - Fixed incorrect Dataflash buffer use in the DataflashManager_WriteBlocks_RAM() function of several demos/projects (thanks to Jeremy Willden) - * - Fixed incorrect logging interval (always 500ms longer than requested) in the TempDataLogger project - * - Fixed incorrect buffer size check in the USBtoSerial project (thanks to Yuri A Nikiforov) - * - Fixed port state table corruption in the TCP layer of the RNDIS Ethernet device demos - * - * \section Sec_ChangeLog110528 Version 110528 - * New: - * - Core: - * - Added new ORDERED_EP_CONFIG compile time option to restrict endpoint/pipe configuration to ascending order - * in exchange for a smaller compiled program binary size - * - Added a new general RingBuff.h miscellaneous ring buffer library driver header - * - Added new GCC_FORCE_POINTER_ACCESS() macro to correct GCC's mishandling of struct pointer accesses - * - Added new GCC_MEMORY_BARRIER() macro to prevent instruction reordering across boundaries - * - Added basic driver example use code to the library documentation - * - Added new Endpoint_Null_Stream() and Pipe_Null_Stream() functions - * - Added new ADC_GET_CHANNEL_MASK() convenience macro - * - Added new HID report item macros (with HID_RI_ prefix) to allow for easy creation and editing of HID report descriptors - * - Added new HID_DESCRIPTOR_MOUSE(), HID_DESCRIPTOR_KEYBOARD(), HID_DESCRIPTOR_JOYSTICK() and HID_DESCRIPTOR_VENDOR() macros - * for easy automatic creation of basic USB HID device reports - * - Added new MAX() and MIN() convenience macros - * - Added new Serial_SendData() function to the Serial driver - * - Added board driver support for the Sparkfun ATMEGA8U2 breakout board - * - Added TWI baud rate prescaler and bit length parameters to the TWI_Init() function (thanks to Thomas Herlinghaus) - * - Internal restructuring for eventual multiple architecture ports - * - Added AVR32 UC3 architecture port (currently incomplete/experimental) - * - Added new architecture independent functions to enable, disable, save and restore the Global Interrupt Enable flags - * - Added new RNDIS Device Class Driver packet send and receive functions - * - Library Applications: - * - Added ability to write protect Mass Storage disk write operations from the host OS - * - Added new MIDIToneGenerator project - * - Added new KeyboardMouseMultiReport Device ClassDriver demo - * - Added new VirtualSerialMassStorage Device ClassDriver demo - * - Added HID class bootloader, compatible with a modified version of the command line Teensy loader from PJRC.com - * - Added LED flashing to the CDC and DFU class bootloaders to indicate when they are running - * - * Changed: - * - Core: - * - Unordered Endpoint/Pipe configuration is now allowed once again by default via the previous reconfig workaround - * - Refactored Host mode Class Driver *_Host_ConfigurePipes() routines to be more space efficient when compiled - * - Added new *_ENUMERROR_PipeConfigurationFailed error codes for the *_Host_ConfigurePipes() routines - * - The USARTStream global is now public and documented in the SerialStream module, allowing for the serial USART - * stream to be accessed via its handle rather than via the implicit stdout and stdin streams - * - The FAST_STREAM_TRANSFERS compile time option has been removed due to lack of use and low cost/benefit ratio - * - Altered all endpoint/pipe stream transfers so that the new BytesProcessed parameter now points to a location - * where the number of bytes in the transfer that have been completed can be stored (or NULL if entire transaction - * should be performed in one chunk) - * - The NO_STREAM_CALLBACKS compile time option has now been removed due to the new partial stream transfer feature - * - Changed over all project and demo HID report descriptors to use the new HID report item macros - * - Moved the HIDParser.c source file to the LUFA/Drivers/USB/Class/Common/ directory from the LUFA/Drivers/USB/Class/Host/ - * - Added support to the HID parser for extended USAGE items that contain the usage page as well as the usage index - * - Removed the SerialStream driver, rolled functionality into the regular Serial peripheral driver via the new - * Serial_CreateStream() and Serial_CreateBlockingStream() functions - * - Renamed the low level Serial byte send/receive functions, to be consistent with the CDC class driver byte functions - * - Altered the behaviour of the serial byte reception function so that is is non-blocking, and now returns a negative - * value if no character is received (to remain consistent with the CDC class driver byte reception routines) - * - Renamed the PRNT_Host_SendString(), CDC_Host_SendString() and CDC_Device_SendString() functions to *_SendData(), and - * added new versions of the *_SendString() routines that expect a null terminated string instead - * - Renamed all driver termination *_ShutDown() functions to the more logical name *_Disable() - * - Reduced latency for executing the Start-Of-Frame events (if enabled in the user application) - * - Removed Pipe_ClearErrorFlags(), pipe error flags are now automatically cleared when Pipe_ClearError() is called - * - Endpoint_ResetFIFO() renamed to Endpoint_ResetEndpoint(), to be consistent with the Pipe_ResetPipe() function name - * - Implemented on-demand PLL clock generation for the U4, U6 and U7 series USB AVRs when automatic PLL mode is specified - * - F_CLOCK changed to F_USB to be more descriptive, and applicable on future architecture ports - * - Renamed all low level Endpoint_Read_*, Endpoint_Write_* and Endpoint_Discard_* functions to use the number of bits instead of - * a symbolic size (Byte, Word, DWord) so that the function names are applicable and correct across all architectures - * - Renamed all low level Pipe_Read_*, Pipe_Write_* and Pipe_Discard_* functions to use the number of bits instead of - * a symbolic size (Byte, Word, DWord) so that the function names are applicable and correct across all architectures - * - Separated out board drivers by architecture in the library internals for better organisation - * - Library Applications: - * - Changed the XPLAINBridge software UART to use the regular timer CTC mode instead of the alternative CTC mode - * via the Input Capture register, to reduce user confusion - * - Combined page and word ISP programming mode code in the AVRISP-MKII clone project to reduce compiled size and - * increase maintainability of the code - * - Changed over library projects to use the new general ring buffer library driver module - * - Added new high level TWI packet read/write commands, altered behaviour of the TWI_StartTransmission() function - * - Changed TempDataLogger project's DS1307 driver to simplify the function interface and prevent a possible race condition - * - Changed AVRISP-MKII project to use the Watchdog interrupt for command timeouts, to reduce CPU usage and free timer 0 - * for other uses - * - Updated the software USART code in the XPLAIN Bridge application so that the incoming bits are sampled at their mid-point - * instead of starting point, to give maximum reliability (thanks to Anton Staaf) - * - * Fixed: - * - Core: - * - Fixed broken USBFOO board drivers due to missing BOARD_USBFOO define - * - Fixed HID host class driver incorrectly binding to HID devices that do not have an OUT endpoint - * - Fixed incorrect definition of the HID_KEYBOARD_SC_D constant in the HID class driver (thanks to Opendous Inc.) - * - Fixed incorrect definition of the HID_KEYBOARD_SC_RIGHT_ARROW constant in the HID class driver (thanks to Joby Taffey) - * - Fixed incorrect endpoint initialisation order in the several device demos (thanks to Rick Drolet) - * - Fixed inverted Minimus board LEDs - * - Fixed incorrect byte ordering in the Audio_Device_WriteSample24 function (thanks to WZab) - * - Fixed several functions in the Host mode Still Image Class driver returning an error code from the incorrect - * error code enum (thanks to Daniel Seibert) - * - Fixed ReportID not being removed from the feature/out report data array in the HID class driver when Report IDs are used - * - Fixed incorrect BUTTONS_BUTTON1 definition for the Minimus board - * - Fixed Still Image Host class driver exiting the descriptor search routine prematurely if the data pipes (but not event pipe) - * is found - * - Fixed missing call to Pipe_SetInfiniteINRequests() in the Pipe_ConfigurePipe() routine - * - Fixed Remote Wakeup broken on the AVRs due to the mechanism only operating when the SUSPI bit is set (thanks to Holger Steinhaus) - * - Fixed possible invalid program execution when in host mode if corrupt descriptor lengths are supplied by the attached device - * - Library Applications: - * - Fixed Benito project discarding incoming data from the USB virtual serial port when the USART is busy - * - Fixed broken DFU bootloader, added XPLAIN support for bootloader start when XCK jumpered to ground - * - Fixed broken HID_REQ_GetReport request handler in the Low Level GenericHID demo - * - Fixed possible lost data in the XPLAINBridge, USBtoSerial and Benito projects when the host exceeds the packet - * timeout period on received packets as set by USB_STREAM_TIMEOUT_MS (thanks to Justin Rajewski) - * - Fixed possible programming problem in the AVRISP-MKII clone project when programming specific patterns into a target - * memory space that is only byte (not page) addressable - * - Fixed errors in the incomplete Test and Measurement device demo preventing proper operation (thanks to Pavel Plotnikov) - * - Fixed programming errors in the AVRISP-MKII project when the programming packet is a round multiple of the endpoint bank - * size under avrdude (thanks to Steffan Woltjer) - * - * - * \section Sec_ChangeLog101122 Version 101122 - * New: - * - Core: - * - Added new SCSI_ASENSE_NOT_READY_TO_READY_CHANGE constant to the Mass Storage class driver, to indicate when a previously - * not ready removable medium has now become ready for the host's use (thanks to Martin Degelsegger) - * - Moved the Pipe and Endpoint stream related code to two new USB library core source files EndpointStream.c and PipeStream.c - * - Added new USB_Device_GetFrameNumber() and USB_Host_GetFrameNumber() functions to retrieve the current USB frame number - * - Added new USB_Host_EnableSOFEvents(), USB_Host_DisableSOFEvents() and EVENT_USB_Host_StartOfFrame() for the user application - * handling of USB Start of Frame events while in USB Host mode - * - Added new PRNT_Host_BytesReceived(), PRNT_Host_ReceiveByte(), PRNT_Host_SendByte() and PRNT_Host_Flush() functions to the - * Print Host Class driver - * - Added class specific descriptor alternative struct type defines with standard USB-IF element naming - * - Added new project makefile template to the library and moved board driver stub files into in a new "CodeTemplates" directory - * - Added board hardware driver support for the Adafruit U4 breakout board - * - Added board hardware driver support for the Arduino Uno development board - * - Added board hardware driver support for the Blackcat USB JTAG board (thanks to the PSGroove team) - * - Added board hardware driver support for the Busware BUI development board - * - Added board hardware driver support for the Busware CUL V3 868MHZ radio board (thanks to Dirk Tostmann) - * - Added board hardware driver support for the Kernel Concepts USBFOO development board - * - Added board hardware driver support for the Linnix UDIP development board - * - Added board hardware driver support for the Olimex AVR-USB-162 development board (thanks to Steve Fawcett) - * - Added board hardware driver support for the Maximus board (thanks to the PSGroove team) - * - Added board hardware driver support for the Microsin AVR-USB162 breakout board - * - Added board hardware driver support for the Minimus board (thanks to the PSGroove team) - * - Added new NO_CLASS_DRIVER_AUTOFLUSH compile time option to disable automatic flushing of interfaces when the USB management - * tasks for each driver is called - * - Added standard keyboard HID report scan-code defines (thanks to Laszlo Monda) - * - Added new Pipe_GetBusyBanks(), Endpoint_GetBusyBanks() and Endpoint_AbortPendingIN() functions - * - Library Applications: - * - Added default test tone generation mode to the Device mode AudioInput demos - * - Added new NO_BLOCK_SUPPORT, NO_EEPROM_BYTE_SUPPORT, NO_FLASH_BYTE_SUPPORT and NO_LOCK_BYTE_WRITE_SUPPORT compile time options to the - * CDC class bootloader - * - Added new XCK_RESCUE_CLOCK_ENABLE compile time option to the AVRISP-MKII clone programmer project (thanks to Tom Light) - * - * Changed: - * - Core: - * - Removed complicated logic for the Endpoint_ConfigureEndpoint() function to use inlined or function called versions - * depending of if the given bank size is a compile time constant, as the compiler does a better job of optimizing - * with basic code - * - Changed the signature of the CALLBACK_USB_GetDescriptor() callback function so that the descriptor pointer is const, to remove - * the need for extra casting inside the callback (thanks to Jonathan Kollasch) - * - Reduced HOST_DEVICE_SETTLE_DELAY_MS to 1000ms down from 1500ms to improve device compatibility while in USB Host mode - * - Removed the EVENT_USB_InitFailure() event, not specifying a USB mode correctly now defaults to UID selection mode - * - Renamed and moved class driver common constant definitions to make the naming scheme more uniform - * - Moved the USB mode specifier constants into a new enum, so that they are semantically related to one another - * - Renamed ENDPOINT_DOUBLEBANK_SUPPORTED() to ENDPOINT_BANKS_SUPPORTED() and changed it to return the maximum number of supported banks for - * the given endpoint - * - Better algorithm to extract and convert the internal device serial number into a string descriptor (if present) - * - All USB class drivers are now automatically included when LUFA/Drivers/USB.h is included, and no longer need to be separately included - * - The MIDI class drivers now automatically flushes the MIDI interface when the MIDI class driver's USBTask() function is called - * - Renamed the EVENT_USB_Device_UnhandledControlRequest() event to EVENT_USB_Device_ControlRequest() as it is now fired before the library - * request handlers, not afterwards - * - Library Applications: - * - Changed over all device demos to use a clearer algorithm for the configuring of the application's endpoints - * - Added missing DataflashManager_CheckDataflashOperation() function to the MassStorageKeyboard demo, removed redundant - * SCSI_Codes.h file as these values are part of the MassStorage Class Driver - * - Added compile time error to the AVRISP-MKII project when built for the U4 chips, as the default VTARGET detection ADC channel - * does not exist on these chips (thanks to Marco) - * - Changed all Device mode LowLevel demos and Device Class drivers so that the control request is acknowledged and any data - * transferred as quickly as possible without any processing in between sections, so that long callbacks or event handlers will - * not break communications with the host by exceeding the maximum control request stage timeout period - * - Changed over all demos, drivers and internal functions to use the current frame number over the Start of Frame flag where possible - * to free up the Start of Frame flag for interrupt use in the user application - * - All project makefiles now correctly clean intermediate build files from assembly and C++ sources (thanks to Daniel Czigany) - * - Changed default value for the reset polarity parameter in the AVRISP-MKII project so that it defaults to active low drive - * - Changed configuration descriptor parser for all host mode projects and class drivers to ensure better compatibility with devices - * - All LowLevel demos changed to use the constants and types defined in the USB class drivers - * - Changed AudioInput and AudioOutput demos to reload the next sample via an interrupt rather than polling the sample timer - * - Rescue clock of the AVRISP-MKII moved to the AVR's OCR1A pin, so that the clock can be generated at all times - * - Changed ClassDriver MIDI demos to process all incoming events in a loop until the bank becomes empty rather than one at a time - * - Changed LowLevel MIDI demos to only clear the incoming event bank once it has become empty to support packed event packets - * - * Fixed: - * - Core: - * - Fixed USB_GetHIDReportItemInfo() function modifying the given report item's data when the report item does not exist - * within the supplied report of a multiple report HID device - * - Fixed critical pipe/endpoint memory allocation issue where the bank memory address space could be silently overlapped - * in the USB controller if the endpoints or pipes were allocated in anything other than ascending order (thanks to Martin Degelsegger) - * - Added LEDs_ToggleLEDs() function to several board LED drivers which were missing it (thanks to Andrei Krainev) - * - Fixed SET FEATURE and CLEAR FEATURE control requests directed at an unconfigured endpoint causing request timeouts - * - Fixed USB_Host_ClearPipeStall() incorrectly determining the endpoint direction from the currently selected pipe - * - Fixed JTAG_DEBUG_POINT() and JTAG_DEBUG_BREAK() macros not compiling under pure C99 standards mode - * - Fixed endpoint selection within the CALLBACK_HID_Device_CreateHIDReport() callback function causing broken GET REPORT requests - * - Fixed incorrect command name for EEPROM memory programming in the makefile dfu-ee target - * - Fixed incorrect LEDs_ChangeLEDs() function in the Benito board LED driver - * - Fixed incorrect USB_DeviceState value when unconfiguring the device without an address set - * - Fixed SPI driver not explicitly setting /SS and MISO pins as inputs when SPI_Init() is called - * - Fixed random enumeration failure while in device mode due to interrupts causing the Set Address request to exceed maximum timings - * - Fixed MIDI_Host_Flush() not aborting early when the specified MIDI host interface was not configured - * - Fixed MIDI class driver send routines silently discarding packets if the endpoint or pipe is busy (thanks to Robin Green) - * - Library Applications: - * - Fixed MassStorage based demos and projects resetting the SCSI sense values before the command is executed, leading to - * missed SCSI sense values when the host retrieves the sense key (thanks to Martin Degelsegger) - * - Fixed USBtoSerial and Benito project SetLineEncoding calls failing if the USART is busy, due to the RX ISR delaying the control - * request handler - * - Fixed LowLevel PrinterHost demo not sending control requests to the attached printer with the correct printer interface wIndex value - * - Fixed incorrect signature reported in the CDC class bootloader for the ATMEGA32U2 - * - Fixed BootloaderCDC project failing on some operating systems due to removed Line Encoding options (thanks to Alexey Belyaev) - * - Fixed broken FLASH/EEPROM programming in the AVRISP-MKII clone project when writing in non-paged mode and the polling byte cannot be used - * - Fixed ISR definition conflict in the XPLAIN bridge between the software UART and the AVRISP-MKII ISP modules - * - Fixed USBtoSerial and XPLAINBridge demos discarding data from the PC if the send buffer becomes full - * - Fixed broken input in the MagStripe reader project due to an incorrect HID report descriptor - * - Fixed incorrect PollingIntervalMS values in the demo/project/bootloader endpoint descriptors (thanks to MCS Electronics) - * - Fixed AVRISP-MKII clone project not starting the target's program automatically after exiting TPI programming mode - * - * - * \section Sec_ChangeLog100807 Version 100807 - * New: - * - Added new ADC_DisableChannel() function (thanks to Mich Davis) - * - Added new VTARGET_REF_VOLTS and VTARGET_SCALE_FACTOR compile time defines to the AVRISP-MKII programmer project to set - * the VTARGET reference voltage and scale factor - * - Added new pgm_read_ptr() macro to Common.h for reading of pointers out of flash memory space - * - Added new SWAPENDIAN_16() and SWAPENDIAN_32() macros to Common.h for statically initialized variables at compile time - * - Added new Drivers/USB/LowLevel/Device.c file to house Device mode specific functions that are more complicated than simple macros - * - Added new AVRStudio 4 project files for all library demos, projects and bootloaders - * - Added ability to set the serial baud rate via the user's terminal in the XPLAINBridge project - * - Added new LUFA module variables for the different source modules in the core library makefile to simplify project makefiles - * - Added start of a new Test and Measurement class demo (thanks to Peter Lawrence) - * - Added new SPI_ORDER_* data order masks to the SPI peripheral driver - * - Added support to the AVRISP-MKII project for ISP speeds slower than 125KHz via a new software SPI driver - * - Added support for the new button/LED on the latest model USBTINY-MKII - * - * Changed: - * - The RingBuff library code has been replaced in the XPLAINBridge, Benito and USBtoSerial projects with an ultra lightweight - * ring buffer to help improve the reliability of the projects - * - The EEPROM stream read/write functions now use eeprom_update_byte() instead of eeprom_write_byte(), so that only - * changed bytes are written to EEPROM to preserve its lifespan - * - Changed over the AVRISP-MKII and TemperatureDataLogger projects to use eeprom_update_byte() when writing non-volatile - * parameters to EEPROM to preserve its lifespan - * - Removed unused line encoding data and control requests from the CDC Bootloader code, to save space - * - Renamed SERIAL_STREAM_ASSERT() macro to STDOUT_ASSERT() - * - The USB_Device_IsRemoteWakeupSent() and USB_Device_IsUSBSuspended() macros have been deleted, as they are now obsolete - * - Rewrote the implementation of the SwapEndian_16() and SwapEndian_32() functions so that they compile down in most instances to - * minimal loads and stores rather than complicated shifts - * - The software UART in the XPLAINBridge has been largely altered to try to improve upon its performance and reliability - * - The USBtoSerial and Benito projects now flushes received data via a flush timer, so that several bytes can be transmitted at once - * - Removed the automated checking of event names in the demo, project and bootloader makefiles due to inconsistencies between the - * behaviour of the command line tools used to perform the check on each platform - * - Internal USB driver source files renamed and moved to ease future possible architecture ports - * - All internal pseudo-function macros have been converted to true inline functions for type-safety and readability - * - Changed LED indicator masks for the AVRISP-MKII project, so that there are defined roles for each LED - * - Altered the CDC Device and Host Class drivers' receive byte routines, so that no data is indicated by the function returning a - * negative value (thanks to Andreas Paulin) - * - Added auto flushing of OUT data to the CDC Host Class driver's USBTask function to automatically flush the send pipe buffer - * - * Fixed: - * - Fixed AVRISP project sending a LOAD EXTENDED ADDRESS command to 128KB AVRs after programming or reading from - * the last page of FLASH (thanks to Gerard Sexton) - * - Fixed AVRISP project not sending a full erase-and-write EEPROM command to XMEGA targets when writing to the EEPROM - * instead of the split write-only command (thanks to Tim Margush) - * - Fixed RNDISEthernet demos crashing when calculating checksums for Ethernet/TCP packets of more than ~500 bytes due to - * an overflow in the checksum calculation loop (thanks to Kevin Malec) - * - Fixed XPLAINBridge project not correctly reading the XMEGA's supply voltage when reporting back to the host - * - Fixed incorrect signature for the ATMEGA32U2 in the DFU bootloader (thanks to Axel Rohde) - * - Fixed internal device serial not being accessible on the ATMEGAXXU2 AVRs (thanks to Axel Rohde) - * - Fixed void pointer arithmetic in ConfigDescriptor.h breaking C++ compatibility (thanks to Michael Hennebry) - * - Fixed broken PDI EEPROM Section Erase functionality in the AVRISP-MKII project - * - Fixed USB_Device_SendRemoteWakeup() not working when the USB clock was frozen during USB bus suspend (thanks to Brian Dickman) - * - Fixed occasional lockup of the AVRISP project due to the timeout extension code incorrectly extending the timeout in - * PDI and TPI programming modes infinitely - * - Fixed HID device class driver still using PrevReportINBuffer for GetReport control requests even when it has been - * set to NULL by the user application (thanks to Axel Rohde) - * - Fixed MIDI_Device_SendEventPacket() not correctly waiting for the endpoint to become ready (thanks to Robin Green) - * - Fixed Benito and USBtoSerial projects not turning off the USART before reconfiguring it, which could cause incorrect - * operation to occur (thanks to Bob Paddock) - * - Fixed Serial peripheral driver not turning off the USART before reconfiguring it, which would cause incorrect operation - * to occur (thanks to Bob Paddock) - * - Fixed software application start command broken in the DFU class bootloader when dfu-programmer is used due to application - * start address corruption - * - * - * \section Sec_ChangeLog100513 Version 100513 - * New: - * - Added incomplete MIDIToneGenerator project - * - Added new Relay Controller Board project (thanks to OBinou) - * - Added board hardware driver support for the Teensy, USBTINY MKII, Benito and JM-DB-U2 lines of third party USB AVR boards - * - Added new ATTR_NO_INIT variable attribute for global variables that should not be automatically cleared on startup - * - Added new ENDPOINT_*_BusSuspended error code to the Endpoint function, so that the stream functions early-abort if the bus - * is suspended before or during a transfer - * - Added new EVENT_CDC_Device_BreakSent() event and CDC_Host_SendBreak() function to the Device and Host CDC Class drivers - * - Added ReportType parameter to the HID device class driver CALLBACK_HID_Device_ProcessHIDReport() function so that FEATURE - * reports from the host to the device can be correctly processed - * - Added ReportType parameter to the HID host class driver HID_Host_SendReportByID() function so that FEATURE reports can be - * issued to the attached device - * - * Changed: - * - AVRISP programmer project now has a more robust timeout system - * - Added a timeout value to the TWI_StartTransmission() function, within which the addressed device must respond - * - Webserver project now uses the board LEDs to indicate the current IP configuration state - * - Added ENABLE_TELNET_SERVER compile time option to the Webserver project to disable the TELNET server if desired - * - Increased throughput of the USBtoSerial demo on systems that send multiple bytes per packet (thanks to Opendous Inc.) - * - Double bank CDC endpoints in the XPLAIN Bridge project, re-enable JTAG once the mode selection pin has been sampled. - * - Standardized the naming scheme given to configuration descriptor sub-elements in the Device mode demos, bootloaders - * and projects - * - All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed - * - Added LIBUSB_FILTERDRV_COMPAT compile time option to the AVRISP programmer project to make the code compatible with Windows - * builds of avrdude at the expense of AVRStudio compatibility - * - Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code - * - The USB_Init() function no longer calls sei() - the user is now responsible for enabling interrupts when they are ready - * for them to be enabled (thanks to Andrei Krainev) - * - The Audio_Device_IsSampleReceived() and Audio_Device_IsReadyForNextSample() functions are now inline, to reduce overhead - * - Removed the cast to uint16_t on the set baud rate in the USBtoSerial project, so that the higher >1M baud rates can be - * selected (thanks to Steffan Woltjer) - * - Removed software PDI and TPI emulation from the AVRISP-MKII clone project as it was very buggy and slow - PDI and TPI must - * now be implemented via separate programming headers - * - The CDC class bootloader now uses a watchdog reset rather than a soft-reset when exited to ensure that all hardware is - * properly reset to their defaults - * - Device mode class driver callbacks are now fired before the control request status stage is sent to prevent the host from - * timing out if another request is immediately fired and the device has a lengthy callback routine - * - The TeensyHID bootloader has been removed, per request from Paul at PJRC - * - The LIBUSB_FILTERDRV_COMPAT compile time option in the XPLAINBridge and AVRISP-MKII projects has been renamed - * LIBUSB_DRIVER_COMPAT, as it applies to all software on all platforms using the libUSB driver - * - * Fixed: - * - Fixed possible device lockup when INTERRUPT_CONTROL_ENDPOINT is enabled and the control endpoint is not properly - * selected when the ISR completes - * - Fixed AVRISP-MKII clone project not correctly issuing LOAD EXTENDED ADDRESS commands when the extended address - * boundary is crossed during programming or read back (thanks to Gerard Sexton) - * - Fixed warnings when building the AVRISP-MKII clone project with the ENABLE_XPROG_PROTOCOL compile time option disabled - * - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin - * - Fixed TWI_StartTransmission() corrupting the contents of the GPIOR0 register - * - Fixed TWI driver not aborting when faced with no response after attempting to address a device on the bus - * - Fixed ADC routines not correctly returning the last result when multiple channels were read - * - Fixed ADC routines failing to read the extended channels (Channels 8 to 13, Internal Temperature Sensor) on the - * U4 series USB AVR parts - * - Fixed LowLevel MassStorage demo broken on the U2 series USB AVRs due to unsupported double-banked endpoint modes used - * - Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL is defined (thanks to C. Scott Ananian) - * - Fixed incorrect definition of HID_ALIGN_DATA() causing incorrect HID report item data alignment - * - Fixed Still Image Host class driver not resetting the transaction ID when a new session is opened, fixed driver not sending - * a valid session ID to the device - * - Removed invalid dfu and flip related targets from the bootloaders - bootloaders can only be replaced with an external programmer - * - Fixed Set/Clear Feature requests directed to a non-configured endpoint not returning a stall to the host - * - Fixed HID Device Class Driver not allocating a temporary buffer when the host requests a report via the control endpoint and the - * user has set the PrevReportINBuffer driver configuration element to NULL (thanks to Lars Noschinski) - * - Fixed device state not being reset to DEVICE_STATE_Default if the host sets a 0x00 device address - * - Fixed device not stalling configuration requests before the device's address has been set - * - Fixed possibility of internal signature retrieval being corrupted if an interrupt occurs during a signature byte - * read (thanks to Andrei Krainev) - * - Fixed device state not being reset back to the default state if the host sets the address to 0 - * - Fixed Set Configuration requests not being stalled until the host has set the device's address - * - Fixed Host mode HID class driver not sending the correct report type when HID_Host_SendReportByID() was called and the - * HID_HOST_BOOT_PROTOCOL_ONLY compile time option is set - * - Fixed INTERRUPT_CONTROL_ENDPOINT compile time option preventing other interrupts from occurring while the control endpoint - * request is being processed, causing possible lockups if a USB interrupt occurs during a transfer - * - Remove incorrect Abstract Call Management class specific descriptor from the CDC demos, bootloaders and projects - * - * - * \section Sec_ChangeLog100219 Version 100219 - * - * New: - * - Added TPI programming support for 6-pin ATTINY devices to the AVRISP programmer project (thanks to Tom Light) - * - Added command timeout counter to the AVRISP project so that the device no longer freezes when incorrectly connected - * to a target - * - Added new TemperatureDataLogger application, a USB data logger which writes to the device's dataflash and appears to - * the host as a standard Mass Storage device when inserted - * - Added MIDI event packing support to the MIDI Device and Host mode Class drivers, allowing for multiple MIDI events to - * sent or received in packed form in a single USB packet - * - Added new MIDI send buffer flush routines to the MIDI Device and Host mode Class drivers, to flush packed events - * - Added master mode hardware TWI driver for easy TWI peripheral control - * - Added ADC MUX masks for the standard ADC input channels on all AVR models with an ADC, altered demos to use these masks - * as on some models, the channel number is not identical to its single-ended ADC MUX mask - * - New Webserver project, a RNDIS host USB webserver using the open source uIP TCP/IP network stack and FatFS library - * - New BOARD value option BOARD_NONE (equivalent to not specifying BOARD) which will remove all board hardware drivers which - * do not adversely affect the code operation (currently only the LEDs driver) - * - Added keyboard modifier masks (HID_KEYBOARD_MODIFER_*) and LED report masks (KEYBOARD_LED_*) to the HID class driver and - * Keyboard demos - * - Added .5MHz recovery clock to the AVRISP programmer project when in ISP programming mode to correct mis-set fuses - * - * Changed: - * - Slowed down software USART carried PDI programming in the AVRISP project to prevent transmission errors - * - Renamed the AVRISP project folder to AVRISP-MKII to reduce confusion - * - Renamed the RESET_LINE_* makefile tokens in the AVRISP MKII Project to AUX_LINE_*, as they are not always used for target - * reset - * - Changed over the MassStorageKeyboard Class driver device demo to use Start of Frame events rather than a timer to keep track - * of elapsed milliseconds - * - Inlined currently unused (but standardized) maintenance functions in the Device and Host Class drivers to save space - * - The XPLAINBridge project now selects between a USB to Serial bridge and a PDI programmer on startup, reading the JTAG port's - * TDI pin to determine which mode to use - * - Removed the stream example code from the Low Level VirtualSerial demos, as they were buggy and only served to add clutter - * - * Fixed: - * - Fixed AVRISP project not able to enter programming mode when ISP protocol is used - * - Fixed AVRISP PDI race condition where the guard time between direction changes could be interpreted as a start bit - * - Fixed ADC_IsReadingComplete() returning an inverted result - * - Fixed blocking CDC streams not aborting when the host is disconnected - * - Fixed XPLAIN board Dataflash driver broken due to incorrect preprocessor commands - * - Fixed inverted XPLAIN LED driver output (LED turned on when it was supposed to be turned off, and vice-versa) - * - Fixed Class Driver struct interface numbers in the KeyboardMouse and VirtualSerialMouse demos (thanks to Renaud Cerrato) - * - Fixed invalid USB controller PLL prescaler values for the ATMEGAxxU2 controllers - * - Fixed lack of support for the ATMEGA32U2 in the DFU and CDC class bootloaders - * - Fixed Benito project not resetting the target AVR automatically when programming has completed - * - Fixed DFU bootloader programming not discarding the correct number of filler bytes from the host when non-aligned programming - * ranges are specified (thanks to Thomas Bleeker) - * - Fixed CDC and RNDIS host demos and class drivers - bidirectional endpoints should use two separate pipes, not one half-duplex pipe - * - Fixed Pipe_IsEndpointBound() not taking the endpoint's direction into account - * - Fixed EEPROM and FLASH ISP programming in the AVRISP project - * - Fixed incorrect values of USB_CONFIG_ATTR_SELFPOWERED and USB_CONFIG_ATTR_REMOTEWAKEUP tokens (thanks to Claus Christensen) - * - Fixed SerialStream driver blocking while waiting for characters to be received instead of returning EOF - * - Fixed SerialStream driver not setting stdin to the created serial stream (thanks to Mike Alexander) - * - Fixed USB_GetHIDReportSize() returning the number of bits in the specified report instead of bytes - * - Fixed AVRISP project not extending the command delay after each successful page/word/byte program - * - Fixed accuracy of the SERIAL_UBBRVAL() and SERIAL_2X_UBBRVAL() macros for higher baud rates (thanks to Renaud Cerrato) - * - * - * \section Sec_ChangeLog091223 Version 091223 - * - * New: - * - Added activity LED indicators to the AVRISP project to indicate when the device is busy processing a command - * - The USB target family and allowable USB mode tokens are now public and documented (USB_CAN_BE_*, USB_SERIES_*_AVR) - * - Added new XPLAIN USB to Serial Bridge project (thanks to John Steggall for initial proof-of-concept, David Prentice - * and Peter Danneger for revised software USART code) - * - Added new RNDIS Ethernet Host LowLevel demo - * - Added new RNDIS Ethernet Host Class Driver - * - Added new RNDIS Ethernet Host ClassDriver demo - * - Added CDC_Host_Flush() function to the CDC Host Class driver to flush sent data to the attached device - * - Added PDI programming support for XMEGA devices to the AVRISP programmer project (thanks to Justin Mattair) - * - Added support for the XPLAIN board Dataflash, with new XPLAIN_REV1 board target for the different dataflash used - * on the first revision boards compared to the one mounted on later revisions - * - Added new HID_ALIGN_DATA() macro to return the pre-retrieved value of a HID report item, left-aligned to a given datatype - * - Added new PreviousValue to the HID Report Parser report item structure, for easy monitoring of previous report item values - * - Added new EVK527 board target - * - Added new USB_Host_GetDeviceStringDescriptor() convenience function - * - Added new LEDNotification project to the library, to give a visual LED notification on new events from the host - * - Added new NO_DEVICE_REMOTE_WAKEUP and NO_DEVICE_SELF_POWER compile time options - * - * Changed: - * - Removed code in the Keyboard demos to send zeroed reports between two reports with differing numbers of key codes - * as this relied on non-standard OS driver behaviour to repeat key groups - * - The SCSI_Request_Sense_Response_t and SCSI_Inquiry_Response_t type defines are now part of the Mass Storage Class - * driver common defines, rather than being defined in the Host mode Class driver section only - * - The USB_MODE_HOST token is now defined even when host mode is not available - * - The CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new ReportType parameter to - * indicate the report type to generate - * - All Class Drivers now return false or the "DeviceDisconnected" error code of their respective error enums when a function - * is called when no host/device is connected where possible - * - The HOST_SENDCONTROL_DeviceDisconnect enum value has been renamed to HOST_SENDCONTROL_DeviceDisconnected to be in line - * with the rest of the library error codes - * - Make MIDI device demos also turn off the on board LEDs if MIDI Note On messages are sent with a velocity of zero, - * which some devices use instead of Note Off messages (thanks to Robin Green) - * - The CDC demos are now named "VirtualSerial" instead to indicate the demos' function rather than its implemented USB class, - * to reduce confusion and to be in line with the rest of the LUFA demos - * - The SImage_Host_SendBlockHeader() and SImage_Host_ReceiveBlockHeader() Still Image Host Class driver functions are now public - * - * Fixed: - * - Added missing CDC_Host_CreateBlockingStream() function code to the CDC Host Class driver - * - Fixed incorrect values for REPORT_ITEM_TYPE_* enum values causing corrupt data in the HID Host Parser - * - Fixed misnamed SI_Host_USBTask() and SI_Host_ConfigurePipes() functions - * - Fixed broken USB_GetNextDescriptor() function causing the descriptor to jump ahead double the expected amount - * - Fixed Pipe_IsEndpointBound() not masking the given Endpoint Address against PIPE_EPNUM_MASK - * - Fixed host state machine not enabling Auto VBUS mode when HOST_DEVICE_SETTLE_DELAY_MS is set to zero - * - Fixed misnamed Pipe_SetPipeToken() macro for setting a pipe's direction - * - Fixed CDCHost failing on devices with bidirectional endpoints - * - Fixed USB driver failing to define the PLL prescaler mask for the ATMEGA8U2 and ATMEGA16U2 - * - Fixed HID Parser not distributing the Usage Min and Usage Max values across an array of report items - * - Fixed Mass Storage Host Class driver and Low Level demo not clearing the error condition if an attached device returns a - * STALL to a GET MAX LUN request (thanks to Martin Luxen) - * - Fixed TeensyHID bootloader not properly shutting down the USB interface to trigger a disconnection on the host before resetting - * - Fixed MassStorageHost Class driver demo not having USB_STREAM_TIMEOUT_MS compile time option set properly to prevent slow - * devices from timing out the data pipes - * - Fixed the definition of the Endpoint_BytesInEndpoint() macro for the U4 series AVR parts - * - Fixed MIDI host Class driver MIDI_Host_SendEventPacket() routine not properly checking for Pipe ready before writing - * - Fixed use of deprecated struct initializers, removed library unused parameter warnings when compiled with -Wextra enabled - * - Fixed Still Image Host Class driver truncating the PIMA response code (thanks to Daniel Seibert) - * - Fixed USB_CurrentMode not being reset to USB_MODE_NONE when the USB interface is shut down and both Host and Device modes can be - * used (thanks to Daniel Levy) - * - Fixed TeensyHID bootloader not enumerating to the host correctly (thanks to Clint Fisher) - * - Fixed AVRISP project timeouts not checking for the correct timeout period (thanks to Carl Ott) - * - Fixed STK525 Dataflash driver using incorrect bit-shifting for Dataflash addresses (thanks to Tim Mitchell) - * - * - * \section Sec_ChangeLog091122 Version 091122 - * - * New: - * - Added new Dual Role Keyboard/Mouse demo - * - Added new HID_HOST_BOOT_PROTOCOL_ONLY compile time token to reduce the size of the HID Host Class driver when - * Report protocol is not needed - * - Added new MIDI LowLevel and ClassDriver Host demo, add new MIDI Host Class driver - * - Added new CDC/Mouse ClassDriver device demo - * - Added new Joystick Host ClassDriver and LowLevel demos - * - Added new Printer Host mode Class driver - * - Added new Printer Host mode ClassDriver demo - * - Added optional support for double banked endpoints and pipes in the Device and Host mode Class drivers - * - Added new stream creation function to the CDC Class drivers, to easily make standard I/O streams from CDC Class driver instances - * - * Changed: - * - Removed mostly useless "TestApp" demo, as it was mainly useful only for checking for syntax errors in the library - * - MIDI device demos now receive MIDI events from the host and display note ON messages via the board LEDs - * - Cleanups to the Device mode Mass Storage demo application SCSI routines - * - Changed Audio Class driver sample read/write functions to be inline, to reduce the number of cycles needed to transfer - * samples to and from the device (allowing more time for sample processing and output) - * - Audio class Device mode demos now work at both 16MHz and 8MHz, rather than just at 8MHz - * - The previous USBtoSerial demo has been moved into the projects directory, as it was just a modified CDC demo - * - The Endpoint/Pipe functions now use the const qualifier on the input buffer - * - Changed the CALLBACK_HIDParser_FilterHIDReportItem() callback to pass a HID_ReportItem_t rather than just the current - * item's attributes, to expose more information on the item (including it's type, collection path, etc.) - * - Changed MouseHostWithParser demos to check that the report items have a Mouse usage collection as a parent at some point, - * to prevent Joysticks from enumerating with the demo - * - Corrected the name of the misnamed USB_GetDeviceConfigDescriptor() function to USB_Host_GetDeviceConfigDescriptor(). - * - Keyboard LowLevel/ClassDriver demos now support multiple simultaneous key presses (up to 6) per report - * - * Fixed: - * - Fixed PrinterHost demo returning invalid Device ID data when the attached device does not have a - * device ID (thanks to Andrei Krainev) - * - Changed LUFA_VERSION_INTEGER define to use BCD values, to make comparisons easier - * - Fixed issue in the HID Host class driver's HID_Host_SendReportByID() routine using the incorrect mode (control/pipe) - * to send report to the attached device - * - Fixed ClassDriver AudioOutput device demo not selecting an audio output mode - * - Fixed incorrect SampleFrequencyType value in the AudioInput and AudioOutput ClassDriver demos' descriptors - * - Fixed incorrect event name rule in demo/project/bootloader makefiles - * - Fixed HID device class driver not reselecting the correct endpoint once the user callback routines have been called - * - Corrected HID descriptor in the Joystick Device demos - buttons should be placed outside the pointer collection - * - Fixed HID report parser collection paths invalid due to misplaced semicolon in the free path item search loop - * - Fixed HID host Class driver report send/receive report broken when issued through the control pipe - * - Fixed HOST_STATE_AS_GPIOR compile time option being ignored when in host mode (thanks to David Lyons) - * - Fixed LowLevel Keyboard demo not saving the issues report only after it has been sent to the host - * - Fixed Endpoint_Write_Control_Stream_* functions not sending a terminating IN when given data Length is zero - * - * - * \section Sec_ChangeLog090924 Version 090924 - * - * New: - * - Added new host mode class drivers and matching demos to the library for rapid application development - * - Added flag to the HID report parser to indicate if a device has multiple reports - * - Added new EVENT_USB_Device_StartOfFrame() event, controlled by the new USB_Device_EnableSOFEvents() and - * USB_Device_DisableSOFEvents() macros to give bus-synchronized millisecond interrupts when in USB device mode - * - Added new Endpoint_SetEndpointDirection() macro for bidirectional endpoints - * - Added new AVRISP project, a LUFA powered clone of the Atmel AVRISP-MKII programmer - * - Added ShutDown() functions for all hardware peripheral drivers, so that peripherals can be turned off after use - * - Added new CDC_Device_Flush() command to the device mode CDC Class driver to flush Device->Host data - * - Added extra masks to the SPI driver, changed SPI_Init() so that the clock polarity and sample modes can be set - * - Added new callback to the HID report parser, so that the user application can filter only the items it is interested - * in to be stored into the HIDReportInfo structure to save RAM - * - Added support for the officially recommended external peripheral layout for the BUMBLEB board (thanks to Dave Fletcher) - * - Added new Pipe_IsFrozen() macro to determine if the currently selected pipe is frozen - * - Added new USB_GetHIDReportSize() function to the HID report parser to retrieve the size of a given report by its ID - * - Added new combined Mass Storage and Keyboard demo (thanks to Matthias Hullin) - * - * Changed: - * - SetIdle requests to the HID device driver with a 0 idle period (send changes only) now only affect the requested - * HID interface within the device, not all HID interfaces - * - Added explicit attribute masks to the device mode demos' descriptors - * - Added return values to the CDC and MIDI class driver transmit functions - * - Optimized Endpoint_Read_Word_* and Pipe_Read_Word_* macros to reduce compiled size - * - Added non-null function parameter pointer restrictions to USB Class drivers to improve user code reliability - * - Added new "Common" section to the class drivers, to hold all mode-independent definitions for clarity - * - Moved SCSI command/sense constants into the Mass Storage Class driver, instead of the user-code - * - Altered the SCSI commands in the LowLevel Mass Storage Host to save on FLASH space by reducing function calls - * - Changed the parameters and behaviour of the USB_GetDeviceConfigDescriptor() function so that it now performs size checks - * and data validations internally, to simplify user code - * - Changed HIDParser to only zero out important values in the Parsed HID Report Item Information structure to save cycles - * - The HID report parser now always processed FEATURE items - HID_ENABLE_FEATURE_PROCESSING token now has no effect - * - The HID report parser now always ignores constant-data items, HID_INCLUDE_CONSTANT_DATA_ITEMS token now has no effect - * - The Benito Programmer project now has its own unique VID/PID pair allocated from the Atmel donated LUFA VID/PID pool - * - Add in new invalid event hook check targets to project makefiles to produce compilation errors when invalid event names - * are used in a project - * - The HID Report Parser now gives information on the total length of each report within a HID interface - * - The USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate USB_Descriptor_* and - * USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so both may be used - * - * Fixed: - * - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the - * endpoint's bank - * - Fixed swapped parameters in the HID state memory copy call while processing a HID PUSH item in the HID report parser - * - Fixed memory corruption HID report parser when too many COLLECTION or PUSH items were processed - * - Fixed HID report parser not resetting the FEATURE item count when a REPORT ID item is encountered - * - Fixed USBtoSerial demos not reading in UDR1 when the USART receives data but the USB interface is not enumerated, - * causing continuous USART receive interrupts - * - Fixed misspelled event name in the Class driver USBtoSerial demo, preventing correct operation - * - Fixed invalid data being returned when a GetStatus request is issued in Device mode with an unhandled data recipient - * - Added hardware USART receive interrupt and software buffering to the Benito project to ensure received data is not - * missed or corrupted - * - Fixed Device mode HID Class driver always sending IN packets, even when nothing to report - * - Fixed Device mode HID Class driver not explicitly initializing the ReportSize parameter to zero before calling callback - * routine, so that ignored callbacks don't cause incorrect data to be sent - * - Fixed StillImageHost not correctly freezing and unfreezing data pipes while waiting for a response block header - * - Fixed error in the PrinterHost demo preventing the full page data from being sent to the attached device (thanks to John Andrews) - * - Fixed CDC based demos and projects' INF driver files under 64 bit versions of Windows (thanks to Ronny Hanson, Thomas Bleeker) - * - Re-add in missing flip, flip-ee, dfu and dfu-ee targets to project makefiles (thanks to Opendous Inc.) - * - Fix allowable F_CPU values comment in project makefiles to more accurately reflect the allowable values on the USB AVRs - * - Fixed DFU and CDC class bootloaders on the series 2 USB AVRs, corrected invalid signatures, added support for the new - * ATMEGAxx2 series 2 variant AVRs to the DFU bootloader - * - Fixed Low Level USBtoSerial demo not storing received characters (thanks to Michael Cooper) - * - Fixed MIDI Device Class driver not sending/receiving MIDI packets of the correct size (thanks to Thomas Bleeker) - * - * - * \section Sec_ChangeLog090810 Version 090810 - * - * New: - * - Added new device class drivers and matching demos to the library for rapid application development - * - Added new PrinterHost demo (thanks to John Andrews) - * - Added USB Missile Launcher project, submitted by Dave Fletcher - * - Added new Benito Arduino Programmer project - * - Added incomplete device and host mode demos for later enhancement - * - Updated MassStorage device block write routines to use ping-pong Dataflash buffering to increase throughput by around 30% - * - Error status LEDs shown when device endpoint configuration fails to complete in all demos and projects - * - Added new USB_Host_SetDeviceConfiguration() convenience function for easy configuration selection of devices while in USB - * host mode - * - Added new USB_Host_ClearPipeStall() convenience function to clear a stall condition on an attached device's endpoint - * - Added new USB_Host_GetDeviceDescriptor() convenience function to retrieve the attached device's Device descriptor - * - Added new Endpoint_ClearStatusStage() convenience function to assist with the status stages of control transfers - * - Added new USE_INTERNAL_SERIAL define for using the unique serial numbers in some AVR models as the USB device's serial number, - * added NO_INTERNAL_SERIAL compile time option to turn off new serial number reading code - * - Added new DATAFLASH_CHIP_MASK() macro to the Dataflash driver, which returns the Dataflash select mask for the given chip index - * - Added new HOST_STATE_WaitForDeviceRemoval host state machine state for non-blocking disabling of device communications until the - * device has been removed (for use when an error occurs or communications with the device have completed) - * - Added new FAST_STREAM_TRANSFERS compile time option for faster stream transfers via multiple bytes copied per stream loop - * - Added stdio stream demo code to the CDC device demos, to show how to create standard streams out of the virtual serial ports - * - Added new EEPROM and FLASH buffer versions of the Endpoint and Pipe stream functions - * - Added new USE_FLASH_DESCRIPTORS and FIXED_NUM_CONFIGURATIONS compile time options - * - Added support for the new ATMEGA32U2, ATMEGA16U2 and ATMEGA8U2 AVR models - * - Added new USB_DeviceState variable to keep track of the current Device mode USB state - * - Added new LEDs_ToggleLEDs() function to the LEDs driver - * - Added new Pipe_BoundEndpointNumber() and Pipe_IsEndpointBound() functions - * - Added new DEVICE_STATE_AS_GPIOR and HOST_STATE_AS_GPIOR compile time options - * - Added 404 Not Found errors to the webserver in the RNDIS demos to indicate invalid URLs - * - * Changed: - * - Deprecated pseudo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused) - * - The device-mode CALLBACK_USB_GetDescriptor() function now has an extra parameter so that the memory space in which the requested - * descriptor is located can be specified. This means that descriptors can now be located in multiple memory spaces within a device. - * - Removed vague USB_IsConnected global - test USB_DeviceState or USB_HostState explicitly to gain previous functionality - * - Removed USB_IsSuspended global - test USB_DeviceState against DEVICE_STATE_Suspended instead - * - Extended USB_GetDeviceConfigDescriptor() routine to require the configuration number within the device to fetch - * - Dataflash_WaitWhileBusy() now always ensures that the dataflash is ready for the next command immediately after returning, - * no need to call Dataflash_ToggleSelectedChipCS() afterwards - * - Low level API MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready - * - Pipe_GetErrorFlags() now returns additional error flags for overflow and underflow errors - * - Pipe stream functions now automatically set the correct pipe token, so that bidirectional pipes can be used - * - Pipe_ConfigurePipe() now automatically defaults IN pipes to accepting infinite IN requests, this can still be changed by calling - * the existing Pipe_SetFiniteINRequests() function - * - Changed F_USB entries in project makefiles to alias to F_CPU by default, as this is the most common case - * - Host mode demos now use sane terminal escape codes, so that text is always readable and events/program output is visually distinguished - * from one another using foreground colours - * - Internal per-device preprocessing conditions changed to per-device series rather than per-controller group for finer-grain - * internal control - * - Interrupts are no longer disabled during the processing of Control Requests on the default endpoint while in device mode - * - AudioOutput demos now always output to board LEDs, regardless of output mode (removed AUDIO_OUT_LEDS project option) - * - Removed SINGLE_DEVICE_CONFIGURATION compile time option in favor of the new FIXED_NUM_CONFIGURATIONS option so that the exact number - * of device configurations can be defined statically - * - Removed VBUS events, as they are already exposed to the user application via the regular device connection and disconnection events - * - Renamed and altered existing events to properly separate out Host and Device mode events - * - All demos switched over from GNU99 standards mode to C99 standards mode, to reduce the dependencies on GCC-only language extensions - * - * Fixed: - * - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix - * bootloaders on some of the USB AVR devices where avr-libc erroneously defines RAMPZ - * - Fixes to MassStorageHost for better device compatibility (increase command timeout, change MassStore_WaitForDataReceived() - * to only unfreeze and check one data pipe at a time) to prevent incorrect device enumerations and freezes while transferring data - * - Make Pipe_ConfigurePipe() mask the given endpoint number against PIPE_EPNUM_MASK to ensure the endpoint IN direction bit is - * cleared to prevent endpoint type corruption - * - Fixed issue opening CDC-ACM ports on hosts when the CDC device tries to send data before the host has set the line encoding - * - Fixed USB_OPT_MANUAL_PLL option being ignored during device disconnects on some models (thanks to Brian Dickman) - * - Fixed documentation mentioning Pipe_GetCurrentToken() function when correct function name is Pipe_GetPipeToken() - * - Fixed ADC driver for the ATMEGA32U4 and ATMEGA16U4 (thanks to Opendous Inc.) - * - Fixed CDCHost demo unfreezing the pipes at the point of configuration, rather than use - * - Fixed MassStorage demo not clearing the reset flag when a Mass Storage Reset is issued while not processing a command - * - Fixed USB_Host_SendControlRequest() not re-suspending the USB bus when initial device ready-wait fails - * - Fixed USB Pad regulator not being disabled on some AVR models when the USB_OPT_REG_DISABLED option is used - * - Fixed Host mode to Device mode UID change not causing a USB Disconnect event when a device was connected - * - Fixed Mouse/Keyboard demos not performing the correct arithmetic on the Idle period at the right times (thanks to Brian Dickman) - * - Fixed GenericHID failing HID class tests due to incorrect Logical Minimum and Logical Maximum values (thanks to Soren Greiner) - * - Fixed incorrect PIPE_EPNUM_MASK mask causing pipe failures on devices with endpoint addresses of 8 and above (thanks to John Andrews) - * - Fixed report data alignment issues in the MouseHostWithParser demo when X and Y movement data size is not a multiple of 8 bits - * - Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered - * - Fixed incorrect BUTTONS_BUTTON1 for the STK526 target - * - Fixed RNDIS demos freezing when more than one connection was attempted simultaneously, causing memory corruption - * - Fixed USBtoSerial demo receiving noise from the USART due to pull-up not being enabled - * - * - * \section Sec_ChangeLog090605 Version 090605 - * - * - Fixed bug in RNDISEthernet and DualCDC demos not using the correct USB_ControlRequest structure for control request data - * - Fixed documentation showing incorrect USB mode support on the supported AVRs list - * - Fixed RNDISEthernet not working under Linux due to Linux requiring an "optional" RNDIS request which was unhandled - * - Fixed Mouse and Keyboard device demos not acting in accordance with the HID specification for idle periods (thanks to Brian Dickman) - * - Removed support for endpoint/pipe non-control interrupts; these did not act in the way users expected, and had many subtle issues - * - Fixed Device Mode not handling Set Feature and Clear Feature Chapter 9 requests that are addressed to the device (thanks to Brian Dickman) - * - Moved control endpoint interrupt handling into the library itself, enable via the new INTERRUPT_CONTROL_ENDPOINT token - * - Fixed CDCHost not clearing configured pipes and resetting configured pipes mask when a partially enumerated invalid CDC - * interface is skipped - * - Clarified the size of library tokens which accept integer values in the Compile Time Tokens page, values now use the smallest datatype - * inside the library that is able to hold their defined value to save space - * - Removed DESCRIPTOR_ADDRESS() macro as it was largely superfluous and only served to obfuscate code - * - Rewritten event system to remove all macros, to make user code clearer - * - Fixed incorrect ENDPOINT_EPNUM_MASK mask preventing endpoints above EP3 from being selected (thanks to Jonathan Oakley) - * - Removed STREAM_CALLBACK() macro - callbacks now use regular function definitions to clarify user code - * - Removed DESCRIPTOR_COMPARATOR() macro - comparators should now use regular function definitions to clarify user code - * - USB_IsConnected is now cleared before the USB_Disconnect() event is fired in response to VBUS being removed - * - Fixed incorrect PID value being used in the USBtoSerial project (thanks to Phill) - * - Deleted StdDescriptors.c, renamed USB_GetDescriptor() to CALLBACK_USB_GetDescriptor, moved ConfigDescriptor.c/.h from the - * LUFA/Drivers/USB/Class/ directory to LUFA/Drivers/USB/HighLevel/ in preparation for the new USB class APIs - * - Moved out each demos' functionality library files (e.g. Ring Buffer library) to /Lib directories for a better directory structure - * - Removed Tx interrupt from the USBtoSerial demo; now sends characters via polling to ensure more time for the Rx interrupt - * - Fixed possible enumeration errors from spin-loops which may fail to exit if the USB connection is severed before the exit condition - * becomes true - * - * - * \section Sec_ChangeLog090510 Version 090510 - * - * - Added new GenericHIDHost demo - * - Corrections to the KeyboardHost and MouseHost demos' pipe handling to freeze and unfreeze the data pipes at the point of use - * - KeyboardHost, MouseHost and GenericHIDHost demos now save and restore the currently selected pipe inside the pipe ISR - * - Changed GenericHID device demo to use the LUFA scheduler, added INTERRUPT_DATA_ENDPOINT and INTERRUPT_CONTROL_ENDPOINT compile - * time options - * - All comments in the library, bootloaders, demos and projects have now been spell-checked and spelling mistakes/typos corrected - * - Added new PIMA_DATA_SIZE() define to the Still Image Host demo - * - Add call to MassStore_WaitForDataReceived() in MassStore_GetReturnedStatus() to ensure that the CSW has been received in the - * extended MSC timeout period before continuing, to prevent long processing delays from causing the MassStore_GetReturnedStatus() - * to early-abort (thanks to Dmitry Maksimov) - * - Move StdRequestType.h, StreamCallbacks.h, USBMode.h from the LowLevel USB driver directory to the HighLevel USB driver directory, - * where they are more suited - * - Removed all binary constants and replaced with decimal or hexadecimal constants so that unpatched GCC compilers can still build the - * code without having to be itself patched and recompiled first - * - Added preprocessor checks and documentation to the bootloaders giving information about missing SIGNATURE_x defines due to - * outdated avr-libc versions. - * - Added support to the CDCHost demo for devices with multiple CDC interfaces which are not the correct ACM type preceding the desired - * ACM CDC interface - * - Fixed GenericHID demo not starting USB and HID management tasks when not using interrupt driven modes (thanks to Carl Kjeldsen) - * - Fixed RNDISEthenet demo checking the incorrect message field for packet size constraints (thanks to Jonathan Oakley) - * - Fixed WriteNextReport code in the GenericHIDHost demo using incorrect parameter types and not selecting the correct endpoint - * - Adjusted sample CTC timer calculations in the AudioOutput and AudioInput demos to match the CTC calculations in the AVR datasheet, - * and to fix instances where rounding caused the endpoint to underflow (thanks to Robin Theunis) - * - The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0), so that other control type - * pipes can be used with the function - * - The USB Host management task now saves and restores the currently selected pipe before and after the task completes - * - Fixed GenericHIDHost demo report write routine incorrect for control type requests (thanks to Andrei Krainev) - * - Removed Endpoint_ClearCurrentBank() and Pipe_ClearCurrentBank() in favor of new Endpoint_ClearIN(), Endpoint_ClearOUT(), - * Pipe_ClearIN() and Pipe_ClearOUT() macros (done to allow for the detection of packets of zero length) - * - Renamed *_ReadWriteAllowed() macros to *_IsReadWriteAllowed() to remain consistent with the rest of the LUFA API - * - Endpoint_IsSetupReceived() macro has been renamed to Endpoint_IsSETUPReceived(), Endpoint_ClearSetupReceived() macro has been - * renamed to Endpoint_ClearSETUP(), the Pipe_IsSetupSent() macro has been renamed to Pipe_IsSETUPSent() and the - * Pipe_ClearSetupSent() macro is no longer applicable and should be removed - changes made to compliment the new endpoint and pipe - * bank management API - * - Updated all demos, bootloaders and projects to use the new endpoint and pipe management APIs (thanks to Roman Thiel from Curetis AG) - * - Updated library doxygen documentation, added groups, changed documentation macro functions to real functions for clarity - * - Removed old endpoint and pipe aliased read/write/discard routines which did not have an explicit endian specifier for clarity - * - Removed the ButtLoadTag.h header file, as no one used for its intended purpose anyway - * - Renamed the main Drivers/AT90USBXXX directory to Drivers/Peripheral, renamed the Serial_Stream driver to SerialStream - * - Fixed CDC and USBtoSerial demos freezing where buffers were full while still transmitting or receiving (thanks to Peter Hand) - * - Removed "Host_" section of the function names in ConfigDescriptor.h, as most of the routines can now be used in device mode on the - * device descriptor - * - Renamed functions in the HID parser to have a "USB_" prefix and the acronym "HID" in the name - * - Fixed incorrect HID interface class and subclass values in the Mouse and KeyboardMouse demos (thanks to Brian Dickman) - * - Capitalized the "Descriptor_Search" and "Descriptor_Search_Comp" prefixes of the values in the DSearch_Return_ErrorCodes_t and - * DSearch_Comp_Return_ErrorCodes_t enums - * - Removed "ERROR" from the enum names in the endpoint and pipe stream error code enums - * - Renamed the USB_PowerOnErrorCodes_t enum to USB_InitErrorCodes_t, renamed the POWERON_ERROR_NoUSBModeSpecified enum value to - * USB_INITERROR_NoUSBModeSpecified - * - Renamed USB_PowerOnFail event to USB_InitFailure - * - Renamed OTG.h header functions to be more consistent with the rest of the library API - * - Changed over all deprecated GCC structure tag initializers to the standardized C99 format (thanks to Mike Alexander) - * - USB_HostRequest renamed to USB_ControlRequest, entire control request header is now read into USB_ControlRequest in Device mode - * rather than having the library pass only partially read header data to the application - * - The USB_UnhandledControlPacket event has had its parameters removed, in favor of accessing the new USB_ControlRequest structure - * - The Endpoint control stream functions now correctly send a ZLP to the host when less data than requested is sent - * - Fixed USB_RemoteWakeupEnabled flag never being set (the REMOTE WAKEUP Set Feature request was not being handled) - * - Renamed the FEATURELESS_CONTROL_ONLY_DEVICE compile-time token to CONTROL_ONLY_DEVICE - * - Endpoint configuration is now refined to give better output when all configurations have static inputs - removed the now useless - * STATIC_ENDPOINT_CONFIGURATION compile time token - * - Fixed SPI driver init function not clearing SPI2X bit when not needed - * - Fixed PREVENT ALLOW MEDIUM REMOVAL command issuing in the MassStorageHost demo using incorrect parameters (thanks to Mike Alex) - * - Fixed MassStorageHost demo broken due to an incorrect if statement test in MassStore_GetReturnedStatus() - * - Fixed reversed signature byte ordering in the CDC bootloader (thanks to Johannes Raschke) - * - Changed PIPE_CONTROLPIPE_DEFAULT_SIZE from 8 to 64 to try to prevent problems with faulty devices which do not respect the given - * wLength value when reading in the device descriptor - * - Fixed missing semicolon in the ATAVRUSBRF01 LED board driver code (thanks to Morten Lund) - * - Changed LED board driver code to define dummy LED masks for the first four board LEDs, so that user code can be compiled for boards - * with less than four LEDs without code modifications (thanks to Morten Lund) - * - Changed HWB board driver to Buttons driver, to allow for the support of future boards with more than one mounted GPIO button - * - Serial driver now correctly calculates the baud register value when in double speed mode - * - Init function of the Serial driver is now static inline to product smaller code for the common-case of static init values - * - * - * \section Sec_ChangeLog090401 Version 090401 - * - * - Fixed MagStripe project configuration descriptor containing an unused (blank) endpoint descriptor - * - Incorporated makefile changes by Denver Gingerich to retain compatibility with stock (non-WinAVR) AVR-GCC installations - * - Fixed makefile EEPROM programming targets programming FLASH data in addition to EEPROM data - * - LUFA devices now enumerate correctly with LUFA hosts - * - Fixed Configuration Descriptor search routine freezing when a comparator returned a failure - * - Removed HID report item serial dump in the MouseHostWithParser and KeyboardHostWithParser - useful only for debugging, and - * slowed down the enumeration of HID devices too much - * - Increased the number of bits per track which can be read in the MagStripe project to 8192 when compiled for the AT90USBXXX6/7 - * - Fixed KeyboardMouse demo discarding the wIndex value in the REQ_GetReport request - * - USBtoSerial demo now discards all Rx data when not connected to a USB host, rather than buffering characters for transmission - * next time the device is attached to a host. - * - Added new F_USB compile time constant to the library and makefiles, to give the raw input clock (used to feed the PLL before any - * clock prescaling is performed) frequency, so that the PLL prescale mask can be determined - * - Changed stream wait timeout counter to be 16-bit, so that very long timeout periods can be set for correct communications with - * badly designed hosts or devices which greatly exceed the USB specification limits - * - Mass Storage Host demo now uses a USB_STREAM_TIMEOUT_MS of two seconds to maintain compatibility with poorly designed devices - * - Function attribute ATTR_ALWAYSINLINE renamed to ATTR_ALWAYS_INLINE to match other function attribute macro naming conventions - * - Added ATTR_ALWAYS_INLINE attribute to several key inlined library components, to ensure they are inlined in all circumstances - * - Removed SetSystemClockPrescaler() macro, the clock_prescale_set() avr-libc macro has been corrected in recent avr-libc versions - * - Fixed incorrect/missing control status stage transfers on demos, bootloaders and applications (thanks to Nate Lawson) - * - The NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded - * to also remove parts of the Get Status chapter 9 request to further reduce code usage - * - Makefile updated to include output giving the currently selected BOARD parameter value - * - Board Dataflash driver now allows for dataflash ICs which use different shifts for setting the current page/byte address (thanks - * to Kenneth Clubb) - * - Added DataflashManager_WriteBlocks_RAM() and DataflashManager_ReadBlocks_RAM() functions to the MassStorage demo, to allow for easy - * interfacing with a FAT library for dataflash file level access - * - Corrected CDC class bootloader to fix a few bugs, changed address counter to store x2 addresses for convenience - * - Fixed typos in the SPI driver SPI_SPEED_FCPU_DIV_64 and SPI_SPEED_FCPU_DIV_128 masks (thanks to Markus Zocholl) - * - Keyboard and Mouse device demos (normal, data interrupt and fully interrupt driven) combined into unified keyboard and mouse demos - * - Keyboard and Mouse host demos (normal and data interrupt driven) combined into unified keyboard and mouse demos - * - Removed AVRISP_Programmer project due to code quality concerns - * - Fixed CDC demo not sending an empty packet after each transfer to prevent the host from buffering incoming data - * - Fixed documentation typos and preprocessor checks relating to misspellings of the USE_RAM_DESCRIPTORS token (thanks to Ian Gregg) - * - Fixed USBTask.h not conditionally including HostChapter9.h only when USB_CAN_BE_HOST is defined (thanks to Ian Gregg) - * - Fixed incorrect ADC driver init register manipulation (thanks to Tobias) - * - Added new GenericHID device demo application - * - Fixed Still Image Host SImage_SendData() function not clearing the pipe bank after sending data - * - * - * \section Sec_ChangeLog090209 Version 090209 - * - * - PWM timer mode in AudioOut demo changed to Fast PWM for speed - * - Updated Magstripe project to work with the latest hardware revision - * - Fixed library not responding to the BCERRI flag correctly in host mode, leading to device lockups - * - Fixed library handling Get Descriptor requests when not addressed as standard requests to the device or interface (thanks to - * Nate Lawson) - * - Fixed serious data corruption issue in MassStorage demo dataflash write routine - * - Added new NO_CLEARSET_FEATURE_REQUEST compile time token - * - USB task now restores previous global interrupt state after execution, rather than forcing global interrupts to be enabled - * - Fixed USB_DeviceEnumerationComplete event firing after each configuration change, rather than once after the initial configuration - * - Added ENDPOINT_DOUBLEBANK_SUPPORTED() macros to Endpoint.h, altered ENDPOINT_MAX_SIZE() to allow user to specify endpoint - * - ENDPOINT_MAX_ENDPOINTS changed to ENDPOINT_TOTAL_ENDPOINTS, PIPE_MAX_PIPES changed to PIPE_TOTAL_PIPES - * - Endpoint and Pipe non-control stream functions now ensure endpoint or pipe is ready before reading or writing - * - Changed Teensy bootloader to use a watchdog reset when exiting rather than a software jump - * - Fixed integer promotion error in MassStorage and MassStorageHost demos, corrupting read/write transfers - * - SPI_SendByte is now SPI_TransferByte, added new SPI_SendByte and SPI_ReceiveByte functions for fast one-way transfer - * - MassStorage demo changed to use new fast one-way SPI transfers to increase throughput - * - MassStorage handling of Mass Storage Reset class request improved - * - Altered MassStorage demo dataflash block read code for speed - * - Added USB_IsSuspended global flag - * - Simplified internal Dual Mode (OTG) USB library code to reduce code size - * - Extended stream timeout period to 100ms from 50ms - * - Mass Storage Host demo commands now all return an error code from the Pipe_Stream_RW_ErrorCodes_t enum - * - Added SubErrorCode parameter to the USB_DeviceEnumerationFailed event - * - VBUS drop interrupt now disabled during the manual-to-auto VBUS delivery handoff - * - Simplified low level backend so that device/host mode initialization uses the same code paths - * - Added workaround for faulty Mass Storage devices which do not implement the required GET_MAX_LUN request - * - Removed buggy Telnet application from the RNDIS demo - * - Moved Mass Storage class requests in the Mass Storage Host demo to wrapper functions in MassStoreCommands.c - * - Fixed incorrect SCSI command size value in the Request Sense command in MassStoreCommands.c - * - Added SetProtocol request to HID class non-parser Mouse and Keyboard demos to force devices to use the correct Boot Protocol - * - Added new "dfu" and "flip" programming targets to project makefiles - * - HID_PARSE_Sucessful enum member typo corrected to HID_PARSE_Successful - * - Changed COLLECTION item structures in the HID descriptor parser to include the collection's Usage Page value - * - Serial driver now sets Tx line as output, enables pull-up on Rx line - * - Fixed smaller USB AVRs raising multiple connection and disconnection events when NO_LIMITED_CONTROLLER_CONNECT is disabled - * - Added HOST_DEVICE_SETTLE_DELAY_MS to give the host delay after a device is connected before it is enumerated - * - Fixed KeyboardHostWithParser demo linking against the wrong global variables - * - Completed doxygen documentation of remaining library bootloaders, demos and projects - * - Fixed incorrect bootloader start address in the TeensyHID bootloader - * - Added HWB button whole-disk ASCII dump functionality to MassStoreHost demo - * - Replaced printf_P(PSTR("%c"), {Variable}) calls with putchar() for speed and size savings - * - Serial driver now accepts baud rates over 16-bits in size, added double speed flag option - * - Fixed incorrect callback abort return value in Pipe.c - * - Added new flip-ee and dfu-ee makefile targets (courtesy of Opendous Inc.) - * - Removed reboot-on-disconnect code from the TeensyHID bootloader, caused problems on some systems - * - Fixed AudioOutput and AudioInput demos looping on the endpoint data, rather than processing a sample at a time and returning - * each time the task runs to allow for other tasks to execute - * - Added support for the Atmel ATAVRUSBRF01 board - * - Added AVRISP Programmer Project, courtesy of Opendous Inc. - * - Fixed CDC Host demo not searching through both CDC interfaces for endpoints - * - Fixed incorrect Product String descriptor length in the DFU class bootloader - * - * - * \section Sec_ChangeLog081224 Version 081224 - * - * - MyUSB name changed to LUFA, the Lightweight USB Framework for AVRs - * - Fixed Mass Storage Host demo's MassStore_SendCommand() delay in the incorrect place - * - Fixed USBtoSerial demo not calling ReconfigureUSART() after a change in the line encoding - * - Fixed infinite loop in host mode Host-to-Device control transfers with data stages - * - HID report parser now supports devices with multiple reports in one interface via Report IDs - * - Fixed RZUSBSTICK board LED driver header incorrect macro definition order causing compile errors - * - Calling USB_Init() when the USB interface is already configured now forces a complete interface reset - * and re-enumeration - fixes MyUSB DFU bootloader not switching to app code correctly when soft reset used - * - Fixed "No newline at end of file" warning when stream callbacks are enabled - * - DFU bootloader now uses fixed signature bytes per device, rather than reading them out dynamically for size - * - Added new FIXED_CONTROL_ENDPOINT_SIZE and USE_SINGLE_DEVICE_CONFIGURATION switches to statically define certain values to - * reduce compiled binary size - * - Added new NO_LIMITED_CONTROLLER_CONNECT switch to prevent the library from trying to determine bus connection - * state from the suspension and wake up events on the smaller USB AVRs - * - Added summary of all library compile time tokens to the documentation - * - Added overview of the LUFA scheduler to the documentation - * - Removed MANUAL_PLL_CONTROL compile time token, replaced with a mask for the USB_Init() Options parameter - * - CDC bootloader now uses the correct non-far or far versions of the pgm_* functions depending on if RAMPZ is defined - * - Doxygen documentation now contains documentation on all the projects, bootloaders and most demos included with the library - * - CDC bootloader now runs user application when USB disconnected rather than waiting for a hard reset - * - MouseHostWithParser and KeyboardHostWithParser now support multiple-report devices - * - RNDIS demo can now close connections correctly using the new TCP_APP_CLOSECONNECTION() macro - used in Webserver - * - Fixed the DFU bootloader, no longer freezes up when certain files are programmed into an AVR, made reading/writing faster - * - Fixed mouse/joystick up/down movements reversed - HID mouse X/Y coordinates use a left-handed coordinate system, not a normal - * right-handed system - * - Added stub code to the CDC and USBtoSerial demos showing how to read and set the RS-232 handshake lines - not currently used in - * the demos, but the example code and supporting defines are now in place - * - Interrupts are now disabled when processing a control request in device mode, to avoid exceeding the strict control request - * timing requirements. - * - All demos now use a central StatusUpdate() function rather than direct calls to the board LED functions, so that the demos can - * easily be altered to show different LED combinations (or do something else entirely) as the demo's status changes - * - Removed LED commands from the CDC bootloader, unused by most AVR910 programming software - * - Fixed RNDIS demo ICMP ping requests echoing back incorrect data - * - Added DHCP server code to RNDIS demo, allowing for hands-free auto configuration on any PC - * - Fixed DFU bootloader PID value for the ATMEGA16U4 AVR - * - Endpoint and Pipe configuration functions now return an error code indicating success or failure - * - USB Reset in device mode now resets and disables all device endpoints - * - Added intermediate states to the host mode state machine, reducing the USB task blocking time to no more than 1ms explicitly per - * invocation when in host mode - * - Added support for the ATMEGA32U6 microcontroller - * - Added STATIC_ENDPOINT_CONFIGURATION compile time option, enabled in the bootloaders to minimize space usage - * - Removed redundant code from the USB device GetStatus() chapter 9 processing routine - * - Added new TeensyHID bootloader, compatible with the Teensy HID protocol (http://www.pjrc.com/teensy/) - * - Versions are now numbered by release dates, rather than arbitrary major/minor revision numbers - * - USB_RemoteWakeupEnabled is now correctly set and cleared by SetFeature and ClearFeature requests from the host - * - Changed prototype of GetDescriptor, so that it now returns the descriptor size (or zero if the descriptor doesn't exist) - * rather than passing the size back to the caller through a parameter and returning a boolean - * - * - * \section Sec_ChangeLog153 Version 1.5.3 (081002) - * - * - Fixed CDC bootloader using pgmspace macros for some descriptors inappropriately - * - Updated all Mouse and Keyboard device demos to include boot protocol support (now works in BIOS) - * - Renamed bootloader directories to remove spaces, which were causing build problems on several OSes - * - Removed serial number strings from all but the MassStore demo where it is required - users were not - * modifying the code to either omit the descriptor or use a unique serial per device causing problems - * when multiple units of the same device were plugged in at the same time - * - AudioOutput and AudioInput demos now correctly silence endpoints when not enabled by the host - * - Added KeyboardMouse demo (Keyboard and Mouse functionality combined into a single demo) - * - Added DriverStubs directory to house board level driver templates, to make MyUSB compatible custom board - * driver creation easier - * - Extended MassStorage demo to support multiple LUNs, 2 by default - * - Fixed incorrect device address mask, preventing the device from enumerating with addresses larger than 63 - * - Fixed incorrect data direction mask in the GetStatus standard request, preventing it from being handled - * - Fixed incorrect GetStatus standard request for endpoints, now returns the endpoint STALL status correctly - * - Added in new USB_RemoteWakeupEnabled and USB_CurrentlySelfPowered flags rather than using fixed values - * - Added DualCDC demo to demonstrate the use of Interface Association Descriptors - * - Added pipe NAK detection and clearing API - * - Added pipe status change (NAK, STALL, etc.) interrupt API - * - Fixed MassStorageHost demo so that it no longer freezes randomly when issuing several commands in a row - * - Host demos configuration descriptor routines now return a unique error code when the returned data does - * not have a valid configuration descriptor header - * - Added Endpoint_WaitUntilReady() and Pipe_WaitUntilReady() functions - * - Stream functions now have software timeouts, timeout period can be set by the USB_STREAM_TIMEOUT_MS token - * - All demos now pass the USB.org automated Chapter 9 device compliance tests - * - All HID demos now pass the USB.org automated HID compliance tests - * - Polling interval of the interrupt endpoint in the CDC based demos changed to 0xFF to fix problems on Linux systems - * - Changed stream functions to accept a new callback function, with NO_STREAM_CALLBACKS used to disable all callbacks - * - Mass Storage demo dataflash management routines changed to use the endpoint stream functions - * - Added AVRStudio project files for each demo in addition to the existing Programmer's Notepad master project file - * - Re-added call to ReconfigureUSART() in USBtoSerial SetLineCoding request, so that baud rate changes - * are reflected in the hardware (change was previously lost) - * - * - * \section Sec_ChangeLog152 Version 1.5.2 (080731) - * - * - Fixed SwapEndian_32() function in Common.h so that it now works correctly (wrong parameter types) - * - Updated RNDIS demo - notification endpoint is no longer blocking so that it works with faulty Linux RNDIS - * implementations (where the notification endpoint is ignored in favor of polling the control endpoint) - * - Fixed incorrect Vendor Description string return size in RNDIS demo for the OID_GEN_VENDOR_DESCRIPTION OID token - * - Added very basic TCP/IP stack and HTTP/TELNET servers to RNDIS demo - * - Fixed DFU bootloader exit causing programming software to complain about failed writes - * - Fixed DFU bootloader EEPROM programming mode wiping first flash page - * - Fixed Clear/Set Feature device standard request processing code (fixing MassStorage demo in the process) - * - Added support for the ATMEGA16U4 AVR microcontroller - * - Library license changed from LGPLv3 to MIT license - * - * - * \section Sec_ChangeLog151 Version 1.5.1 (080707) - * - * - Changed host demos to enable the host function task on the firing of the USB_DeviceEnumerationComplete event - * rather than the USB_DeviceAttached event - * - HID Usage Stack now forcefully cleared after an IN/OUT/FEATURE item has been completely processed to remove - * any referenced but not created usages - * - Changed USB_INT_DisableAllInterrupts() and USB_INT_ClearAllInterrupts(), USB_Host_GetNextDescriptorOfType(), - * USB_Host_GetNextDescriptorOfTypeBefore(), USB_Host_GetNextDescriptorOfTypeAfter() to normal functions (from inline) - * - Fixed USBtoSerial demo not sending data, only receiving - * - Fixed main makefile to make all by default, fixed MagStripe directory case to prevent case-sensitive path problems - * - ConfigDescriptor functions made normal, instead of static inline - * - Pipe/Endpoint *_Ignore_* functions changed to *_Discard_*, old names still present as aliases - * - Fixed ENDPOINT_MAX_SIZE define to be correct on limited USB controller AVRs - * - Changed endpoint and pipe size translation routines to use previous IF/ELSE IF cascade code, new algorithmic - * approach was buggy and caused problems - * - Bootloaders now compile with -fno-inline-small-functions option to reduce code size - * - Audio demos now use correct endpoint sizes for full and limited controller USB AVRs, double banking in all cases - * to be in line with the specification (isochronous endpoints MUST be double banked) - * - Added Interface Association descriptor to StdDescriptors.h, based on the relevant USB2.0 ECN - * - Fixed MIDI demo, corrected Audio Streaming descriptor to follow the MIDI-specific AS structure - * - Fixed HID class demo descriptors so that the HID interface's protocol is 0x00 (required for non-boot protocol HID - * devices) to prevent problems on hosts expecting the boot protocol functions to be supported - * - Added read/write control stream functions to Endpoint.h - * - Fixed AudioOut demo not setting port pins to inputs on USB disconnect properly - * - Added RNDISEthernet demo application - * - * - * \section Sec_ChangeLog150 Version 1.5.0 (080610) - * - * - Fixed MIDI demo, now correctly waits for the endpoint to be ready between multiple note messages - * - Added CDC Host demo application - * - Added KeyboardFullInt demo application - * - Endpoint and Pipe creation routines now mask endpoint/pipe size with the size mask, to remove transaction - * size bits not required for the routines (improves compatibility with devices) - * - Fixed AudioInput demo - now correctly sends sampled audio to the host PC - * - Fixed AudioOutput demo once more -- apparently Windows requires endpoint packets to be >=192 bytes - * - Shrunk round-robbin scheduler code slightly via the use of struct pointers rather than array indexes - * - Fixed off-by-one error when determining if the Usage Stack is full inside the HID Report parser - * - Renamed Magstripe.h to MagstripeHW.h and moved driver out of the library and into the MagStripe demo folder - * - Added preprocessor checks to enable C linkage on the library components when used with a C++ compiler - * - Added Still Image Host demo application - * - The USB device task now restores the previously selected endpoint, allowing control requests to be transparently - * handled via interrupts while other endpoints are serviced through polling - * - Fixed device signature being sent in reverse order in the CDC bootloader - * - Host demos now have a separate ConfigDescriptor.c/.h file for configuration descriptor processing - * - HostWithParser demos now have a separate HIDReport.c/.h file for HID report processing and dumping - * - Removed non-mandatory commands from MassStorage demo to save space, fixed SENSE ResponseCode value - * - CDC demos now send empty packets after sending a full one to prevent buffering issues on the host - * - Updated demo descriptors to use VID/PID values donated by Atmel - * - Added DoxyGen documentation to the source files - * - Fixed Serial_IsCharReceived() definition, was previously reversed - * - Removed separate USB_Descriptor_Language_t descriptor, USB_Descriptor_String_t is used instead - * - Removed unused Device Qualifier descriptor structure - * - Renamed the USB_CreateEndpoints event to the more appropriate USB_ConfigurationChanged - * - Fixed MassStorageHost demo reading in the block data in reverse - * - Removed outdated typedefs in StdRequestType.h, superseded by the macro masks - * - Corrected OTG.h is now included when the AVR supports both Host and Device modes, for creating OTG products - * - USB_DeviceEnumerationComplete event is now also fired when in device mode and the host has finished its enumeration - * - Interrupt driven demos now properly restore previously selected endpoint when ISR is complete - * - The value of USB_HOST_TIMEOUT_MS can now be overridden in the user project makefile to a custom fixed timeout value - * - Renamed USB_Host_SOFGeneration_* macros to more friendly USB_Host_SuspendBus(), USB_Host_ResumeBus() - * and USB_Host_IsBusSuspended() - * - Renamed *_*_Is* macros to *_Is* to make all flag checking macros consistent, Pipe_SetInterruptFreq() is now - * Pipe_SetInterruptPeriod() to use the correct terminology - * - UnicodeString member of USB_Descriptor_String_t struct changed to an ordinary int array type, so that the GCC - * Unicode strings (prefixed with an L before the opening quotation mark) can be used instead of explicit arrays - * of ASCII characters - * - Fixed Endpoint/Pipes being configured incorrectly if the maximum endpoint/pipe size for the selected USB AVR - * model was given as the bank size - * - HID device demos now use a true raw array for the HID report descriptor rather than a struct wrapped array - * - Added VERSION_BCD() macro, fixed reported HID and USB version numbers in demo descriptors - * - Cleaned up GetDescriptor device chapter 9 handler function - * - Added GET_REPORT class specific request to HID demos to make them complaint to the HID class - * - Cleaned up setting of USB_IsInitialized and USB_IsConnected values to only when needed - * - Removed Atomic.c and ISRMacro.h; the library was already only compatible with recent avr-lib-c for other reasons - * - All demos and library functions now use USB standardized names for the USB data (bRequest, wLength, etc.) - * - Added USE_NONSTANDARD_DESCRIPTOR_NAMES token to switch back to the non-standard descriptor element names - * - * - * \section Sec_ChangeLog141 Version 1.4.1 (090519) - * - * - Enhanced KeyboardWithParser demo, now prints out pressed alphanumeric characters like the standard demo - * - Fixed MassStorage demo, read/writes using non mode-10 commands now work correctly - * - Corrected version number in Version.h - * - * - * \section Sec_ChangeLog140 Version 1.4.0 (090505) - * - * - Added HID Report Parser API to the library - * - Added Mouse and Keyboard host demo applications, using the new HID report parser engine - * - Added MouseFullInt demo, which demonstrates a fully interrupt (including control requests) mouse device - * - Fixed incorrect length value in the audio control descriptor of the AudioOutput and AudioInput demos - * - Added MIDI device demo application to the library - * - Fixed problem preventing USB devices from being resumed from a suspended state - * - Added new CDC class bootloader to the library, based on the AVR109 bootloader protocol - * - Added header to each demo application indicating the mode, class, subclass, standards used and supported speed - * - Functions expecting endpoint/pipe numbers are no longer automatically masked against ENDPOINT_EPNUM_MASK or - * PIPE_PIPENUM_MASK - this should be manually added to code which requires it - * - Fixed DFU class bootloader - corrected frequency of flash page writes, greatly reducing programming time - * - Renamed AVR_HOST_GetDeviceConfigDescriptor() to USB_Host_GetDeviceConfigDescriptor() and AVR_HOST_GetNextDescriptor() - * to USB_Host_GetNextDescriptor() - * - Added new USB_Host_GetNextDescriptorOfTypeBefore() and USB_Host_GetNextDescriptorOfTypeAfter() routines - * - Moved configuration descriptor routines to MyUSB/Drivers/USB/Class/, new accompanying ConfigDescriptors.c file - * - Added new configuration descriptor comparator API for more powerful descriptor parsing, updated host demos to use the - * new comparator API - * - Fixed MassStorageHost demo capacity printout, and changed data read/write mode from little-endian to the correct - * big-endian for SCSI devices - * - Fixed macro/function naming consistency; USB_HOST is now USB_Host, USB_DEV is now USB_Device - * - Added better error reporting to host demos - * - Added 10 microsecond delay after addressing devices in host mode, to prevent control stalls - * - * - * \section Sec_ChangeLog132 Version 1.3.2 (080401) - * - * - Added call to ReconfigureUSART() in USBtoSerial SetLineCoding request, so that baud rate changes - * are reflected in the hardware - * - Fixed CDC and USBtoSerial demos - Stream commands do not work for control endpoints, and the - * GetLineCoding request had an incorrect RequestType mask preventing it from being processed - * - Improved reliability of the USBtoSerial demo, adding a busy wait while the buffer is full - * - Device control endpoint size is now determined from the device's descriptors rather than being fixed - * - Separated out SPI code into new SPI driver in AT90USBXXX driver directory - * - Bootloader now returns correct PID for the selected USB AVR model, not just the AT90USB128X PID - * - Added support for the RZUSBSTICK board - * - Bicolour driver removed in favor of generic LEDs driver - * - Added support for the ATMEGA32U4 AVR - * - Added MANUAL_PLL_CONTROL compile time option to prevent the USB library from manipulating the PLL - * - * - * \section Sec_ChangeLog131 Version 1.3.1 (080319) - * - * - Fixed USB to Serial demo - class value in the descriptors was incorrect - * - Control endpoint size changed from 64 bytes to 8 bytes to save on USB FIFO RAM and to allow low - * speed mode devices to enumerate properly - * - USB to Serial demo data endpoints changed to dual-banked 16 byte to allow the demo to work - * on USB AVRs with limited USB FIFO RAM - * - Changed demo endpoint numbers to use endpoints 3 and 4 for double banking, to allow limited - * USB device controller AVRs (AT90USB162, AT90USB82) to function correctly - * - Updated Audio Out demo to use timer 1 for AVRs lacking a timer 3 for the PWM output - * - Fixed incorrect USB_DEV_OPT_HIGHSPEED entry in the Mass Storage device demo makefile - * - Optimized Mass Storage demo for a little extra transfer speed - * - Added LED indicators to the Keyboard demo for Caps Lock, Num Lock and Scroll Lock - * - Added Endpoint_Read_Stream, Endpoint_Write_Stream, Pipe_Read_Stream and Pipe_Write_Stream functions - * (including Big and Little Endian variants) - * - Made Dataflash functions inline for speed, removed now empty Dataflash.c driver file - * - Added new SetSystemClockPrescaler() macro (thanks to Joerg Wunsch) - * - Fixed Endpoint_ClearStall() to function correctly on full USB controller AVRs (AT90USBXXX6/7) - * - Endpoint_Setup_In_Clear() and Endpoint_Setup_Out_Clear() no longer set FIFOCON, in line with the - * directives in the datasheet - * - Fixed PLL prescaler defines for all AVR models and frequencies - * - Fixed ENDPOINT_INT_IN and ENDPOINT_INT_OUT definitions - * - Added interrupt driven keyboard and mouse device demos - * - Combined USB_Device_ClearFeature and USB_Device_SetFeature requests into a single routine for code - * size savings - * - Added missing Pipe_GetCurrentPipe() macro to Pipe.h - * - * - * \section Sec_ChangeLog130 Version 1.3.0 (080307) - * - * - Unnecessary control endpoint config removed from device mode - * - Fixed device standard request interpreter accidentally processing some class-specific requests - * - Added USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS compile time options to instruct the library - * to use descriptors stored in RAM or EEPROM rather than flash memory - * - All demos now disable watchdog on startup, in case it has been enabled by fuses or the bootloader - * - USB_DEV_OPT_LOWSPEED option now works correctly - * - Added ability to set the USB options statically for a binary size reduction via the USE_STATIC_OPTIONS - * compile time define - * - USB_Init no longer takes a Mode parameter if compiled for a USB device with no host mode option, or - * if forced to a particular mode via the USB_HOST_ONLY or USB_DEVICE_ONLY compile time options - * - USB_Init no longer takes an Options parameter if options statically configured by USE_STATIC_OPTIONS - * - Endpoint_Ignore_* and Pipe_Ignore_* made smaller by making the dummy variable non-volatile so that the - * compiler can throw away the result more efficiently - * - Added in an optional GroupID value to each scheduler entry, so that groups of tasks can once again be - * controlled by the new Scheduler_SetGroupTaskMode() routine - * - Added support for AT90USB162 and AT90USB82 AVR models - * - Added support for the STK525 and STK526 boards - * - Added support for custom board drivers to be supplied by selecting the board type as BOARD_USER, and - * placing board drivers in {Application Directory}/Board/ - * - PLL is now stopped and USB clock is frozen when detached from host in device mode, to save power - * - Joystick defines are now in synch with the schematics - orientation will be rotated for the USBKEY - * - Fixed USB_DEV_IsUSBSuspended() - now checks the correct register - * - Fixed data transfers to devices when in host mode - * - Renamed USB_DEV_OPT_HIGHSPEED to USB_DEV_OPT_FULLSPEED and USB_HOST_IsDeviceHighSpeed() to - * USB_HOST_IsDeviceFullSpeed() to be in line with the official USB speed names (to avoid confusion with - * the real high speed mode, which is unavailable on the USB AVRs) - * - * - * \section Sec_ChangeLog120 Version 1.2.0 (080204) - * - * - Added USB_DeviceEnumerationComplete event for host mode - * - Added new Scheduler_Init routine to prepare the scheduler, so that tasks can be started and - * stopped before the scheduler has been started (via Scheduler_Start) - * - Connection events in both Device and Host mode are now interrupt-driven, allowing the USB management - * task to be stopped when the USB is not connected to a host or device - * - All demos updated to stop the USB task when not in use via the appropriate USB events - * - Mass Storage Host demo application updated to function correctly with all USB flash disks - * - Mass Storage Host demo application now prints out the capacity and number of LUNs in the attached - * device, and prints the first block as hexadecimal numbers rather than ASCII characters - * - Endpoint and Pipe clearing routines now clear the Endpoint/Pipe interrupt and status flags - * - Shifted error handling code in the host enum state machine to a single block, to reduce code complexity - * - Added in DESCRIPTOR_TYPE, DESCRIPTOR_SIZE and DESCRIPTOR_CAST macros to make config descriptor processing - * clearer in USB hosts and DESCRIPTOR_ADDRESS for convenience in USB devices - * - Added in alloca macro to common.h, in case the user is using an old version of avr-lib-c missing the macro - * - * - * \section Sec_ChangeLog110 Version 1.1.0 (080125) - * - * - Fixed DCONNI interrupt being enabled accidentally after a USB reset - * - Fixed DDISCI interrupt not being disabled when a device is not connected - * - Added workaround for powerless pull-up devices causing false disconnect interrupts - * - Added USB_DeviceEnumerationFailed event for Host mode - * - AVR_HOST_GetDeviceConfigDescriptor routine no longer modifies ConfigSizePtr if a valid buffer - * pointer is passed - * - Added ALLOCABLE_BYTES to DynAlloc, and added code to make the size of key storage variables - * dependant on size of memory parameters passed in via the user project's makefile - * - Fixed incorrect device reset routine being called in USBTask - * - Devices which do not connect within the standard 300mS are now supported - * - Removed incorrect ATTR_PURE from Scheduler_SetTaskMode(), which was preventing tasks from being - * started/stopped, as well as USB_InitTaskPointer(), which was breaking dual device/host USB projects - * - Changed scheduler to use the task name rather than IDs for setting the task mode, eliminating the - * need to have a task ID list - * - ID transition interrupt now raises the appropriate device/host disconnect event if device attached - * - Fixed double VBUS change (and VBUS -) event when detaching in device mode - * - Added ability to disable ANSI terminal codes by the defining of DISABLE_TERMINAL_CODES in makefile - * - Removed return from ConfigurePipe and ConfigureEndpoint functions - use Pipe_IsConfigured() and - * Endpoint_IsConfigured() after calling the config functions to determine success - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt deleted file mode 100644 index 966ddd0fe4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt +++ /dev/null @@ -1,223 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_TokenSummary Summary of Compile Tokens - * - * The following lists all the possible tokens which can be defined in a project makefile, and passed to the - * compiler via the -D switch, to alter the LUFA library code. These tokens may alter the library behaviour, - * or remove features unused by a given application in order to save flash space. - * - * \note If the \c USE_LUFA_CONFIG_HEADER token is defined, the library will include a header file named \c LUFAConfig.h located - * in the user directory where the below compile time tokens may be defined. This allows for an alternative to makefile - * defined tokens for configuring the library. - * - * \section Sec_SummaryNonUSBTokens Non USB Related Tokens - * This section describes compile tokens which affect non-USB sections of the LUFA library. - * - * - DISABLE_TERMINAL_CODES - (\ref Group_Terminal) - All Architectures \n - * If an application contains ANSI terminal control codes listed in TerminalCodes.h, it might be desired to remove them - * at compile time for use with a terminal which is non-ANSI control code aware, without modifying the source code. If - * this token is defined, all ANSI control codes in the application code from the TerminalCodes.h header are removed from - * the source code at compile time. - * - * - * \section Sec_SummaryUSBClassTokens USB Class Driver Related Tokens - * This section describes compile tokens which affect USB class-specific drivers in the LUFA library. - * - * - HID_HOST_BOOT_PROTOCOL_ONLY - (\ref Group_USBClassHIDHost) - All Architectures \n - * By default, the USB HID Host class driver is designed to work with HID devices using either the Boot or Report HID - * communication protocols. On devices where the Report protocol is not used (i.e. in applications where only basic - * Mouse or Keyboard operation is desired, using boot compatible devices), the code responsible for the Report protocol - * mode can be removed to save space in the compiled application by defining this token. When defined, it is still necessary - * to explicitly put the attached device into Boot protocol mode via a call to \ref HID_Host_SetBootProtocol(). - * - * - HID_STATETABLE_STACK_DEPTH=x - (\ref Group_HIDParser) - All Architectures \n - * HID reports may contain PUSH and POP elements, to store and retrieve the current HID state table onto a stack. This - * allows for reports to save the state table before modifying it slightly for a data item, and then restore the previous - * state table in a compact manner. This token may be defined to a non-zero 8-bit value to give the maximum depth of the state - * table stack. If not defined, this defaults to the value indicated in the HID.h file documentation. - * - * - HID_USAGE_STACK_DEPTH=x - (\ref Group_HIDParser) - All Architectures \n - * HID reports generally contain many USAGE elements, which are assigned to INPUT, OUTPUT and FEATURE items in succession - * when multiple items are defined at once (via REPORT COUNT elements). This allows for several items to be defined with - * different usages in a compact manner. This token may be defined to a non-zero 8-bit value to set the maximum depth of the - * usage stack, indicating the maximum number of USAGE items which can be stored temporarily until the next INPUT, OUTPUT - * and FEATURE item. If not defined, this defaults to the value indicated in the HID.h file documentation. - * - * - HID_MAX_COLLECTIONS=x - (\ref Group_HIDParser) - All Architectures \n - * HID reports generally contain several COLLECTION elements, used to group related data items together. Collection information - * is stored separately in the processed usage structure (and referred to by the data elements in the structure) to save space. - * This token may be defined to a non-zero 8-bit value to set the maximum number of COLLECTION items which can be processed by the - * parser into the resultant processed report structure. If not defined, this defaults to the value indicated in the HID.h file - * documentation. - * - * - HID_MAX_REPORTITEMS=x - (\ref Group_HIDParser) - All Architectures \n - * All HID reports contain one or more INPUT, OUTPUT and/or FEATURE items describing the data which can be sent to and from the HID - * device. Each item has associated usages, bit offsets in the item reports and other associated data indicating the manner in which - * the report data should be interpreted by the host. This token may be defined to a non-zero 8-bit value to set the maximum number of - * data elements which can be stored in the processed HID report structure, including INPUT, OUTPUT and (if enabled) FEATURE items. - * If a item has a multiple count (i.e. a REPORT COUNT of more than 1), each item in the report count is placed separately in the - * processed HID report table. If not defined, this defaults to the value indicated in the HID.h file documentation. - * - * - HID_MAX_REPORT_IDS=x - (\ref Group_HIDParser) - All Architectures \n - * HID reports may contain several report IDs, to logically distinguish grouped device data from one another - for example, a combination - * keyboard and mouse might use report IDs to separate the keyboard reports from the mouse reports. In order to determine the size of each - * report, and thus know how many bytes must be read or written, the size of each report (IN, OUT and FEATURE) must be calculated and - * stored. This token may be defined to a non-zero 8-bit value to set the maximum number of report IDs in a device which can be processed - * and their sizes calculated/stored into the resultant processed report structure. If not defined, this defaults to the value indicated in - * the HID.h file documentation. - * - * - NO_CLASS_DRIVER_AUTOFLUSH - (\ref Group_USBClassDrivers) - All Architectures \n - * Many of the device and host mode class drivers automatically flush any data waiting to be written to an interface, when the corresponding - * USB management task is executed. This is usually desirable to ensure that any queued data is sent as soon as possible once and new data is - * constructed in the main program loop. However, if flushing is to be controlled manually by the user application via the *_Flush() commands, - * the compile time token may be defined in the application's makefile to disable automatic flushing during calls to the class driver USB - * management tasks. - * - * - * \section Sec_SummaryUSBTokens General USB Driver Related Tokens - * This section describes compile tokens which affect USB driver stack as a whole in the LUFA library. - * - * - ORDERED_EP_CONFIG - (\ref Group_EndpointManagement , \ref Group_PipeManagement) - AVR8, UC3 \n - * The USB AVRs do not allow for Endpoints and Pipes to be configured out of order; they must be configured in an ascending order to - * prevent data corruption issues. However, by default LUFA employs a workaround to allow for unordered Endpoint/Pipe initialization. This compile - * time token may be used to restrict the initialization order to ascending indexes only in exchange for a smaller compiled binary size. Use - * caution when applied to applications using the library USB Class drivers; the user application must ensure that all endpoints and pipes are - * allocated sequentially. - * - * - USE_STATIC_OPTIONS=x - (\ref Group_USBManagement) - All Architectures \n - * By default, the USB_Init() function accepts dynamic options at runtime to alter the library behaviour, including whether the USB pad - * voltage regulator is enabled, and the device speed when in device mode. By defining this token to a mask comprised of the USB options - * mask defines usually passed as the Options parameter to USB_Init(), the resulting compiled binary can be decreased in size by removing - * the dynamic options code, and replacing it with the statically set options. When defined, the USB_Init() function no longer accepts an - * Options parameter. - * - * - USB_DEVICE_ONLY - (\ref Group_USBManagement) - All Architectures \n - * For the USB AVR models supporting both device and host USB modes, the USB_Init() function contains a Mode parameter which specifies the - * mode the library should be initialized to. If only device mode is required, the code for USB host mode can be removed from the binary to - * save space. When defined, the USB_Init() function no longer accepts a Mode parameter. This define is irrelevant on smaller USB AVRs which - * do not support host mode. - * - * - USB_HOST_ONLY - (\ref Group_USBManagement) - All Architectures \n - * Same as USB_DEVICE_ONLY, except the library is fixed to USB host mode rather than USB device mode. Not available on some USB AVR models. - * - * - USB_STREAM_TIMEOUT_MS=x - (\ref Group_USBManagement) - All Architectures \n - * When endpoint and/or pipe stream functions are used, by default there is a timeout between each transfer which the connected device or host - * must satisfy, or the stream function aborts the remaining data transfer. This token may be defined to a non-zero 16-bit value to set the timeout - * period for stream transfers, specified in milliseconds. If not defined, the default value specified in LowLevel.h is used instead. - * - * - NO_LIMITED_CONTROLLER_CONNECT - (\ref Group_Events) - AVR8 Only \n - * On the smaller USB AVRs, the USB controller lacks VBUS events to determine the physical connection state of the USB bus to a host. In lieu of - * VBUS events, the library attempts to determine the connection state via the bus suspension and wake up events instead. This however may be - * slightly inaccurate due to the possibility of the host suspending the bus while the device is still connected. If accurate connection status is - * required, the VBUS line of the USB connector should be routed to an AVR pin to detect its level, so that the USB_DeviceState global - * can be accurately set and the \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events manually raised by the RAISE_EVENT macro. - * When defined, this token disables the library's auto-detection of the connection state by the aforementioned suspension and wake up events. - * - * - NO_SOF_EVENTS - (\ref Group_Events) - All Architectures \n - * By default, there exists a LUFA application event for the start of each USB frame while the USB bus is not suspended in either host or device mode. - * This event can be selectively enabled or disabled by calling the appropriate device or host mode function. When this compile time token is defined, - * the ability to receive USB Start of Frame events via the \ref EVENT_USB_Device_StartOfFrame() or \ref EVENT_USB_Host_StartOfFrame() events is removed, - * reducing the compiled program's binary size. - * - * - * \section Sec_SummaryUSBDeviceTokens USB Device Mode Driver Related Tokens - * This section describes compile tokens which affect USB driver stack of the LUFA library when used in Device mode. - * - * - USE_RAM_DESCRIPTORS - (\ref Group_StdDescriptors) - AVR8 Only \n - * Define this token to indicate to the USB driver that all device descriptors are stored in RAM, rather than being located in any one - * of the AVR's memory spaces. RAM descriptors may be desirable in applications where the descriptors need to be modified at runtime. - * - * - USE_FLASH_DESCRIPTORS - (\ref Group_StdDescriptors) - AVR8 Only \n - * Similar to USE_RAM_DESCRIPTORS, but all descriptors are stored in the AVR's FLASH memory rather than RAM. - * - * - USE_EEPROM_DESCRIPTORS - (\ref Group_StdDescriptors) - AVR8 Only \n - * Similar to USE_RAM_DESCRIPTORS, but all descriptors are stored in the AVR's EEPROM memory rather than RAM. - * - * - NO_INTERNAL_SERIAL - (\ref Group_StdDescriptors) - All Architectures \n - * Some AVR models contain a unique serial number which can be used as the device serial number, while in device mode. This allows - * the host to uniquely identify the device regardless of if it is moved between USB ports on the same computer, allowing allocated - * resources (such as drivers, COM Port number allocations) to be preserved. This is not needed in many apps, and so the code that - * performs this task can be disabled by defining this option and passing it to the compiler via the -D switch. - * - * - FIXED_CONTROL_ENDPOINT_SIZE=x - (\ref Group_EndpointManagement) - All Architectures \n - * By default, the library determines the size of the control endpoint (when in device mode) by reading the device descriptor. - * Normally this reduces the amount of configuration required for the library, allows the value to change dynamically (if - * descriptors are stored in EEPROM or RAM rather than flash memory) and reduces code maintenance. However, this token can be - * defined to a non-zero value instead to give the size in bytes of the control endpoint, to reduce the size of the compiled - * binary. - * - * - DEVICE_STATE_AS_GPIOR - (\ref Group_Device) - AVR8 Only \n - * One of the most frequently used global variables in the stack is the USB_DeviceState global, which indicates the current state of - * the Device State Machine. To reduce the amount of code and time required to access and modify this global in an application, this token - * may be defined to a value between 0 and 2 to fix the state variable into one of the three general purpose IO registers inside the AVR - * reserved for application use. When defined, the corresponding GPIOR register should not be used within the user application except - * implicitly via the library APIs. - * - * - FIXED_NUM_CONFIGURATIONS=x - (\ref Group_Device) - All Architectures \n - * By default, the library determines the number of configurations a USB device supports by reading the device descriptor. This reduces - * the amount of configuration required to set up the library, and allows the value to change dynamically (if descriptors are stored in - * EEPROM or RAM rather than flash memory) and reduces code maintenance. However, this value may be fixed via this token in the project - * makefile to reduce the compiled size of the binary at the expense of flexibility. - * - * - CONTROL_ONLY_DEVICE - (\ref Group_Device) - All Architectures \n - * In some limited USB device applications, there are no device endpoints other than the control endpoint; i.e. all device communication - * is through control endpoint requests. Defining this token will remove several features related to the selection and control of device - * endpoints internally, saving space. Generally, this is usually only useful in (some) bootloaders and is best avoided. - * - * - MAX_ENDPOINT_INDEX - (\ref Group_Device) - XMEGA Only \n - * Defining this value to the highest index (not address - this excludes the direction flag) endpoint within the device will restrict the - * number of FIFOs created internally for the endpoint buffers, reducing the total RAM usage. - * - * - INTERRUPT_CONTROL_ENDPOINT - (\ref Group_USBManagement) - All Architectures \n - * Some applications prefer to not call the USB_USBTask() management task regularly while in device mode, as it can complicate code significantly. - * Instead, when device mode is used this token can be passed to the library via the -D switch to allow the library to manage the USB control - * endpoint entirely via USB controller interrupts asynchronously to the user application. When defined, USB_USBTask() does not need to be called - * when in USB device mode. - * - * - NO_DEVICE_REMOTE_WAKEUP - (\ref Group_Device) - All Architectures \n - * Many devices do not require the use of the Remote Wakeup features of USB, used to wake up the USB host when suspended. On these devices, - * the code required to manage device Remote Wakeup can be disabled by defining this token and passing it to the library via the -D switch. - * - * - NO_DEVICE_SELF_POWER - (\ref Group_Device) - All Architectures \n - * USB devices may be bus powered, self powered, or a combination of both. When a device can be both bus powered and self powered, the host may - * query the device to determine the current power source, via \ref USB_Device_CurrentlySelfPowered. For solely bus powered devices, this global - * and the code required to manage it may be disabled by passing this token to the library via the -D switch. - * - * - * \section Sec_SummaryUSBHostTokens USB Host Mode Driver Related Tokens - * - * This section describes compile tokens which affect USB driver stack of the LUFA library when used in Host mode. - * - * - HOST_STATE_AS_GPIOR - (\ref Group_Host) - AVR8 Only \n - * One of the most frequently used global variables in the stack is the USB_HostState global, which indicates the current state of - * the Host State Machine. To reduce the amount of code and time required to access and modify this global in an application, this token - * may be defined to a value between 0 and 2 to fix the state variable into one of the three general purpose IO registers inside the AVR - * reserved for application use. When defined, the corresponding GPIOR register should not be used within the user application except - * implicitly via the library APIs. - * - * - USB_HOST_TIMEOUT_MS=x - (\ref Group_Host) - All Architectures \n - * When a control transfer is initiated in host mode to an attached device, a timeout is used to abort the transfer if the attached - * device fails to respond within the timeout period. This token may be defined to a non-zero 16-bit value to set the timeout period for - * control transfers, specified in milliseconds. If not defined, the default value specified in Host.h is used instead. - * - * - HOST_DEVICE_SETTLE_DELAY_MS=x - (\ref Group_Host) - All Architectures \n - * Some devices require a delay of up to 5 seconds after they are connected to VBUS before the enumeration process can be started, or - * they will fail to enumerate correctly. By placing a delay before the enumeration process, it can be ensured that the bus has settled - * back to a known idle state before communications occur with the device. This token may be defined to a 16-bit value to set the device - * settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead. - * - * - INVERTED_VBUS_ENABLE_LINE - (\ref Group_Host) - All Architectures \n - * If enabled, this will indicate that the USB target VBUS line polarity is inverted; i.e. it should be pulled low to enable VBUS to the - * target, and pulled high to stop the target VBUS generation. - * - * \attention On AVR8 architecture devices, this compile time option requires \c NO_AUTO_VBUS_MANAGEMENT to be set. - * - * - NO_AUTO_VBUS_MANAGEMENT - (\ref Group_Host) - All Architectures \n - * Disables the automatic management of VBUS to the target, i.e. automatic shut down in the even of an overcurrent situation. When enabled, VBUS - * is enabled while the USB controller is initialized in USB Host mode. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt deleted file mode 100644 index 85912b56ee..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt +++ /dev/null @@ -1,50 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_CompilingApps Compiling the Demos, Bootloaders and Projects - * - * The following details how to compile the included LUFA demos, applications and bootloaders using AVR-GCC. - * - * \section Sec_Prerequisites Prerequisites - * Before you can compile any of the LUFA library code or demos, you will need a recent distribution of avr-libc (1.6.2+) - * and the AVR-GCC (4.2+) compiler. A standard "coreutils" package for your system is also required for command line - * compilation of LUFA based applications. - * - * \subsection SSec_PreqWindows Windows Prerequisites - * On Windows, you will need a copy of the latest Atmel Toolchain, either downloaded and installed as a standalone - * package, or installed as part of Atmel Studio. You will need to ensure that the "bin" directory of the toolchain - * is available in your system's PATH environment variable. - * - * In addition, you will need to install a ported version of the ZSH or BASH *nix shells, and a standard set of *nix - * utilities such as cut, find and sed. These can be found in the "basic" system package of the - * of the MinGW installer (http://www.mingw.org). Once installed, add the "msys\1.0\bin" of the MinGW installation - * folder is added to your system's PATH environment variable. - * - * The bootloaders currently also require the "bc" application, which can be installed from - * http://gnuwin32.sourceforge.net/downlinks/bc.php. Once installed add the "GnuWin32\bin" path of the GnuWin32 - * installation folder to your system's PATH environment variable. - * - * \subsection SSec_PreqLinux Linux Prerequisites - * On Linux systems you will need to install the latest Linux distribution of the standalone Atmel Toolchain from the - * Atmel website for general development, or use the latest avr-libc and avr-gcc packages for your chosen distribution's - * package manager. For full device support, the Atmel standalone package is recommended. - * - * \section Sec_Compiling Compiling a LUFA Application - * Compiling the LUFA demos, applications and/or bootloaders is very simple. LUFA comes with makefile scripts for - * each individual demo, bootloader and project folder, as well as scripts in the Demos/, Bootloaders/, Projects/ - * and the LUFA root directory. Compilation of projects can be started from any of the above directories, with a build - * started from an upper directory in the directory structure executing build of all child directories under it. This - * means that while a build inside a particular demo directory will build only that particular demo, a build started from - * the /Demos/ directory will build all LUFA demo projects sequentially. - * - * To build a project from the source via the command line, the command "make all" should be executed from the command - * line in the directory of interest. To remove compiled files (including the binary output, all intermediately files and all - * diagnostic output files), execute "make clean". Once a "make all" has been run and no errors were encountered, the - * resulting binary will be located in the generated ".HEX" file. If your project makes use of pre-initialized EEPROM - * variables, the generated ".EEP" file will contain the project's EEPROM data. - * - * \see \ref Page_BuildSystem for information on the LUFA build system. - */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt deleted file mode 100644 index f126e69bbd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt +++ /dev/null @@ -1,104 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_ConfiguringApps Configuring the Demos, Bootloaders and Projects - * - * If the target microcontroller model, architecture, clock speed, board or other settings are different from the current - * settings, they must be changed and the project recompiled from the source code before being programmed into the microcontroller. - * Most project configuration options are located in the makefile build script inside each LUFA application's folder, - * however some demo or application-specific configuration settings are located in one or more of the source files of the project. - * See each project's individual documentation for application-specific configuration values. - * - * Each project "makefile" contains all the script and configuration data required to compile each project. When opened with - * any regular basic text editor such as Notepad or WordPad (ensure that the save format is a pure ASCII text format) the - * build configuration settings may be altered. - * - * \see \ref Page_BuildSystem for information on the LUFA build system. - * - * \section Sec_AppConfigParams The Default Application Template - * - * Below is a copy of the default LUFA application makefile, which can be used as a template for each application. - * - * \verbinclude makefile_template - * - * Inside each makefile, a number of configuration variables are listed with the syntax " = ". For - * each application, the important standard variables which should be altered are: - * - * - MCU, the target processor model - * - ARCH, the target microcontroller architecture - * - BOARD, the target board hardware - * - F_CPU, the target CPU master clock frequency, after any prescaling - * - F_USB, the target raw input clock to the USB module of the processor - * - OPTIMIZATION, the level of optimization to compile with - * - TARGET, the name of the target output binary and other files - * - SRC, the list of source files to compile/assemble/link - * - LUFA_PATH, the path to the LUFA library core source code - * - CC_FLAGS, the common command line flags to pass to the C/C++ compiler, assembler and linker - * - LD_FLAGS, the command line flags to pass to the linker - * - * These values should be changed to reflect the build hardware. - * - * \subsection SSec_MCU The MCU Parameter - * This parameter indicates the target microcontroller model for the compiled application. This should be set to the model of the target - * microcontroller (such as the AT90USB1287, or the ATMEGA32U4), in all lower-case (e.g. "at90usb1287"). Note that not all demos support all the - * microcontroller models and architectures, as they may make use of peripherals or modes only present in some devices. - * - * For supported processor models, see \ref Page_DeviceSupport. - * - * \subsection SSec_ARCH The ARCH Parameter - * This parameter indicates the target microcontroller architecture the library is to be compiled for. Different microcontroller - * architectures require different source files to be compiled into the final binary, and so this option must be set to the correct - * architecture for the selected platform. - * - * For supported processor architectures, see \ref Page_DeviceSupport. - * - * \subsection SSec_BOARD The BOARD Parameter - * This parameter indicates the target board hardware for the compiled application. Some LUFA library drivers are board-specific, - * such as the LED driver, and the library needs to know the layout of the target board. If you are using one of the board models listed - * on the main library page, change this parameter to the board name in all UPPER-case. - * - * If you are not using any board-specific drivers in the LUFA library, or you are using a custom board layout, change this to read - * "USER" (no quotes) instead of a standard board name. If the USER board type is selected and the application makes use of one or more - * board-specific hardware drivers inside the LUFA library, then the appropriate stub drives files should be copied from the \c /CodeTemplates/DriverStubs/ - * directory into a /Board/ folder inside the application directory, and the stub driver completed with the appropriate code to drive the - * custom board's hardware. - * - * For boards with built in hardware driver support within the LUFA library, see \ref Page_DeviceSupport. - * - * \subsection SSec_F_CPU The F_CPU Parameter - * This parameter indicates the target microcontroller's main CPU clock frequency, in Hz. This is used by many libraries (and applications) for - * timing related purposes, and should reflect the actual CPU speed after any prescaling or adjustments are performed. - * - * \subsection SSec_F_USB The F_USB Parameter - * This parameter indicates the raw input clock frequency to the USB module within the microcontroller in Hz. This may be very different on some platforms - * to the main CPU clock or other peripheral/bus clocks. - * - * \subsection SSec_OPTIMIZATION The OPTIMIZATION Parameter - * This parameter indicates the level of optimization to use when compiling the application. This will allow you to compile with an optimization level - * supported by GCC, from 0 (no optimization) to 3 (fastest runtime optimization) or s (smallest size). - * - * \subsection SSec_TARGET The TARGET Parameter - * This parameter indicates the application target name, which is used as the base filename for the build binary and debugging files. This will be the - * name of the output files once linked together into the final application, ready to load into the target. - * - * \subsection SSec_SRC The SRC Parameter - * This parameter indicates the source files used to compile the application, as a list of C (*.c), C++ (*.cpp) and Assembly (*.S) files. Note that - * all assembly files must end in a capital .S extension, as lowercase .s files are reserved for GCC intermediate files. - * - * \subsection SSec_LUFA_PATH The LUFA_PATH Parameter - * As each LUFA program requires the LUFA library source code to compile correctly, the application must know where the LUFA library is located. This - * value specifies the path to the LUFA library core. This path may be relative or absolute, however note than even under Windows based systems the - * forward-slash (/) path seperator must be used. - * - * \subsection SSec_CC_FLAGS The CC_FLAGS Parameter - * This parameter lists the compiler flags passed to the C/C++ compiler, the assembler and the linker. These are used as-is directly to GCC and thus - * must match GCC's command line options as given in the GCC manual. This variable may be used to define tokens directly on the command line, enable or - * disable warnings, adjust the target-specific tuning parameters or other options. - * - * \subsection SSec_LD_FLAGS The LD_FLAGS Parameter - * This parameter lists the linker flags passed exclusively to the linker. These are used as-is directly to GCC and thus must match GCC's command line - * linker options as given in the GCC manual. This variable may be used to create or relocate custom data sections, or enable linker specific behaviors. - */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt deleted file mode 100644 index becd58e542..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt +++ /dev/null @@ -1,23 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \page Page_DevelopingWithLUFA Developing With LUFA - * - * This section of the manual contains information on LUFA development, such as Getting Started information, - * information on compile-time tuning of the library and other developer-related sections. - * - * Subsections: - * \li \subpage Page_BuildSystem - The LUFA Buildsystem - * \li \subpage Page_TokenSummary - Summary of Compile Time Tokens - * \li \subpage Page_Migration - Migrating from an Older LUFA Version - * \li \subpage Page_VIDPID - Allocated USB VID and PID Values - * \li \subpage Page_BuildLibrary - Building as a Linkable Library - * \li \subpage Page_ExportingLibrary - Exporting LUFA for IDE Use - * \li \subpage Page_WritingBoardDrivers - How to Write Custom Board Drivers - * \li \subpage Page_SoftwareBootloaderStart - How to jump to the bootloader in software - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt deleted file mode 100644 index 18e808f4d5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt +++ /dev/null @@ -1,432 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \page Page_DeviceSupport Device and Hardware Support - * - * Atmel Microcontrollers: - * \li \subpage Page_AVR8Support - Atmel AVR8 Support - * \li \subpage Page_UC3Support - Atmel AVR32 UC3 Support - * \li \subpage Page_XMEGASupport - Atmel XMEGA Support - */ - -/** - * \page Page_AVR8Support Atmel 8-Bit AVR (AVR8) Support - * - * \section Sec_AVR8Support_Devices Supported Microcontroller Models - * - * Currently supported AVR8 models: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PartUSB Device ModeUSB Host Mode
AT90USB82YesNo
ATMEGA8U2YesNo
AT90USB162YesNo
ATMEGA16U2YesNo
ATMEGA16U4YesNo
ATMEGA32U2YesNo
ATMEGA32U4YesNo
ATMEGA32U6YesNo
AT90USB646YesNo
AT90USB647YesYes
AT90USB1286YesNo
AT90USB1287YesYes
- * - * \section Sec_AVR8Support_Boards Supported Atmel Boards - * Currently supported Atmel AVR8 boards (see \ref Group_BoardTypes): - * - AT90USBKEY - * - ATAVRUSBRF01 - * - EVK527 - * - RZUSBSTICK - * - STK525 - * - STK526 - * - XPLAIN (Original green board, not the newer blue XPLAINED family boards) - * - * \section Sec_AVR8Support_ThirdParty Supported Third Party Models - * Currently supported third-party boards (see \ref Group_BoardTypes for makefile \c BOARD constant names): - * - Adafruit U4 Breakout Board - * - Arduino Uno - * - Bitwizard Multio and Big-Multio - * - Busware BUI - * - Busware CUL V3 - * - Busware TUL - * - DorkbotPDX Duce - * - Fletchtronics Bumble-B (using manufacturer recommended peripheral layout) - * - Kernel Concepts USBFOO - * - Linnix UDIP - * - MattairTech JM-DB-U2 - * - Maximus USB - * - Micropendous Boards (Micropendous-32U2, Micropendous-1, Micropendous-2) - * - Microsin AVR-USB162 - * - Minimus USB - * - Olimex AVR-USB-162 - * - Olimex AVR-USB-32U4 - * - Olimex AVR-USB-T32U4 - * - Olimex AVR-ISP-MK2 - * - Paranoid Studio's US2AX (V1, V2 and V3 hardware revisions) - * - PJRC Teensy (1.x and 2.x versions) - * - Sparkfun U2 Breakout Board - * - TCNISO Blackcat USB JTAG - * - Tempusdictum Benito - * - Tom's USBTINY-MKII (all revisions and versions) - * - Custom User Boards (with Board Drivers if desired, see \ref Page_WritingBoardDrivers) - */ - -/** - * \page Page_UC3Support Atmel 32-Bit UC3 AVR (UC3) - * - * \warning The AVR32 UC3 device support is currently experimental, and is included for preview purposes only. - * - * \section Sec_UC3Support_Devices Supported Microcontroller Models - * - * Currently supported UC3 models: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PartUSB Device ModeUSB Host Mode
AT32UC3A064YesYes
AT32UC3A164YesYes
AT32UC3A364YesYes
AT32UC3A364SYesYes
AT32UC3A464YesYes
AT32UC3A464SYesYes
AT32UC3B064YesYes
AT32UC3B164YesYes
AT32UC3A0128YesYes
AT32UC3A1128YesYes
AT32UC3A3128YesYes
AT32UC3A3128SYesYes
AT32UC3A4128YesYes
AT32UC3A4128SYesYes
AT32UC3B0128YesYes
AT32UC3B1128YesYes
AT32UC3A0256YesYes
AT32UC3A1256YesYes
AT32UC3A3256YesYes
AT32UC3A3256SYesYes
AT32UC3A4256YesYes
AT32UC3A4256SYesYes
AT32UC3B0256YesYes
AT32UC3B1256YesYes
AT32UC3A0512YesYes
AT32UC3A1512YesYes
AT32UC3B0512YesYes
AT32UC3B1512YesYes
- * - * \section Sec_UC3Support_Boards Supported Atmel Boards - * - * Currently supported Atmel UC3 boards (see \ref Group_BoardTypes): - * - EVK1100 - * - EVK1101 - * - EVK1104 - * - * \section Sec_UC3Support_ThirdParty Supported Third Party Models - * - * Currently supported third-party boards (see \ref Group_BoardTypes for makefile \c BOARD constant names): - * - Custom User Boards (with Board Drivers if desired, see \ref Page_WritingBoardDrivers) - */ - -/** - * \page Page_XMEGASupport Atmel USB XMEGA AVR (XMEGA) - * - * \warning The XMEGA device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. - * - * \section Sec_XMEGASupport_Devices Supported Microcontroller Models - * - * Currently supported XMEGA models: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PartUSB Device ModeUSB Host Mode
ATXMEGA16A4UYesNo
ATXMEGA32A4UYesNo
ATXMEGA64A4UYesNo
ATXMEGA128A4UYesNo
ATXMEGA64A3UYesNo
ATXMEGA128A3UYesNo
ATXMEGA192A3UYesNo
ATXMEGA256A3UYesNo
ATXMEGA256A3BUYesNo
ATXMEGA128A1UYesNo
ATXMEGA64B3YesNo
ATXMEGA128B3YesNo
ATXMEGA64B1YesNo
ATXMEGA128B1YesNo
ATXMEGA64C3YesNo
ATXMEGA128C3YesNo
ATXMEGA192C3YesNo
ATXMEGA256C3YesNo
ATXMEGA384C3YesNo
ATXMEGA16C4YesNo
ATXMEGA32C4YesNo
- * - * \section Sec_XMEGASupport_Boards Supported Atmel Boards - * Currently supported Atmel XMEGA boards (see \ref Group_BoardTypes): - * - XMEGA A3BU Xplained - * - XMEGA B1 Xplained - * - * \section Sec_XMEGASupport_ThirdParty Supported Third Party Models - * Currently supported third-party boards (see \ref Group_BoardTypes for makefile \c BOARD constant names): - * - Custom User Boards (with Board Drivers if desired, see \ref Page_WritingBoardDrivers) - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt deleted file mode 100644 index b042246776..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt +++ /dev/null @@ -1,80 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \dir Platform - * \brief Platform specific drivers. - * - * This folder contains platform specific drivers and defines for various supported architectures. These may or may - * not be used in a LUFA application, and are provided for convenience purposes. - * - * \dir Drivers - * \brief Library hardware and software drivers. - * - * This folder contains all the library hardware and software drivers for each supported board, architecture and - * microcontroller model. - * - * \dir Drivers/Misc - * \brief Miscellaneous driver files. - * - * This folder contains drivers for aspects other than the USB interface, board hardware or microcontroller peripherals. - * - * \dir Drivers/Peripheral - * \brief Microcontroller peripheral driver files. - * - * This folder contains drivers for various low level microcontroller peripherals, usually located on the microcontroller - * die within the same physical chip. - * - * \dir Drivers/USB - * \brief USB controller peripheral driver files. - * - * This folder contains the complete LUFA USB stack and controller files, including the core driver and stack, as well - * as the USB class driver implementations. - * - * \dir Drivers/USB/Core - * \brief Core USB driver files. - * - * This folder contains the core USB stack and controller driver files, to correctly implement USB functionality on the - * target architecture and microcontroller model. This - * - * \dir Drivers/USB/Class - * \brief USB Class helper driver files. - * - * This folder contains drivers for implementing functionality of standardized USB classes. These are not used directly by the library, - * but provide a standard and library-maintained way of implementing functionality from some of the defined USB classes without extensive - * development effort. Is is recommended that these drivers be used where possible to reduce maintenance of user applications. - * - * \dir Drivers/USB/Class/Device - * \brief USB Device Class helper driver files. - * - * Device mode drivers for the standard USB classes. - * - * \dir Drivers/USB/Class/Host - * \brief USB Host Class helper driver files. - * - * Host mode drivers for the standard USB classes. - * - * \dir Drivers/Board - * \brief Board hardware driver files. - * - * This folder contains drivers for interfacing with the physical hardware on supported commercial boards, primarily from - * the Atmel corporation. Header files in this folder should be included in user applications requiring the functionality of - * hardware placed on supported boards. - * - * \dir CodeTemplates - * \brief Code templates for use in LUFA powered applications. - * - * This contains code templates for board drivers, sample LUFA project makefiles and other similar templates that can be copied into - * a LUFA powered application and modified to speed up development. - * - * \dir CodeTemplates/DriverStubs - * \brief Driver stub header files for custom boards, to allow the LUFA board drivers to operate. - * - * This contains stub files for the LUFA board drivers. If the LUFA board drivers are used with board hardware other than those - * directly supported by the library, the BOARD parameter of the application's makefile can be set to "USER", and these stub files - * copied to the "/Board/" directory of the application's folder. When fleshed out with working driver code for the custom board, - * the corresponding LUFA board APIs will work correctly with the non-standard board hardware. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt deleted file mode 100644 index 7e947c2a2c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt +++ /dev/null @@ -1,24 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \page Page_Donating Donating to Support This Project - * - * \image html Images/Author.jpg "Dean Camera, LUFA Developer" - * - * I am a 23 year old Atmel Applications Engineer, living in Trondheim, Norway and working on LUFA in my spare time. - * The development and support of this library requires much effort from myself, as I am the sole developer, maintainer - * and supporter. Please consider donating a small amount to support this and my future Open Source projects - All - * donations are greatly appreciated. - * - * Note that commercial entities can remove the attribution portion of the LUFA license by a one-time fee - see - * \ref Page_LicenseInfo for more details (Note: Please do NOT pay this in advance through the donation link below - - * contact author for payment details.). - * - * \image html "http://www.pledgie.com/campaigns/6927.png?skin_name=chrome" - * Donate to this project via PayPal - Thanks in Advance! - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt deleted file mode 100644 index 65d7fc9236..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt +++ /dev/null @@ -1,106 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_ExportingLibrary Exporting the Library for IDE Use - * - * While LUFA was designed to allow for easy compilation in a makefile driven environment, - * it is possible to export the library into a form suitable for drop-in use inside of an - * IDE. - * - * \section Sec_LibraryExport Exporting the Library - * An export of the library is at its most basic, a direct copy of the main "LUFA" source folder from the - * root download folder; this contains the library core which can be re-used within external projects. - * However, as many IDEs attempt to automatically compile all included source files, it is neccesary to - * exclude some directories and files from the library core export to allow for easier integration into - * an IDE project. - * - * \subsection SSec_ManualExport Manual Export - * To manually export the library core, copy over the main LUFA library folder from the LUFA root directory, - * renaming as desired. Within the library core folder, the following directories should be removed or - * excluded from your IDE import: - * - Documentation/ - * - DoxygenPages/ - * - CodeTemplates/ - * - * If required, files from the CodeTemplates/ subdirectory may be copied to your IDE project as needed. - * - * The resulting copy of the library may then be imported into your chosen IDE according to the instructions - * shown in \ref Sec_LibraryImport. - * - * \subsection SSec_AutomaticExport Automatic Export - * If desired, the steps indicated in \ref SSec_ManualExport may be automatically performed, by running the - * command make export_tar from the command line. This will generate two .tar files in the - * current directory, named LUFA_YYMMDD.tar and LUFA_YYMMDD_Code_Templates.tar (where - * "YYMMDD" is the version of the library being exported). The first archive contains the exported LUFA core - * with the non-required files removed, while the second contains an archived copy of the code template files - * for the current LUFA version. - * - * The resulting archived copy of the library may then be extracted to your chosen IDE project source directory - * and imported according to the instructions shown in \ref Sec_LibraryImport. - * - * \section Sec_LibraryImport Importing the Library - * An exported copy of the library may be imported wholesale into an IDE project, if the instructions detailed - * in \ref Sec_LibraryExport are followed. - * - * Specific instructions for importing an exported version of LUFA into various IDEs are listed below. - * - * \subsection SSec_AS56_Import Importing into AVRStudio 5/Atmel Studio 6 - * To import LUFA into a new or existing project, the following steps must be followed. - * - * \subsubsection SSSec_AS56_Import_Step1 Copy over the exported library - * Copy over the exported library archive created via the steps listed in \ref Sec_LibraryExport to your AS5/AS6 - * project directory. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png - * - * \subsubsection SSSec_AS56_Import_Step2 Extract exported library - * Extract out the contents of the archive to a new folder. This may be any name you wish, however keep in mind - * that this name will need to be referenced within your user application under most circumstances. It is - * suggested that this folder be named "LUFA", or "LUFA" followed by the version string for easy reference. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png - * - * \subsubsection SSSec_AS56_Import_Step3 Add the library files - * Open your AVRStudio 5/Atmel Studio 6 project. From the "Solution Explorer" pane, click the "Show All Files" - * button on the toolbar to display ghosted icons of files and folders located in the project source directory - * that are not currently added to the project. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png - * - * Right-click the ghosted version of the extracted LUFA export folder in the Solution Explorer pane, and - * choose the "Add to Project" option from the context menu. This will add the entire LUFA source tree to the - * current project. - * - * \subsubsection SSSec_AS56_Import_Step4 Open Project Toolchain Properties - * In the Solution Explorer pane, click the project node, and press the "Properties" button in the toolbar to - * open the Project Properties window. This window allows you to configure the various project global compiler, - * assembler and linker options. - * - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png - * - * Click the "Toolchain" tab on the left side of the Project Properties window. - * - * \subsubsection SSSec_AS56_Import_Step5 Configure Project Toolchain Properties - * - * In the GNU C Compiler section, open the "Symbols" page. Click the "Add Item" button to the top-right of the - * "Defined Symbols" section to add new symbols. - * - * At a minimum, you will need to define the following symbols (for more information on these symbols, see - * \ref Page_ConfiguringApps): - * - ARCH - * - F_CPU - * - F_USB - * - BOARD - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png - * - * Next, open the GNU C Compiler section's "Optimization" page. Ensure that the option to prepare functions for - * garbage collection is enabled. - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png - * - * Finally, in the GNU C Linker section, open the "Optimization" page. Ensure that the option to garbage collect - * unused sections is selected. - * \image html Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png - */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt deleted file mode 100644 index 9660a473a2..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt +++ /dev/null @@ -1,49 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - - /** \page Page_FutureChanges Future Changes - * - * Below is a list of future changes which are proposed for the LUFA library, but not yet started/complete. - * This gives an unordered list of future changes which may be available in future releases of the library. - * If you have an item to add to this list, please contact the library author via email, the LUFA mailing list, - * or post your suggestion as an enhancement request to the project bug tracker. - * - * Targeted for Future Releases: - * - Code Features - * -# Add hub support when in Host mode for multiple devices - * -# Investigate virtual hubs when in device mode instead of composite devices - * -# Re-add interrupt Pipe/Endpoint support - * -# Update stream APIs to use DMA transfers on supported architectures - * -# Pull out third party libraries into a separate folder and reference them as required - * -# Add a LUFA_YIELD macro for integration into a third-party RTOS - * -# Abstract out Mass Storage byte send/receive to prevent low level API use in projects - * -# Fix HID report parser usage support for array types - * -# Make HOST_DEVICE_SETTLE_DELAY_MS a global variable that can be changed - * -# Add MANDATORY_EVENT_FUNCTIONS compile time option - * -# Add watchdog support to the library and apps/bootloaders - * - Testing/Verification - * -# Re-run USBIF test suite on all classes to formally verify operation - * -# Implement automated functional testing of all demos - * - Documentation/Support - * -# Add detailed overviews of how each demo works - * -# Add board overviews - * -# Write LUFA tutorials - * - Demos/Projects - * -# Device/Host USB bridge - * -# Finish incomplete demos and projects - * -# Add class driver support for Test and Measurement class - * -# Add class driver support for EEM class - * -# Add class driver support for ECM class - * -# Add class driver generic HID report host demo - * -# Implement flow control for USB to Serial project - * - Ports - * -# Port all demos to multiple architectures - * -# Finish USB XMEGA port - * -# Add AVR32 UC3C, UC3D and UC3L support - * -# Atmel ARM7 series microcontrollers - * -# Other (commercial) C compilers - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt deleted file mode 100644 index b62a7cae18..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt +++ /dev/null @@ -1,25 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_GettingStarted Getting Started - * - * Out of the box, LUFA contains a large number of pre-made class demos for you to test, experiment with and - * ultimately build upon for your own projects. All the demos (where possible) come pre-configured to build and - * run correctly on the AT90USB1287 AVR microcontroller, mounted on the Atmel USBKEY board and running at an 8MHz - * master clock. This is due to two reasons; one, it is the hardware the author possesses, and two, it is the most - * popular Atmel USB demonstration board to date. To learn how to reconfigure, recompile and program the included - * LUFA applications using different settings, see the subsections below. - * - * Most of the included demos in the /Demos/ folder come in both ClassDriver and LowLevel varieties. If you are new - * to LUFA, it is highly recommended that you look at the ClassDriver versions first, which use the pre-made USB - * Class Drivers (\ref Group_USBClassDrivers) to simplify the use of the standard USB classes in user applications. - * - * Subsections: - * \li \subpage Page_ConfiguringApps - How to Configure the Included Demos, Projects and Bootloaders - * \li \subpage Page_CompilingApps - How to Compile the Included Demos, Projects and Bootloaders - * \li \subpage Page_ProgrammingApps - How to Program an AVR with the Included Demos, Projects and Bootloaders - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt deleted file mode 100644 index 3a3509d3fd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt +++ /dev/null @@ -1,38 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \defgroup Group_BoardDrivers Board Drivers - * - * Functions, macros, variables, enums and types related to the control of physical board hardware. - */ - -/** \defgroup Group_PeripheralDrivers On-chip Peripheral Drivers - * - * Functions, macros, variables, enums and types related to the control of AVR subsystems. - */ - -/** \defgroup Group_MiscDrivers Miscellaneous Drivers - * - * Miscellaneous driver Functions, macros, variables, enums and types. - */ - -/** \defgroup Group_PlatformDrivers_AVR8 AVR8 - * \ingroup Group_PlatformDrivers - * - * Drivers relating to the AVR8 architecture platform, such as clock setup and interrupt management. - */ - -/** \defgroup Group_PlatformDrivers_XMEGA XMEGA - * \ingroup Group_PlatformDrivers - * - * Drivers relating to the XMEGA architecture platform, such as clock setup and interrupt management. - */ - -/** \defgroup Group_PlatformDrivers_UC3 UC3 - * \ingroup Group_PlatformDrivers - * - * Drivers relating to the UC3 architecture platform, such as clock setup and interrupt management. - */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png deleted file mode 100644 index 4f0c26f374..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png deleted file mode 100644 index 6e309ae415..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png deleted file mode 100644 index 8192c9ae8a..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png deleted file mode 100644 index 2bb8f5fc8f..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png deleted file mode 100644 index f3a49ba9c4..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png deleted file mode 100644 index 078f4ec8d7..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png deleted file mode 100644 index 8a8571bd86..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg deleted file mode 100644 index e8f5541a0e..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png deleted file mode 100644 index 54fa1a6643..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png deleted file mode 100644 index efa5386778..0000000000 Binary files a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png and /dev/null differ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt deleted file mode 100644 index 0d63a03d0c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt +++ /dev/null @@ -1,44 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - - /** \page Page_KnownIssues Known Issues - * The following are known issues present in each official LUFA release. This list should contain all known - * issues in the library. Most of these issues should be corrected in the future release - see - * \ref Page_FutureChanges for a list of planned changes in future releases. - * - * \section Sec_KnownIssues120730 Version 120730 - * - AVR8 Architecture - * - No known issues. - * - UC3 Architecture - * \warning The UC3 device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. \n - * - * - No demos, bootloaders or projects have been ported for the UC3 devices in the current release, - * although the architecture is supported in the LUFA core library. - * - DMA transfers to and from the USB controller are not yet implemented for this release. - * - The UC3C, UC3D and UC3L sub-families of UC3 are not currently supported by the library due to their - * altered USB controller design. - * - The various \c CreateStream() functions for creating standard \c compatible virtual file - * streams are not available on the UC3 architecture, due to a lack of suitable library support. - * - XMEGA Architecture - * \warning The XMEGA device support is currently experimental (incomplete and/or non-functional), and is included for preview purposes only. - * - * - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release, - * although the architecture is supported in the LUFA core library. - * - Endpoints of more than 64 bytes are not currently supported in this release. - * - Isochronous endpoints are not currently supported in this release. As a result, the audio class - * cannot be used on XMEGA devices. - * - Multiple-bank endpoints are not currently supported in this release. - * - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata - * relating to the USB controller. - * - Architecture Independent - * - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element - * in the array will receive a unique incrementing usage from the MIN value, up to MAX. - * - The LUFA library is not watchdog aware, and thus timeouts are possible if short periods are used - * and a lengthy USB operation is initiated. - * - Build System - * - No known issues. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt deleted file mode 100644 index c3bf3db9df..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt +++ /dev/null @@ -1,181 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_LUFAPoweredProjects User Projects Powered by LUFA - * - * LUFA is currently in use all around the world, in many applications both commercial and non-commercial. Below is a - * list of known public LUFA powered projects, which all use the LUFA library in some way. Feel free to visit each project's - * home page for more information on each project. - * - * If you have a project that you would like to add to this list, please contact me via the details on the main page of this - * documentation. - * - * \section Sec_BoardsUsingLUFA AVR-USB Development Boards Using LUFA - * - * The following is a list of known AVR USB development boards, which recommend using LUFA for the USB stack. Some of these - * are open design, and all are available for purchase as completed development boards suitable for project development. - * - * \li AVR-USB-162, a USBKEY-like development board for the AT90USB162: http://olimex.com/dev/avr-usb-162.html - * \li Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito - * \li Duce, the sucessor to the Benito #7: http://dorkbotpdx.org/wiki/duce - * \li JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html - * \li Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/ - * \li Microsin AVR-USB162 breakout board, a DIY AT90USB162 development board: http://microsin.ru/content/view/685/44/ - * \li Minimus USB, a board specially designed for PSGroove: http://www.minimususb.com/ - * \li Nanduino, a do-it-yourself AT90USB162 board: http://www.makestuff.eu/wordpress/?page_id=569 - * \li Sparkfun ATMEGA8U2 breakout board: http://www.sparkfun.com/products/10277 - * \li Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html - * \li U2DIL/U4DIL, a set of DIP layout USB AVR boards: http://www.reworld.eu/re/en/products/u2dil/ - * \li USB2AX, a tiny USB to serial converter board: http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX - * \li USBFOO 2, AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102 - * - * \section Sec_LUFAProjects Projects Using LUFA (Hobbyist) - * - * The following are known hobbyist projects using LUFA. Most are open source, and show off interesting ways that the LUFA library - * can be incorporated into many different applications. - * - * \li Accelerometer Game Joystick: http://www.crictor.co.il/he/episodes/joystick/ - * \li Arcade Controller: http://fletchtronics.net/arcade-controller-made-petunia - * \li Arcade Joystick: http://jamie.lentin.co.uk/embedded/arcade-joystick/ - * \li AttoBasic AVR BASIC interpreter: http://www.cappels.org/dproj/AttoBasic2_1/AttoBasic_2.1_with_USB_and_Arduino_support.html - * \li AVR USB Modem, a 3G Wireless Modem host: http://code.google.com/p/avrusbmodem/ - * \li Bicycle POV: http://www.code.google.com/p/bicycleledpov/ - * \li Bluetooth Explorerbot: http://code.google.com/p/bluetooth-explorerbot/ - * \li Bus Ninja, an AVR clone of the popular BusPirate project: http://blog.hodgepig.org/busninja/ - * \li CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig - * \li CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/ - * \li ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/ - * \li Collection of alternative Arduino Uno firmwares: http://hunt.net.nz/users/darran/ - * \li Computer controlled LED matrix (Russian): http://we.easyelectronics.ru/AVR/nebolshoy-primer-s-lufa-hidapi.html - * \li CULFW, a 868MHz RF packet encoder/decoder: http://www.koeniglich.de/culfw/culfw.html - * \li Dashkey, a custom PC keyboard controller: http://geekhack.org/showwiki.php?title=Island:19096 - * \li DIY PS3 controller emulator: https://code.google.com/p/diyps3controller/ - * \li EMuSer, a USB-RS422 adapter for E-Mu samplers: http://www.emxp.net/EMuSer.htm - * \li Estick JTAG, an ARM JTAG debugger: http://code.google.com/p/estick-jtag/ - * \li "Fingerlicking Wingdinger" (WARNING: Bad language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/ - * \li Flyatar, a real-time fly tracking system: https://github.com/peterpolidoro/Flyatar - * \li FootJoy, a 22 button, 6-axis josystick with keyboard and mouse modes: https://bitbucket.org/sirbrialliance/foot-joy/ - * \li Gamecube controller to USB adapter: https://www.facebook.com/media/set/?set=a.10150202447076304.310536.688776303&l=df53851c50 - * \li Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master - * \li Generic HID Device Creator: http://generichid.sourceforge.net/ - * \li Generic HID Open Source Framework: http://www.waitingforfriday.com/index.php/USB_Generic_HID_Open_Source_Framework_for_Atmel_AVR_and_Windows - * \li Ghetto Drum, a MIDI drum controller: http://noisybox.net/art/gdrum/ - * \li GPS enabled lap timer for vehicles: http://www.assembla.com/code/ironlung/subversion/nodes/trunk/LapTimer - * \li Hardware Volume Control: https://github.com/davidk/hw-volume-control - * \li Hiduino, a USB-MIDI replacement firmware for the Arduino Uno: http://code.google.com/p/hiduino/ - * \li Ikea RGB LED USB modification: http://slashhome.se/p/projects/id/ikea_dioder_usb/#project - * \li IR Remote to Keyboard decoder: http://netzhansa.blogspot.com/2010/04/our-living-room-hi-fi-setup-needs-mp3.html - * \li Jukebox panic button: http://thinkl33t.co.uk/the-panic-button - * \li LED Panel controller: http://projects.peterpolidoro.net/caltech/panelscontroller/panelscontroller.htm - * \li Linux Secure Storage Dongle: http://github.com/TomMD/teensy - * \li LUFA powered DDR dance mat (French): http://logicien-parfait.fr/dokuwiki/doku.php?id=projet:ddr_repair - * \li MakeTV Episode Dispenser: http://www.youtube.com/watch?v=BkWUi18hl3g - * \li MidiMonster, a USB-to-MIDI gateway board: http://www.dorkbotpdx.org/wiki/midimonster - * \li MIDI Theremin: http://baldwisdom.com/usb-midi-controller-theremin-style-on-arduino-uno/ - * \li MIDI interface hack of a toy Guitar: http://blog.x37v.info/2011/06/26/toy-guitar-hacked-midi-conroller - * \li MiniBloq, a graphical Ardunio programming environment : http://minibloq.org/ - * \li MiXley, a port of the Teacup 3D printer firmware for the USB AVRs: http://codaset.com/michielh/mixley - * \li Mobo 4.3, a USB controlled all band (160-10m) HF SDR transceiver: http://sites.google.com/site/lofturj/mobo4_3 - * \li Moco, a native Arduino Uno MIDI replacement firmware: http://web.mac.com/kuwatay/morecat_lab./MocoLUFA.html - * \li Motherboard BIOS flasher: http://www.coreboot.org/InSystemFlasher - * \li Multi-button Joystick (French): http://logicien-parfait.fr/dokuwiki/doku.php?id=projet:joystick - * \li Music Playing Alarm Clock (Tutorial): http://www.instructables.com/id/Music-Playing-Alarm-Clock/ - * \li Nehebkau, Laptop Controlled Keyboard and Mouse: http://www.frank-zhao.com/cache/nehebkau.php - * \li NeroJTAG, a JTAG dongle: https://github.com/makestuff/neroJtag - * \li NES Controller USB modification: http://projects.peterpolidoro.net/video/NESUSB.htm - * \li Nikon wireless camera remote control (Norwegian): http://hekta.org/~hpe1119/ - * \li Opendous-JTAG, an open source ARM JTAG debugger: http://code.google.com/p/opendous-jtag/ - * \li Openkubus, an open source hardware-based authentication dongle: http://code.google.com/p/openkubus/ - * \li Orbee, a USB connected RGB Orb for notifications: http://www.franksworkshop.com.au/Electronics/Orbee/Orbee.htm - * \li PPM signal generator over USB: https://github.com/G33KatWork/USBPPM - * \li Programmable keyboard controller: http://41j.com/blog/2011/10/a-programmable-keyboard-controller/ - * \li Programmable XBOX controller: http://richard-burke.dyndns.org/wordpress/pan-galactic-gargantuan-gargle-brain-aka-xbox-360-usb-controller/ - * \li PSGroove, a Playstation 3 Homebrew dongle: http://github.com/psgroove - * \li PS/2 to USB adapter: https://github.com/makestuff/p2ukbd - * \li Reprap with LUFA, a LUFA powered 3D printer: http://code.google.com/p/at90usb1287-code-for-arduino-and-eclipse/ - * \li RFPirate, a RF experimentation platform: https://github.com/ebuller/RF-Pirate - * \li RF Transciever using the MRF49XA: http://alternet.us.com/?page_id=1494 - * \li SD Card reader: http://elasticsheep.com/2010/04/teensy2-usb-mass-storage-with-an-sd-card/ - * \li SDR1, a Software Defined Radio firmware: https://code.google.com/p/sdr-mk1/ - * \li SEGA Megadrive/Genesis Development Cartridge: http://www.makestuff.eu/wordpress/?page_id=398 - * \li Serial Line bus analyser: http://www.pjrc.com/teensy/projects/SerialAnalyzer.html - * \li SNES custom FLASH ROM: http://electrifiedfoolingmachine.co/?page_id=633 - * \li Smartcard Detective: https://code.google.com/p/smartcarddetective/ - * \li SmartportVHD Apple II Mass Storage adapter: http://pcedric3.free.fr/SmartportVHD/ - * \li Single LED Matrix Display: http://guysoft.wordpress.com/2009/10/08/bumble-b/ - * \li Simple USB LED Controller: https://github.com/scottbez1/sulc - * \li Stripe Snoop, a Magnetic Card reader: http://www.ossguy.com/ss_usb/ - * \li Stylophone, with USB MIDI connectivity: http://www.waitingforfriday.com/index.php/Stylophone_Studio_5 - * \li Teensy SD Card .WAV file player: http://elasticsheep.com/2010/04/teensy2-usb-wav-player-part-1/ - * \li Touchscreen Input Device: http://capnstech.blogspot.com/2010/07/touchscreen-update.html - * \li UDFS, a BBC Micro USB disk filing system: https://github.com/makestuff/udfs - * \li Universal USB AVR Module: http://usbavr.bplaced.net/ - * \li USB2AX, a USB to Dynamixel network adapter: http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX - * \li USB Infrared Receiver/Transmitter: http://vaton4.web2001.cz/ - * \li USB Interface for Playstation Portable Devices: http://forums.ps2dev.org/viewtopic.php?t=11001 - * \li USB MIDI to DMX controller: http://github.com/hanshuebner/miDiMX - * \li USB powered Geiger Counter: http://uhrheber.wordpress.com/2011/04/28/a-usb-powered-geiger-counter-for-the-z2-and-other-computers/ - * \li Userial, a USB to Serial converter with SPI, I2C and other protocols: http://www.tty1.net/userial/ - * \li Wireless MIDI Guitar system: http://www.ise.pw.edu.pl/~wzab/wireless_guitar_system/ - * \li Xnormidi, a C MIDI library: http://x37v.info/projects/xnormidi - * \li XUM1541, a Commodore 64 floppy drive to USB adapter: http://www.root.org/~nate/c64/xum1541/ - * \li Zeus, a touch screen computer for music manipulation: http://www.benbengler.com/developments_zeus.html - * - * \section Sec_LUFACommercialProjects Projects Using LUFA (Commercial) - * - * The following is a list of known commercial products using LUFA. Some of these are open source, although many are "black-box" - * solutions with no source code given. Those companies which have purchased a Commercial License to LUFA (see \ref Page_LicenseInfo) - * are not listed here unless specifically requested. - * - * \li Arduino Uno, the official Arduino board: http://www.arduino.cc - * \li ARPS Locator: http://la3t.hamradio.no/lab//?id=tracker_en - * \li AsTeRICS assistive technologies project, HID actuator: http://www.asterics.eu - * \li Ceberus, a MadCatz Xbox 360 arcade stick modifier: http://www.phreakmods.com/products/cerberus - * \li CFFA3000, a CompactFlash interface for the Apple II: http://www.dreher.net/CFforAppleII - * \li Digital Survey Instruments Magnetometer and Pointer: http://www.digitalsurveyinstruments.com/ - * \li FinchRobot, a robot designed for educational use: http://www.finchrobot.com/ - * \li HummingBird Kit, a robotics learning platform: http://www.hummingbirdkit.com/ - * \li Penguino, an Arduino Board With On-Board LUFA Powered Debugger/Programmer: http://wiki.icy.com.au/PenguinoAVR - * \li PIR-1, an IR control interface for consumer electronics: http://www.promixis.com/pir-1.php - * \li PIR-4, a USB Connected 4 port IR transmitter: http://promixis.com/pir-4.php - * \li KeyGlove, an alternative input system: http://www.keyglove.net/ - * \li Many of Busware's Products: http://www.busware.de/ - * \li MIDIFighter, a USB-MIDI controller: http://www.midifighter.com/ - * \li Norduino, a wireless Arduino: http://norduino.robomotic.com/norduino-is-now-usb-hid/ - * \li Olimex AVR-ISP-MK2, an AVRISP-MKII Clone AVR Programmer: https://www.olimex.com/dev/avr-isp-mk2.html - * \li Retrode, a USB Games Console Cartridge Reader: http://www.retrode.org - * \li RFI21.1EU UHF RFID reader: http://www.metra.cz/rfid/uhf-rfid-ctecky/rfi21-1eu-uhf-rfid-ctecka.htm - * \li SmartCardDetective, a Smart Card analysis tool: http://www.smartcarddetective.com/ - * \li USBTINY-MKII, an AVRISP-MKII Clone AVR Programmer: http://tom-itx.dyndns.org:81/~webpage/boards/USBTiny_Mkii/USBTiny_Mkii_index.php - * \li UDS18B20 USB Temperature sensor: http://toughlog.org/uds18b20/ - * \li VMeter, a USB MIDI touch strip controller: http://www.vmeter.net/ - * \li XMEGA Development Board, using LUFA as an On-Board Programmer: http://xmega.mattair.net/ - * \li Zeptoprog, a multifunction AVR programmer: http://www.mattairtech.com/index.php/featured/zeptoprog.html - * - * \section Sec_LUFAPublications Publications Mentioning LUFA - * The following are published magazines which have either mentioned or featured the LUFA library. - * - * \li Elektor Magazine, "My First AVR-USB" by Antoine Authier (feature), January 2010 Issue - * \li Elektor Magazine, "USB is Cool/Sucks" by Jerry Jacobs and Chris Vossen (minor mention), January 2010 Issue - * \li Elektor Magazine, "20 x Open Source" by Jens Nickel, March 2010 Issue - * \li Circuit Cellar Magazine, "Advanced USB Design Debugging" by Collin O'Flynn, August 2010 Issue - * - * \section Sec_LUFANotableMentions Other Notable Mentions of LUFA - * The following are non-magazine but notable mentions of the LUFA library. - * - * \li Adafruit "Ask an Engineer", 7th November 2010 - * \li Arduino 2010 Keynote speech - * \li The Amp Hour podcast blog #11 - * \li Blackhat 2011 conference, "Exploiting USB Devices with Arduino" - * - * \section Sec_PortsAndForks Non-Official LUFA Ports and Forks - * The following are unofficial forks of the LUFA codebase, which implement different features such as support for - * additional architectures. - * - * \li NXP's official "nxpusblib" LUFA fork, for LPC devices: http://www.lpcware.com/content/project/nxpusblib - * \li Kevin Mehall's LUFA port to the NXP LPC13xx: https://github.com/kevinmehall/LUFA-LPC13xx - * - */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt deleted file mode 100644 index a85d59c164..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt +++ /dev/null @@ -1,34 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \page Page_Resources Library Resources - * - * \section Sec_UnofficialResources Unofficial Resources - * Unofficial Russian LUFA documentation translation: http://microsin.ru/Download.cnt/doc/LUFA/ \n - * Tutorial for LUFA USB Control Transfers: http://www.avrbeginners.net/new/tutorials/usb-control-transfers-with-lufa/ - * - * \section Sec_ProjectPages LUFA Related Webpages - * Project Homepage: http://www.lufa-lib.org \n - * Commercial Licenses: http://www.lufa-lib.org/license \n - * Author's Website: http://www.fourwalledcubicle.com \n - * Development Blog: http://www.fourwalledcubicle.com/blog \n - * - * \section Sec_ProjectHelp Assistance With LUFA - * Support Mailing List: http://www.lufa-lib.org/support \n - * Author's Email: dean [at] fourwalledcubicle [dot] com \n - * - * \section Sec_InDevelopment Latest In-Development Source Code - * Issue Tracker: http://www.lufa-lib.org/tracker \n - * Public SVN Repository: http://www.lufa-lib.org/svn \n - * Public GIT Repository: http://www.lufa-lib.org/git \n - * Latest Repository Source Archive: http://www.lufa-lib.org/latest-archive \n - * Commit RSS Feed: http://www.lufa-lib.org/rss \n - * - * \section Sec_USBResources USB Resources - * USB-IF Website: http://www.usb.org \n - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt deleted file mode 100644 index 091ce94316..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt +++ /dev/null @@ -1,22 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \page Page_LicenseInfo Source Code License - * - * The LUFA library is currently released under the MIT license, included below. - * - * Commercial entities can opt out of the public disclosure clause in this license - * for a one-time US$1500 payment. This provides a non-exclusive modified MIT licensed which - * allows for the free use of the LUFA library, bootloaders and (where the sole copyright - * is attributed to Dean Camera) demos without public disclosure within an organization, in - * addition to three free hours of consultation with the library author, and priority support. - * Please visit the Commercial License link on \ref Page_Resources for more information on - * ordering a commercial license for your company. - * - * \verbinclude License.txt - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt deleted file mode 100644 index ce351ad3e0..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt +++ /dev/null @@ -1,52 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \mainpage - * - * \image html Images/LUFA.png - * - * \n - * - * \n - * - * LUFA is donationware. For author and donation information, see \ref Page_Donating. - * - * LUFA is an open-source USB library for the USB-enabled AVR microcontrollers, released under the MIT license (see \ref Page_LicenseInfo). - * It supports a large number of USB AVR models and boards (see \ref Page_DeviceSupport). It is designed to provide an easy to use, - * feature rich framework for the development of USB peripherals and hosts. - * - * LUFA focuses on the microcontroller side of USB development only; it includes no PC host USB driver development facilities - other projects - * such as the Windows Driver Development Kit, Windows USB Device Mode Framework and libusb may be of interest for developing custom OS drivers. - * While custom USB devices can be made with LUFA using such tools, the included demos all use the inbuilt OS drivers for each USB class for - * simplicity. - * - * The library is currently in a stable release, suitable for download and incorporation into user projects for - * both host and device modes. For information about the project progression, see the blog link at \ref Page_Resources. - * - * LUFA is written specifically for the free AVR-GCC compiler, and uses several GCC-only extensions to make the - * library API more streamlined and robust. You can download AVR-GCC for free in a convenient windows package, - * from the the WinAVR website (see \ref Page_Resources). - * - * The only required AVR peripherals for LUFA is the USB controller itself and interrupts - LUFA does not require the use of the - * microcontroller's timers or other hardware, leaving more hardware to the application developer. - * - * Accompanying LUFA in the download package is a set of example demo applications, plus several Bootloaders of different classes - * and open source LUFA powered projects. - * - * Subsections: - * \li \subpage Page_LicenseInfo - Project source license and commercial use information - * \li \subpage Page_Donating - Donating to support this project - * \li \subpage Page_DeviceSupport - Current Device and Hardware Support - * \li \subpage Page_ChangeLog - Project Changelog - * \li \subpage Page_KnownIssues - Known Issues - * \li \subpage Page_FutureChanges - Planned Changes to the Library - * \li \subpage Page_GettingStarted - Getting started with LUFA - * \li \subpage Page_DevelopingWithLUFA - Developing with LUFA - * \li \subpage Page_LUFAPoweredProjects - Other Projects Using LUFA - * \li \subpage Page_Resources - LUFA and USB Related Resources - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt deleted file mode 100644 index 7a08ad23c7..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt +++ /dev/null @@ -1,674 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_Migration Migrating from Older Versions - * - * Below is migration information for updating existing projects based on previous versions of the LUFA library - * to the next version released. It does not indicate all new additions to the library in each version change, only - * areas relevant to making older projects compatible with the API changes of each new release. - * - * \section Sec_Migration120730 Migrating from 120219 to 120730 - * Device Mode - * - The device mode Audio Class driver now requires an additional configuration parameter, the Audio Control interface index. Existing applications should - * be adjusted to specify the additional configuration parameter. - * - The HID_DESCRIPTOR_JOYSTICK() macro no longer takes a variable number of axis as a parameter, due to OS incompatibilities; this macro now uses a fixed - * 3 axis of data. User applications should update their calls to this macro and their report structures to suit a fixed 3-axis joystick report. If a user - * application requires more than 3 axis' of data, a custom report descriptor will need to be constructed by hand. - * - The \ref Endpoint_ConfigureEndpoint() function no longer takes in masks for the banks and direction; the number of banks is now an integer argument, and - * the direction is obtained from the full endpoint address within the device. Applications calling Endpoint_ConfigureEndpoint() should update their API - * call to use a full endpoint address (including ENDPOINT_DIR_IN or ENDPOINT_DIR_OUT direction in the MSB of the endpoint address) and an integer number - * of banks. - * - All endpoint functions now operate on full endpoint addresses within the device, rather than a directionless endpoint index. Applications should update - * their API calls to use full endpoint addresses when required within the device. - * - All device mode class drivers have been updated to use a new unified endpoint description structure for all endpoints; existing applications will need - * to update their class driver struct instantiation to match the new scheme (see \ref USB_Endpoint_Table_t). - * - The \c ENDPOINT_BANKS_SUPPORTED() and \c ENDPOINT_MAX_ENDPOINT_SIZE() macros have been removed, as these do not function correctly with the new addressing - * scheme for the endpoint APIs. Please refer to the target device's datasheet for the maximum bank size of each endpoint. - * - The MIDI class driver \ref MIDI_EventPacket_t event packet no longer contains seperate \c CableIndex and \c Command entries; these have been combined - * into a single \c Event element which can be contructed using the new macro \ref MIDI_EVENT(). Existing applications should use the new macro and structure - * element name. - * - * Host Mode - * - The Android Accessory Host class driver property strings are now a array of \c char* rather than a struct of named pointers. Existing applications - * should use C99 Designated Initializers with the property string indexes located in \ref AOA_Strings_t instead. - * - The \ref Pipe_ConfigurePipe() function no longer takes in masks for the banks and token; the number of banks is now an integer argument, and the token - * is now inferred from the full pipe address within the device, and the pipe type. Applications calling Pipe_ConfigurePipe() should update their API - * call to use a full pipe address (including PIPE_DIR_IN or PIPE_DIR_OUT direction in the MSB of the pipe address) and an integer number of banks. - * - All pipe functions now operate on full pipe addresses within the device, rather than a directionless pipe index. Applications should update their API - * calls to use full pipe addresses when required within the device. - * - All host mode class drivers have been updated to use a new unified pipe description structure for all pipes; existing applications will need to update - * their class driver struct instantiation to match the new scheme (see \ref USB_Pipe_Table_t). - * - The MIDI class driver \ref MIDI_EventPacket_t event packet no longer contains seperate \c CableIndex and \c Command entries; these have been combined - * into a single \c Event element which can be contructed using the new macro \ref MIDI_EVENT(). Existing applications should use the new macro and structure - * element name. - * - The library "LUFA/Drivers/USB/Core/ConfigDescriptor.c" source file has been renamed "LUFA/Drivers/USB/Core/ConfigDescriptors.c" as this was clashing with - * files in some low level host mode demo applications, preventing parallel project builds. If you are referencing the project source files directly instead - * of using the makefile module names, you will need to adjust your project makefile. - * - * \section Sec_Migration120219 Migrating from 111009 to 120219 - * USB Core - * - The HID_KEYBOARD_MODIFER_* macros in the HID class driver have been corrected to HID_KEYBOARD_MODIFIER_* (note the spelling of "modifier"). - * Existing applications should switch over to the correctly spelled macro names. - * - The names of the USB Device and USB Host class driver files have changed; a new "ClassDevice" and "ClassHost" postfix has been added to the - * respective class driver files. Projects referencing the class driver source files by filename rather than the LUFA_SRC_USBCLASS makefile - * variable should append these postfixes to the source file names. Projects including the USB class driver dispatch headers directly should either - * switch to including the main USB driver header instead, or use the updated header filenames. - * - The USB_CONFIG_ATTR_BUSPOWERED constant has been renamed to USB_CONFIG_ATTR_RESERVED, as this was misnamed. All devices must set this bit in - * the Configuration descriptor's attributes field. As all devices are assumed to be bus-powered unless stated otherwise with the - * USB_CONFIG_ATTR_SELFPOWERED flag a replacement constant for bus powered devices is not provided. - * - * Device Mode - * - The device mode Audio class driver now requires a new user application callback, \ref CALLBACK_Audio_Device_GetSetInterfaceProperty(). - * Existing applications must implement this new callback, however if no audio entities are defined in the audio device's descriptors, - * this function may be hard-coded to always return false for previous behaviour to be retained. - * - * \section Sec_Migration111009 Migrating from 110528 to 111009 - * Non-USB Library Components - * - The \c JTAG_DEBUG_ASSERT() macro has been renamed \ref JTAG_ASSERT() to be consistent with \ref STDOUT_ASSERT(). - * - * USB Core - * - By default, unordered Endpoint and Pipe configuration is now allowed once again, via the previous workaround of - * reconfiguring all Endpoints/Pipes in order each time a new Endpoint/Pipe is created. To minimize the compiled program - * size, the new \c ORDERED_EP_CONFIG compile time option may be defined in the project makefile to restrict the ordering - * in exchange for a smaller compiled binary size. - * - The previous \c F_CLOCK symbol, required in the project makefile, has been renamed to \c F_USB. This is due to the previous name - * being far too generic for use in future architecture ports, where multiple clock domains are used. - * - * Device Mode - * - The Endpoint stream functions now all require a \c BytesProcessed parameter instead of the previous callback parameter. - * This should be set to \c NULL to retain previous behaviour of the functions, or point to a location where the number of bytes - * processed in the current transaction can be stored. If the \c BytesProcessed parameter is non \c NULL, each time the endpoint - * bank becomes full and the packet is sent, the routine will exit with the new \ref ENDPOINT_RWSTREAM_IncompleteTransfer - * error code to allow the user application to determine when to send the next chunk of data. - * - The \ref CDC_Device_SendString() function now expects a null terminated string instead of an explicit length. Existing code - * should use the new \ref CDC_Device_SendData() function, or remove the length parameter from the function call. - * - The \c Endpoint_ResetFIFO() function has been renamed to \ref Endpoint_ResetEndpoint(), to make the API function names more - * consistent. Existing applications using the old function name should simply replace it with a call to the new function name. - * - The \c Endpoint_*_Byte() functions have been renamed Endpoint_*_8() to ensure they are correct across all architectures. Existing - * code using these functions should replace the previous function names with the new function names. - * - The \c Endpoint_*_Word() functions have been renamed Endpoint_*_16() to ensure they are correct across all architectures. Existing - * code using these functions should replace the previous function names with the new function names. - * - The \c Endpoint_*_DWord() functions have been renamed Endpoint_*_32() to ensure they are correct across all architectures. Existing - * code using these functions should replace the previous function names with the new function names. - * - The Device mode RNDIS class driver no longer stores the incoming and outgoing packets in the class driver instance; the user is - * now expected to manually define a storage location for the packet data. Packets must now be sent and received manually via a call - * to \ref RNDIS_Device_ReadPacket() and/or \ref RNDIS_Device_SendPacket(). - * - The definition of the Audio class \ref USB_Audio_Descriptor_Format_t has been altered, to remove the fixed singular - * audio sample rate in the descriptor definition, and to rename the \c SampleFrequencyType to the more appropriate - * \c TotalDiscreteSampleRates. Existing applications will need to add an array of \ref USB_Audio_SampleFreq_t elements - * immediately following any \ref USB_Audio_Descriptor_Format_t descriptors, and insert the appropriate sampling rates - * supported by the device, as well as rename the descriptor elements to match the updated element names. - * - The device mode Audio class driver now requires a new user application callback, \ref CALLBACK_Audio_Device_GetSetEndpointProperty(). - * Existing applications must implement this new callback, however if multiple sample rates or pitch control is not used, - * this function may be hard-coded to always return false for previous behaviour to be retained. - * - The \c USB_ConfigurationNumber, \c USB_RemoteWakeupEnabled and \c USB_CurrentlySelfPowered globals have been renamed to - * \ref USB_Device_ConfigurationNumber, \ref USB_Device_RemoteWakeupEnabled and \ref USB_Device_CurrentlySelfPowered to clearly indicate - * the USB mode they relate to. Existing applications using these variables should rename all references to the previous names. - * - The \c ENDPOINT_DESCRIPTOR_DIR_IN and \c ENDPOINT_DESCRIPTOR_DIR_OUT macros have now been replaced by \ref ENDPOINT_DIR_IN and - * \ref ENDPOINT_DIR_OUT to improve code clarity. - * - The \ref HID_DESCRIPTOR_JOYSTICK() macro now takes an additional (first) parameter indicating the number of axis in the joystick. - * - * Host Mode - * - The Pipe stream functions now all require a \c BytesProcessed parameter instead of the previous callback parameter. - * This should be set to \c NULL to retain previous behaviour of the functions, or point to a location where the number of bytes - * processed in the current transaction can be stored. If the BytesProcessed parameter is non \c NULL, each time the pipe - * bank becomes full and the packet is sent, the routine will exit with the new \ref PIPE_RWSTREAM_IncompleteTransfer - * error code to allow the user application to determine when to send the next chunk of data. - * - The \ref PRNT_Host_SendString() and \ref CDC_Host_SendString() functions now expect a null terminated string instead of an explicit - * length. Existing code should use the new \ref PRNT_Host_SendData() and \ref CDC_Host_SendData() functions, or remove the - * length parameter from the function call. - * - The \c Pipe_ClearErrorFlags() function has been removed, as the pipe error flags are now automatically cleared when the - * \ref Pipe_ClearError() function is called. - * - The \c Pipe_*_Byte() functions have been renamed Pipe_*_8() to ensure they are correct across all architectures. Existing code using - * these functions should replace the previous function names with the new function names. - * - The \c Pipe_*_Word() functions have been renamed Pipe_*_16() to ensure they are correct across all architectures. Existing code using - * these functions should replace the previous function names with the new function names. - * - The \c Pipe_*_DWord() functions have been renamed Pipe_*_32() to ensure they are correct across all architectures. Existing code using - * these functions should replace the previous function names with the new function names. - * - The \c USB_Host_ClearPipeStall() function has been renamed to USB_Host_ClearEndpointStall(), as it operates on a full endpoing address - * within the attached device and not a pipe within the host. Existing code using the old function name should update the function calls and - * check for correct usage. - * - * \section Sec_Migration101122 Migrating from 100807 to 101122 - * USB Core - * - A new USB driver source file, \c Drivers/USB/HighLevel/EndpointStream.c now exists. This source file should be added - * to all project makefiles using the USB driver of LUFA, or the makefile should be updated to use the new module source - * variables. - * - A new USB driver source file, \c Drivers/USB/HighLevel/PipeStream.c now exists. This source file should be added to all - * project makefiles using the USB driver of LUFA, or the makefile should be updated to use the new module source variables. - * - The \c EVENT_USB_InitFailure() event has been removed, as the \ref USB_Init() function will no longer fail; if not USB mode is - * specified, the controller will default to UID selection mode. - * - The USB mode specifier constants have been moved into a new enum and renamed. Existing projects should use the equivalent - * value in the new \ref USB_Modes_t enum. - * - All class driver headers are now included as part of the standard \c LUFA/Drivers/USB/USB.h master dispatch header, and should - * no longer be included separately. Class driver module source files must still be added as a separate module in the project's - * makefile if used. - * - * Device Mode - * - Endpoints MUST be allocated in ascending order to ensure that bank corruption does not occur. Ensure that your user application - * allocated endpoints in ascending order - or if your application uses the USB device mode class drivers, ensure that each instance's - * endpoint indexes are not overlapped with other interface's endpoints. - * - The signature for the \ref CALLBACK_USB_GetDescriptor() callback has changed, the \c void** \c const \c DescriptorAddress parameter is - * now \c const \c void** \c const \c DescriptorAddress. Existing applications should update their callback signatures to match this, and - * eliminate any casting of descriptor pointers to a non \c const pointer. - * - The names of the class specific descriptor type defines in the USB Class drivers have changed - refer to the driver documentation - * for each class driver for the new class specific descriptor type names. - * - The \c ENDPOINT_DOUBLEBANK_SUPPORTED() macro is has been renamed \c ENDPOINT_BANKS_SUPPORTED() and now returns the total number of - * banks supported by the given endpoint. Existing code should switch to the new naming scheme, and test that the return value of the - * macro is equal to or greater than 2 to regain the previous functionality. - * - The \c EVENT_USB_Device_UnhandledControlRequest() event is now named \ref EVENT_USB_Device_ControlRequest() and fires before (not after) - * the internal library event handlers. Existing code should rename the event handlers in the user application to match the new event - * name, and should ensure that the new execution order does not affect the application's operation. - * - * Host Mode - * - Pipes MUST be allocated in ascending order to ensure that bank corruption does not occur. Ensure that your user application - * allocated pipes in ascending order - or if your application uses the USB host mode class drivers, ensure that each instance's - * pipe indexes are not overlapped with other interface's pipes. - * - The \c PRNT_Host_SendData() function has been renamed to \ref PRNT_Host_SendString(). Existing applications should simply - * replace all references to the obsolete function name with the new function name. - * - The names of the class specific descriptor type defines in the USB Class drivers have changed - refer to the driver documentation - * for each class driver for the new class specific descriptor type names. - * - The Still Image Host class' function prefix has been changed from \c SImage_ to \c SI_, to remain consistent with the rest of the - * driver's enums, type defines and constants. - * - * \section Sec_Migration100807 Migrating from 100513 to 100807 - * - * Non-USB Library Components - * - The Dataflash board driver stub file has changed, as dataflash functions previously located in the internal - * Dataflash driver of the library have now been moved to the individual board files. Existing drivers can - * copy-paste the new functions from the board Dataflash stub driver. - * - * USB Core - * - A new USB driver source file, \c Drivers/USB/LowLevel/Device.c now exists. This source file should be added to all project - * makefiles using the USB driver of LUFA, or the makefile should be updated to use the new module source variables. - * - The \c Drivers/USB/LowLevel/DevChapter9.c source file has moved to \c Drivers/USB/HighLevel/DeviceStandardReq.c - this should - * be updated in all project makefiles, or the makefile should be updated to use the new module source variables. - * - The \c Drivers/USB/LowLevel/HostChapter9.h source file has moved to \c Drivers/USB/HighLevel/HostStandardReq.c - this should - * be updated in all project makefiles, or the makefile should be updated to use the new module source variables. - * - The \c Drivers/USB/LowLevel/LowLevel.c source file has moved to \c Drivers/LowLevel/USBController.c - this should be updated - * in all project makefiles, or the makefile should be updated to use the new module source variables. - * - * Device Mode - * - The \c USB_Device_IsRemoteWakeupSent() macro has been removed, as the remote wakeup request is now fully handled by the - * enhanced \ref USB_Device_SendRemoteWakeup() function. Existing code may now discard any checks to \c USB_Device_IsRemoteWakeupSent(). - * - The \c USB_Device_IsUSBSuspended() macro has been removed, as it is obsolete. Existing code should compare \ref USB_DeviceState - * to see if it the device is in the \ref DEVICE_STATE_Suspended state instead. - * - The \ref CDC_Device_ReceiveByte() function has changed, and now returns a signed 16-bit integer, with -1 indicating no data was - * received. This allows for more efficient coding, as a call to \ref CDC_Device_BytesReceived() is no longer needed if the exact - * number of queued bytes received is not needed. - * - * Host Mode - * - The \ref CDC_Host_ReceiveByte() function has changed, and now returns a signed 16-bit integer, with -1 indicating no data was - * received. This allows for more efficient coding, as a call to \ref CDC_Host_BytesReceived() is no longer needed if the exact - * number of queued bytes received is not needed. - * - The \ref CDC_Host_USBTask() now calls \ref CDC_Host_Flush() automatically, flushing any queued data to the attached device. Manual - * flushing of the interface is no longer needed if the flushes should be in sync with calls to \ref CDC_Host_USBTask(). - * - * \section Sec_Migration100513 Migrating from 100219 to 100513 - * - * Non-USB Library Components - * - The \ref TWI_StartTransmission() function now takes in a timeout period, expressed in milliseconds, within which the addressed - * device must respond or the function will abort. - * - * Device Mode - * - The \ref USB_Init() function no longer calls \c sei() to enable global interrupts, as the user application may need - * to perform other initialization before it is ready to handle global interrupts. The user application is now responsible - * for enabling global interrupts before or shortly after calling \ref USB_Init() to ensure that the enumeration process - * functions correctly. - * - The \c USBInterrupt.c USB driver source file has been relocated from \c LUFA/Drivers/USB/HighLevel/ to \c LUFA/Drivers/USB/LowLevel. - * Projects must update their makefile SRC values accordingly. - * - The HID Device Class driver's function signature for the \ref CALLBACK_HID_Device_ProcessHIDReport() function has been changed, to - * allow for a new \c ReportType parameter. This new parameter must be added in all user applications using the Device mode HID Class - * Driver, but may be ignored unless Host-to-Device FEATURE HID reports are used. - * - * Host Mode - * - The \ref USB_Init() function no longer calls \c sei() to enable global interrupts, as the user application may need - * to perform other initialization before it is ready to handle global interrupts. The user application is now responsible - * for enabling global interrupts before or shortly after calling \ref USB_Init() to ensure that the enumeration process - * functions correctly. - * - The \c USBInterrupt.c USB driver source file has been relocated from \c LUFA/Drivers/USB/HighLevel/ to \c LUFA/Drivers/USB/LowLevel. - * Projects must update their makefile \c SRC values accordingly. - * - The HID Host Class driver's function signature for the \ref HID_Host_SendReportByID() function has been changed, to allow for a new - * ReportType parameter. Existing calls to this function should substitute \c REPORT_ITEM_TYPE_Out as this parameter's value. - * - * \section Sec_Migration100219 Migrating from 091223 to 100219 - * - * Non-USB Library Components - * - Due to some ADC channels not being identical to their ADC MUX selection masks for single-ended conversions on some AVR models, - * the ADC driver now has explicit masks for each of the standard ADC channels (see \ref Group_ADC). These masks should be used - * when calling the ADC functions to ensure proper operation across all AVR models. Note that the \ref ADC_SetupChannel() function - * is an exception, and should always be called with a channel number rather than a channel mask. - * - * Host Mode - * - The MIDI Host Class driver send and receive routines now operate on packed events, where multiple MIDI events may be - * packed into a single USB packet. This means that the sending of MIDI events will now be delayed until the MIDI send - * pipe bank is full. To override this new behaviour and revert to the previous behaviour, the user application may manually - * flush the queued event(s) to the device by calling \ref MIDI_Host_Flush(). - * - The \ref Pipe_IsEndpointBound() function now takes the endpoint's direction into account, by checking if the MSB of the endpoint's address - * is set to denote IN endpoints. If the previous functionality where the direction is to be discounted is required, mask the endpoint - * address against the \ref PIPE_EPNUM_MASK token before calling \ref Pipe_IsEndpointBound(). - * - * Device Mode - * - The MIDI Device Class driver send and receive routines now operate on packed events, where multiple MIDI events may be - * packed into a single USB packet. This means that the sending of MIDI events will now be delayed until the MIDI send - * endpoint bank is full. To override this new behaviour and revert to the previous behaviour, the user application may manually - * flush the queued event(s) to the host by calling \ref MIDI_Device_Flush(). - * - * \section Sec_Migration091223 Migrating from 091122 to 091223 - * - * Host Mode - * - The Still Image Host Class driver \ref SI_Host_USBTask() and \ref SI_Host_ConfigurePipes() functions were misnamed, and are - * now named \c SImage_Host_USBTask() and \c SImage_Host_ConfigurePipes() respectively. - * - The \c HOST_SENDCONTROL_DeviceDisconnect enum value has been renamed to \ref HOST_SENDCONTROL_DeviceDisconnected to be in - * line with the rest of the library error codes. - * - The HID Parser item usages no longer contain separate minimum and maximum values, as this was a violation of the HID - * specification. Instead, the values are distributed evenly across each item as its usage value, to ensure that all items - * can be distinguished from one-another. - * - * Device Mode - * - The \ref CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new \c ReportType parameter to - * indicate the report type to generate. Existing applications may simply add and ignore this additional parameter. - * - * \section Sec_Migration091122 Migrating from 090924 to 091122 - * - * Host Mode - * - The \c HID_PARSE_UsageStackOverflow HID parser error constant is now named \ref HID_PARSE_UsageListOverflow - * - The \ref CALLBACK_HIDParser_FilterHIDReportItem() HID Parser callback now passes a complete \ref HID_ReportItem_t to the - * user application, instead of just its attributes. - * - The \c USB_GetDeviceConfigDescriptor() function was incorrectly named and is now called \ref USB_Host_GetDeviceConfigDescriptor(). - * - * \section Sec_Migration090924 Migrating from 090810 to 090924 - * - * Non-USB Library Components - * - The \c ADC_Off() function has been renamed to \c ADC_ShutDown() to be consistent with the rest of the library. - * - The \ref SPI_Init() routine's parameters have changed, so that the clock polarity and data sampling modes can be set. See - * the \ref SPI_Init() function documentation for more details - * - The \ref Dataflash_Init() routine no longer initializes the SPI bus - the SPI bus should be initialized manually via a - * call to \ref SPI_Init() before using the Dataflash driver - * - * Host Mode - * - The \c USB_GetDeviceConfigDescriptor() function's parameters and behaviour has changed; the user is required to - * preallocate the largest allowable buffer, and pass the size of the buffer to the function. This allows for a single - * call to the function to retrieve, size check and validate the Configuration Descriptor rather than having the user - * application perform these intermediary steps. - * - The HID report parser now requires a mandatory callback in the user code, to filter only the items the application - * is interested in into the processed HID report item structure to save RAM. See \ref CALLBACK_HIDParser_FilterHIDReportItem(). - * - The HID report parser now always parses FEATURE and always ignores constant-data items - the \c HID_ENABLE_FEATURE_PROCESSING - * and \c HID_INCLUDE_CONSTANT_DATA_ITEMS compile time tokens now have no effect. - * - The \c USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate \c USB_Descriptor_* - * and \c USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so that both may be used in - * the one project. For existing projects using the standardized names, change all code to use the \c USB_StdDescriptor_* variants. - * - * Device Mode - * - The \c USE_NONSTANDARD_DESCRIPTOR_NAMES compile time token has been removed - there are now separate \c USB_Descriptor_* - * and \c USB_StdDescriptor_* structures for both the LUFA and standardized element naming conventions so that both may be used in - * the one project. For existing projects using the standardized names, change all code to use the \c USB_StdDescriptor_* variants. - * - * \section Sec_Migration090810 Migrating from 090605 to 090810 - * - * All - * - The "Simple Scheduler" has been deprecated, as it was little more than an abstracted loop and caused much confusion. - * User applications using the scheduler should switch to regular loops instead. The scheduler code will be removed in a future - * release. - * - The "Dynamic Memory Block Allocator" has been removed, as it was unused in (and unrelated to) the LUFA library and never - * used in user applications. - * - * Non-USB Library Components - * - The \c ATTR_NOINLINE function attribute macro has been renamed to \ref ATTR_NO_INLINE to be in line with the rest of the function attribute - * macro names. - * - * Library Demos - * - Most demos now have a corresponding Class Driver implementation, which uses the new internal library class drivers for the standard - * USB classes. This allows for more rapid device and host development, and so should be used in preference to the low level APIs where - * possible so that fixes to the class drivers propagate to all applications which use them automatically with each new LUFA release. - * - * Host Mode - * - The \c HIDParser.c module has moved from \c LUFA/Drivers/USB/Class/ to \c LUFA/Drivers/USB/Class/Host/. - * - The \c USB_GetDeviceConfigDescriptor() function now requires the desired configuration index within the device as its first - * parameter, to add support for multi-configuration devices. Existing code should use a configuration index of 1 to indicate the - * first configuration descriptor within the device. - * - The non-standard "Ready" host state has been removed. Existing \ref HOST_STATE_Configured code should be moved to the end of - * the existing \ref HOST_STATE_Addressed state, and the existing HOST_STATE_Ready state code should be moved to the \ref HOST_STATE_Configured - * state. - * - The \c USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_HostState explicitly to ensure the host is - * in the desired state instead. - * - The USB event names have been changed and their firing conditions changed to properly separate out Host mode events from Device mode - * events. See the \ref Group_Events page for details on the new event names and firing conditions. - * - * Device Mode - * - The \ref CALLBACK_USB_GetDescriptor() function now takes an extra parameter to specify the descriptor's memory space so that - * descriptors in mixed memory spaces can be used. The previous functionality can be returned by defining the \c USE_FLASH_DESCRIPTORS - * token in the project makefile to fix all descriptors into FLASH space and remove the extra function parameter. - * - The \c USB_IsSuspended global has been removed - test \ref USB_DeviceState against \ref DEVICE_STATE_Suspended instead. - * - The \c USB_IsConnected global has been removed, as it is too vague for general use. Test \ref USB_DeviceState explicitly to ensure the device - * is in the desired state instead. - * - The VBUS events have been removed, as they are already exposed to the user via the \c USB_Connect and \c USB_Disconnect events. - * - The USB event names have been changed and their firing conditions changed to properly separate out Host mode events from Device mode - * events. See the \ref Group_Events page for details on the new event names and firing conditions. - * - * \section Sec_Migration090605 Migrating from 090510 to 090605 - * - * Device Mode - * - Support for non-control data endpoint interrupts has been dropped due to many issues in the implementation. All existing - * projects using interrupts on non-control endpoints should switch to polling. For control interrupts, the library can - * manage the control endpoint via interrupts automatically by compiling with the \c INTERRUPT_CONTROL_ENDPOINT token defined. - * - The \c DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory - * address. - * - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See - * \ref Group_Events for new API details. - * - The \c STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular - * function signatures of a function accepting no arguments and returning a \c uint8_t value. - * - The \c Event_DeviceError() event no longer exists, as its sole caller (unlinked \c USB_GetDescriptor() function) now produces a - * compilation error rather than a runtime error. The \c StdDescriptors.c file no longer exists as a result, and should be removed - * from project makefiles. - * - The \c USB_GetDescriptor() function has been renamed to \ref CALLBACK_USB_GetDescriptor() to be in line with the new \c CALLBACK_ - * function prefixes for functions which must be implemented in the user application. - * - * Host Mode - * - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing - * projects using interrupts on non-control pipes should switch to polling. - * - The library events system has been rewritten, so that all macros have been removed to allow for clearer user code. See - * \ref Group_Events for new API details. - * - The \c STREAM_CALLBACK() macro has been removed. User applications should replace all instances of the macro with regular - * function signatures of a function accepting no arguments and returning a \c uint8_t value. - * - The \c DESCRIPTOR_COMPARATOR() macro has been removed. User applications should replace all instances of the macro with - * regular function signatures of a function accepting a void pointer to the descriptor to test, and returning a \c uint8_t value. - * - * \section Sec_Migration090510 Migrating from 090401 to 090510 - * - * All - * - The \c ButtLoadTag.h header has been removed, as it was never used for its intended purpose. Projects should either remove all - * \c BUTTLOADTAG() elements, or download and extract \c ButtLoadTag.h header from the ButtLoad project. - * - The \c Drivers/AT90USBXXX/ directory has been renamed to \c Drivers/Peripheral/. - * - The \c Serial_Stream driver has been renamed to \c SerialStream to remain consistent with the rest of the library naming scheme. - * - The HWB driver has changed to the \c Buttons driver. See the board Buttons driver documentation for the new API. - * - * Dual Role Mode - * - The \c USB_PowerOnFail event has been renamed to \c USB_InitFailure. - * - The functions in \c OTG.h have been renamed to remain more consistent with the library API. See the functions in \c OTG.h for more - * details. - * - * Device Mode - * - The \c Endpoint_ClearCurrentBank() macro has been removed, and is now replaced with the \ref Endpoint_ClearIN(), \ref Endpoint_ClearOUT() - * macros. See \c Endpoint.h documentation for more details on the new endpoint management macros. - * - The \c Endpoint_ReadWriteAllowed() macro has been renamed to \ref Endpoint_IsReadWriteAllowed() to be more consistent with the rest of - * the API naming scheme. - * - The \c Endpoint_IsSetupINReady() and \c Endpoint_IsSetupOUTReceived() macros have been renamed to \ref Endpoint_IsINReady() and - * \ref Endpoint_IsOUTReceived() respectively. - * - The \c Endpoint_IsSetupReceived() macro has been renamed to \ref Endpoint_IsSETUPReceived(). - * - The \c Endpoint_ClearSetupReceived() macro has been renamed to \ref Endpoint_ClearSETUP(). - * - All endpoint read/write/discard aliases which did not have an explicitly endianness specifier (such as \c Endpoint_Read_Word()) have - * been removed for clarity. Existing projects should use the \c _LE suffix on such calls to use the explicit Little Endian versions. - * - The \c USB_UnhandledControlPacket event no longer has any parameters. User code should no longer attempt to read in the remainder of - * the Control Request header as all Control Request header data is now preloaded by the library and made available in the - * USB_ControlRequest structure. - * - The \c FEATURELESS_CONTROL_ONLY_DEVICE token has been renamed to \c CONTROL_ONLY_DEVICE. - * - The \c STATIC_ENDPOINT_CONFIGURATION is no longer applicable as the library will apply this optimization when appropriate automatically. - * - The values of the \ref Endpoint_Stream_RW_ErrorCodes_t and \ref Endpoint_ControlStream_RW_ErrorCodes_t enums have had the \c ERROR_ portion - * of their names removed. - * - * Host Mode - * - The \ref USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0) to allow it to be used on - * other control type pipes. Care should be taken to ensure that the Control pipe is always selected before the function is called - * in existing projects where the Control pipe is to be operated on. - * - The USB Host management task now saves and restores the currently selected pipe before and after the task runs. Projects no longer - * need to manage this manually when calling the USB management task. - * - The \c Pipe_ClearCurrentBank() macro has been removed, and is now replaced with the Pipe_ClearIN(), Pipe_ClearOUT() macros. See - * Pipe.h documentation for more details on the new pipe management macros. - * - The \c Pipe_ReadWriteAllowed() macro has been renamed to \ref Pipe_IsReadWriteAllowed() to be more consistent with the rest of the API - * naming scheme. - * - The \c Pipe_IsSetupINReceived() and \c Pipe_IsOutReady() macros have been renamed to \ref Pipe_IsINReceived() and \ref Pipe_IsOUTReady() - * respectively. - * - The new \ref Pipe_ClearSETUP() macro should be used to send SETUP transactions, rather than the previous \c Pipe_ClearSetupOUT() macro. - * - The \c Pipe_IsSetupSent() macro has been renamed to \ref Pipe_IsSETUPSent(). - * - The \c Pipe_ClearSetupSent() macro is no longer applicable and should be removed. - * - All pipe read/write/discard aliases which did not have an explicitly endianness specifier (such as \c Pipe_Read_Word()) have - * been removed for clarity. Existing projects should use the \c _LE suffix on such calls to use the explicit Little Endian versions. - * - The \c Host_IsResetBusDone() macro has been renamed to \c Host_IsBusResetComplete(). - * - The \c Pipe_Ignore_Word() and \c Pipe_Ignore_DWord() functions have been renamed to \c Pipe_Discard_Word() and \c Pipe_Discard_DWord() - * to remain consistent with the rest of the pipe API. - * - It is no longer needed to manually include the headers from \c LUFA/Drivers/USB/Class, as they are now included along with the rest - * of the USB headers when \c LUFA/Drivers/USB/USB.h is included. - * - Functions in the \c ConfigDescriptor.h header file no longer have \c Host_ as part of their names. - * - The \c ProcessHIDReport() has been renamed to \ref USB_ProcessHIDReport(), \c GetReportItemInfo() has been renamed to \ref USB_GetHIDReportItemInfo() - * and \c SetReportItemInfo() has been renamed to \ref USB_GetHIDReportItemInfo(). - * - The values of the \ref DSearch_Return_ErrorCodes_t and \ref DSearch_Comp_Return_ErrorCodes_t enums have had their respective \c Descriptor_Search - * and \c Descriptor_Search_Comp prefixes changed to all caps. - * - The \c USB_HostRequest global has been renamed to \ref USB_ControlRequest, and is used in Device mode also. The \c USB_Host_Request_Header_t - * structure type has been renamed to \ref USB_Request_Header_t. - * - The values of the \ref Pipe_Stream_RW_ErrorCodes_t enum have had the \c ERROR_ portion of their names removed. - * - * \section Sec_Migration090401 Migrating from 090209 to 090401 - * - * All - * - LUFA projects must now give the raw input clock frequency (before any prescaling) as a compile time constant \c F_USB, - * defined in the project makefile and passed to the compiler via the -D switch. - * - The makefile EEPROM programming targets for FLIP and dfu-programmer no longer program in the FLASH data in addition to the - * EEPROM data into the device. If both are to be programmed, both the EEPROM and FLASH programming targets must be called. - * - As the avr-libc macro has been corrected in recent avr-libc distributions, the \c SetSystemClockPrescaler() macro has been removed. - * Include \c and call \c clock_prescale_set(clock_div_1); instead on recent avr-libc distributions. - * - * Library Demos - * - The USBtoSerial demo now discards all data when not connected to a host, rather than buffering it for later transmission. - * - * Non-USB Library Components - * - The \c ATTR_ALWAYSINLINE function attribute macro has been renamed to \ref ATTR_ALWAYS_INLINE. - * - Custom board Dataflash drivers now require the implementation of \ref Dataflash_SelectChipFromPage() and \ref Dataflash_SendAddressBytes(). - * - * Device Mode - * - The \c NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to \c FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded - * to also remove parts of the Get Status chapter 9 request to further reduce code usage. On all applications currently using the - * \c NO_CLEARSET_FEATURE_REQUEST compile time token, it can be replaced with the \c FEATURELESS_CONTROL_ONLY_DEVICE token with no further - * modifications required. - * - * \section Sec_Migration090209 Migrating from 081217 to 090209 - * - * Device Mode - * - The \c ENDPOINT_MAX_ENDPOINTS constant has been renamed to the more appropriate name of \c ENDPOINT_TOTAL_ENDPOINTS. - * - The \c USB_STREAM_TIMEOUT_MS stream timeout default period has been extended to 100ms. This can be overridden in the user - * makefile if desired to restore the previous 50ms timeout. - * - * Host Mode - * - The \c PIPE_MAX_ENDPOINTS constant has been renamed to the more appropriate name of \c PIPE_TOTAL_ENDPOINTS. - * - The \c USB_STREAM_TIMEOUT_MS stream timeout default period has been extended to 100ms. This can be overridden in the user - * makefile if desired to restore the previous 50ms timeout. - * - The \c USB_DeviceEnumerationFailed event now contains a second \c SubErrorCode parameter, giving the error code of the function - * which failed. - * - The \c HID_PARSE_Sucessful enum member constant name has been corrected to \ref HID_PARSE_Successful. - * - * Non-USB Library Components - * - The previous \c SPI_SendByte() functionality is now located in \ref SPI_TransferByte(). \ref SPI_SendByte() now discards the return byte - * for speed, to compliment the new \ref SPI_ReceiveByte() function. If bidirectional SPI transfers are required, calls to \ref SPI_SendByte() - * should be changed to \ref SPI_TransferByte(). - * - The serial driver now sets the Tx line as an output explicitly, and enables the pull-up of the Rx line. - * - The \ref Serial_Init() and \c SerialStream_Init() functions now take a second \c DoubleSpeed parameter, which indicates if the USART - * should be initialized in double speed mode - useful in some circumstances for attaining baud rates not usually possible at the given AVR - * clock speed. - * - * \section Sec_Migration171208 Migrating from V1.5.3 to 081217 - * - * All - * - The MyUSB project name has been changed to LUFA (Lightweight Framework for USB AVRs). All references to MyUSB, including macro names, - * have been changed to LUFA. - * - * Library Demos - * - The ReconfigureUSART() routine in the USBtoSerial demo was not being called after new line encoding - * parameters were set by the host. Projects built on the USBtoSerial code should update to the latest version. - * - The HID Parser now supports multiple report (on a single endpoint) HID devices. The MouseHostWithParser and - * KeyboardHostWithPaser demos use the updated API functions to function correctly on such devices. Projects - * built on either "WithParser" demo should update to the latest code. - * - The RNDIS demo TCP stack has been modified so that connections can be properly closed. It is still not - * recommended that the MyUSB RNDIS demo TCP/IP stack be used for anything other than demonstration purposes, - * as it is neither a full nor a standards compliant implementation. - * - * Non-USB Library Components - * - The Serial_IsCharReceived() macro has been changed to the correct spelling of Serial_IsCharReceived() in Serial.h. - * - * Device Mode - * - The MANUAL_PLL_CONTROL compile time token has been removed, and replaced with a USB_OPT_MANUAL_PLL mask - * to be used in the Options parameter of the USB_Init() function. - * - Calling USB_Init() now forces a complete USB interface reset and enumeration, even if the USB interface is - * currently initialized. - * - Interrupts are now disabled when processing control requests, to avoid problems with interrupts causing the library - * or user request processing code to exceed the strict USB timing requirements on control transfers. - * - The USB Reset event now resets and disables all device endpoints. If user code depends on endpoints remaining configured - * after a Reset event, it should be altered to explicitly re-initialize all user endpoints. - * - The prototype for the GetDescriptor function has been changed, as the return value was redundant. The function now - * returns the size of the descriptor, rather than passing it back via a parameter, or returns NO_DESCRIPTOR if the specified - * descriptor does not exist. - * - The NO_DESCRIPTOR_STRING macro has been renamed NO_DESCRIPTOR, and is now also used as a possible return value for the - * GetDescriptor function. - * - * Host Mode - * - The MANUAL_PLL_CONTROL compile time token has been removed, and replaced with a USB_OPT_MANUAL_PLL mask - * to be used in the Options parameter of the USB_Init() function. - * - The HID report parser now supports multiple Report IDs. The HID report parser GetReportItemInfo() and - * SetReportItemInfo() routines now return a boolean, set if the requested report item was located in the - * current report. If sending a report to a multi-report device, the first byte of the report is automatically - * set to the report ID of the given report item. - * - Calling USB_Init() now forces a complete USB interface reset and enumeration, even if the USB interface is - * currently initialized. - * - * \section Sec_Migration152 Migrating from V1.5.2 to V1.5.3 - * - * Library Demos - * - Previously, all demos contained a serial number string descriptor, filled with all zeros. A serial number - * string is required in Mass Storage devices, or devices which are to retain settings when moved between - * ports on a machine. As people were not changing the serial number value, this was causing conflicts and so - * the serial number descriptor has been removed from all but the Mass Storage demo, which requires it. - * - The AudioOut and AudioIn demos did not previously silence their endpoints when the host has deactivated - * them. Projects built upon either demo should upgrade to the latest code. - * - The FEATURE_ENDPOINT macro has been renamed FEATURE_ENDPOINT_HALT, and is now correctly documented. - * - The MassStoreHost demo contained errors which caused it to lock up randomly on certain devices. Projects built - * on the MassStoreDemo code should update to the latest version. - * - The Interrupt type endpoint in the CDC based demos previously had a polling interval of 0x02, which caused - * problems on some Linux systems. This has been changed to 0xFF, projects built on the CDC demos should upgrade - * to the latest code. - * - The HID keyboard and mouse demos were not previously boot mode compatible. To enable boot mode support, projects - * built on the keyboard or mouse demos (or derivatives) should upgrade to the latest code. - * - The Mass Storage demo was not previously standards compliant. Projects built on the Mass Storage demo should - * upgrade to the latest code. - * - The USART was not being reconfigured after the host sent new encoding settings in the USBtoSerial demo. This was - * previously discovered and fixed, but the change was lost. Projects built on the USBtoSerial demo should update - * to the latest code. - * - * Device Mode - * - The endpoint non-control stream functions now have a default timeout of 50ms between packets in the stream. - * If this timeout is exceeded, the function returns the new ENDPOINT_RWSTREAM_ERROR_Timeout error value. The - * timeout value can be overridden by defining the USB_STREAM_TIMEOUT_MS in the project makefile to the desired - * timeout duration in ms. - * - Rather than returning fixed values, the flags indicating if the device has Remote Wakeup currently enabled - * and/or is self-powered are now accessed and set through the new USB_RemoteWakeupEnabled and - * USB_CurrentlySelfPowered macros. See the DevChapter9.h documentation for more details. - * - All endpoint stream functions now require an extra Callback function parameter. Existing code may be updated - * to either supply NO_STREAM_CALLBACK as the extra parameter, or disable stream callbacks altogether by passing - * the token NO_STREAM_CALLBACKS to the compiler using the -D switch. - * - * Host Mode - * - The pipe non-control stream functions now have a default timeout of 50ms between packets in the stream. - * If this timeout is exceeded, the function returns the new PIPE_RWSTREAM_ERROR_Timeout error value. The - * timeout value can be overridden by defining the USB_STREAM_TIMEOUT_MS in the project makefile to the desired - * timeout duration in ms. - * - CollectionPath_t has been renamed to HID_CollectionPath_t to be more in line with the other HID parser structures. - * - All pipe stream functions now require an extra Callback function parameter. Existing code may be updated - * to either supply NO_STREAM_CALLBACK as the extra parameter, or disable stream callbacks altogether by passing - * the token NO_STREAM_CALLBACKS to the compiler using the -D switch. - * - * \section Sec_Migration151 Migrating from V1.5.1 to V1.5.2 - * - * Library Demos - * - The RNDIS demo application has been updated so that it is functional on Linux under earlier implementations - * of the RNDIS specification, which had non-standard behaviour. Projects built upon the demo should upgrade - * to the latest code. - * - The DFU class bootloader has had several bugs corrected in this release. It is recommended that where - * possible any existing devices upgrade to the latest bootloader code. - * - * \section Sec_Migration150 Migrating from V1.5.0 to V1.5.1 - * - * Library Demos - * - The USBtoSerial demo was broken in the 1.5.0 release, due to incorrect register polling in place of the - * global "Transmitting" flag. The change has been reverted in this release. Projects built upon the demo - * should upgrade to the latest code. - * - The HID class demos did not implement the mandatory GetReport HID class request. Projects built upon the HID - * demos should upgrade to the latest code. - * - The HID class demos incorrectly reported themselves as boot-protocol enabled HID devices in their descriptors. - * Projects built upon the HID demos should upgrade to the latest code. - * - The MIDI device demo had incorrect AudioStreaming interface descriptors. Projects built upon the MIDI demo - * should upgrade to the latest code. - * - The AudioOut demo did not correctly tristate the speaker pins when USB was disconnected, wasting power. - * Projects built upon the AudioOut demo should upgrade to the latest code. - * - * \section Sec_Migration141 Migrating from V1.4.1 to V1.5.0 - * - * Library Demos - * - Previous versions of the library demos had incorrectly encoded BCD version numbers in the descriptors. To - * avoid such mistakes in the future, the VERSION_BCD macro has been added to StdDescriptors.h. Existing - * projects should at least manually correct the BCD version numbers, or preferably update the descriptors to - * encode the version number in BCD format using the new macro. - * - The mandatory GetReport class-specific request was accidentally omitted from previous versions of the demos - * based on the Human Interface Device (HID) class. This has been corrected, and any user projects based on the - * HID demos should also be updated accordingly. - * - The CDC demos now correctly send an empty packet directly after a full packet, to end the transmission. - * Failure to do this on projects which always or frequently send full packets will cause buffering issues on - * the host OS. All CDC user projects are advised to update their transmission routines in the same manner as - * the library CDC demos. - * - The previous interrupt-driven Endpoint/Pipe demos did not properly save and restore the currently selected - * Endpoint/Pipe when the ISR fired. This has been corrected - user projects based on the interrupt driven - * demos should also update to properly save and restore the selected Endpoint/Pipe. - * - * Non-USB Library Components - * - The Atomic.h and ISRMacro.h header files in MyUSB/Common have been removed, as the library is now only - * compatible with avr-libc library versions newer than the time before the functionality of the deleted - * headers was available. - * - * Device Mode - * - The GetDescriptor function (see StdDescriptors.h) now has a new prototype, with altered parameter names and - * functions. Existing projects will need to update the GetDescriptor implementation to reflect the new API. - * The previously split Type and Index parameters are now passed as the original wValue parameter to the - * function, to make way for the USB specification wIndex parameter which is not the same as the - * previous Index parameter. - * - The USB_UnhandledControlPacket event (see Events.h) now has new parameter names, to be in line with the - * official USB specification. Existing code will need to be altered to use the new parameter names. - * - The USB_CreateEndpoints event (see Events.h) has been renamed to USB_ConfigurationChanged, which is more - * appropriate. It fires in an identical manner to the previously named event, thus the only change to be made - * is the event name itself in the user project. - * - The USB_Descriptor_Language_t structure no longer exists in StdDescriptors.h, as this was a - * pseudo-descriptor modeled on the string descriptor. It is replaced by the true USB_Descriptor_String_t type - * descriptor as indicated in the USB specification, thus all device code must be updated accordingly. - * - The names of several Endpoint macros have been changed to be more consistent with the rest of the library, - * with no implementation changes. This means that existing code can be altered to use the new macro names - * with no other considerations required. See Endpoint.h for the new macro names. - * - The previous version of the MassStorage demo had an incorrect value in the SCSI_Request_Sense_Response_t - * structure named SenseData in SCSI.c which caused some problems with some hosts. User projects based on this - * demo should correct the structure value to maintain compatibility across multiple OS platforms. - * - By default, the descriptor structures use the official USB specification names for the elements. Previous - * versions of the library used non-standard (but more verbose) names, which are still usable in the current - * and future releases when the correct compile time option is enabled. See the StdDescriptors.h file - * documentation for more details. - * - * Host Mode - * - The USB_Host_Request_Header_t structure in HostChapter9.h (used for issuing control requests) has had its - * members renamed to the official USB specification names for requests. Existing code will need to be updated - * to use the new names. - * - The names of several Pipe macros have been changed to be more consistent with the rest of the library, - * with no implementation changes. This means that existing code can be altered to use the new macro names - * with no other considerations required. See Pipe.h for the new macro names. - * - By default, the descriptor structures use the official USB specification names for the elements. Previous - * versions of the library used non-standard (but more verbose) names, which are still usable in the current - * and future releases when the correct compile time option is enabled. See the StdDescriptors.h file - * documentation for more details. - * - The names of the macros in Host.h for controlling the SOF generation have been renamed, see the Host.h - * module documentation for the new macro names. - * - * Dual Role Mode - * - The OTG.h header file has been corrected so that the macros now perform their stated functions. Any existing - * projects using custom headers to fix the broken OTG header should now be altered to once again use the OTG - * header inside the library. - * - The USB_DeviceEnumerationComplete event (see Events.h) now also fires in Device mode, when the host has - * finished enumerating the device. Projects relying on the event only firing in Host mode should be updated - * so that the event action only occurs when the USB_Mode global is set to USB_MODE_HOST. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt deleted file mode 100644 index 6ff1856766..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt +++ /dev/null @@ -1,30 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_ProgrammingApps Programming an Application into a USB AVR - * - * Once you have built an application, you will need a way to program in the resulting ".HEX" file (and, if your - * application uses EEPROM variables with initial values, also a ".EEP" file) into your USB AVR. Normally, the - * reprogramming of an AVR device must be performed using a special piece of programming hardware, through one of the - * supported AVR programming protocols - ISP, HVSP, HVPP, JTAG, dW or PDI. This can be done through a custom programmer, - * a third party programmer, or an official Atmel AVR tool - for more information, see the atmel.com website. - * - * Alternatively, you can use the bootloader. From the Atmel factory, each USB AVR comes preloaded with the Atmel - * DFU (Device Firmware Update) class bootloader, a small piece of AVR firmware which allows the remainder of the - * AVR to be programmed through a non-standard interface such as the serial USART port, SPI, or (in this case) USB. - * Bootloaders have the advantage of not requiring any special hardware for programming, and cannot usually be erased - * or broken without an external programming device. They have disadvantages however; they cannot change the fuses of - * the AVR (special configuration settings that control the operation of the chip itself) and a small portion of the - * AVR's FLASH program memory must be reserved to contain the bootloader firmware, and thus cannot be used by the - * loaded application. - * - * If you wish to use the DFU bootloader to program in your application, refer to your DFU programmer's documentation. - * Atmel provides a free utility called FLIP which is USB AVR compatible, and an open source (Linux compatible) - * alternative exists called "dfu-programmer". - * - * \see \ref Page_BuildModule_DFU for information on the LUFA build system DFU module, for automatic DFU bootloader - * programming makefile targets. - */ diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt deleted file mode 100644 index 328466103d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt +++ /dev/null @@ -1,71 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** - * \page Page_SoftwareBootloaderStart Entering the Bootloader via Software - * - * A common requirement of many applications is the ability to jump to the programmed bootloader of a chip - * on demand, via the code's firmware (i.e. not as a result of any physical user interaction with the - * hardware). This might be required because the device does not have any physical user input, or simply - * just to streamline the device upgrade process on the host PC. - * - * The following C code snippets may be used to enter the bootloader upon request by the user application. - * By using the watchdog to physically reset the controller, it is ensured that all system hardware is - * completely reset to their defaults before the bootloader is run. This is important; since bootloaders - * are written to occupy a very limited space, they usually make assumptions about the register states based - * on the default values after a hard-reset of the chip. - * - * \section Sec_SoftareBootAVR8 AVR8 Architecture - * The following software bootloader jump code is written for the AVR8 architecture. - * - * \code - * #include - * #include - * #include - * - * #include - * #include - * - * uint32_t Boot_Key ATTR_NO_INIT; - * - * #define MAGIC_BOOT_KEY 0xDC42ACCA - * #define BOOTLOADER_START_ADDRESS (FLASH_SIZE_BYTES - BOOTLOADER_SEC_SIZE_BYTES) - * - * void Bootloader_Jump_Check(void) ATTR_INIT_SECTION(3); - * void Bootloader_Jump_Check(void) - * { - * // If the reset source was the bootloader and the key is correct, clear it and jump to the bootloader - * if ((MCUSR & (1 << WDRF)) && (Boot_Key == MAGIC_BOOT_KEY)) - * { - * Boot_Key = 0; - * ((void (*)(void))BOOTLOADER_START_ADDRESS)(); - * } - * } - * - * void Jump_To_Bootloader(void) - * { - * // If USB is used, detach from the bus and reset it - * USB_Disable(); - * - * // Disable all interrupts - * cli(); - * - * // Wait two seconds for the USB detachment to register on the host - * Delay_MS(2000); - * - * // Set the bootloader key to the magic value and force a reset - * Boot_Key = MAGIC_BOOT_KEY; - * wdt_enable(WDTO_250MS); - * for (;;); - * } - * \endcode - * - * Note that the bootloader magic key can be any arbitrary value. The FLASH_SIZE_BYTES and - * BOOTLOADER_SEC_SIZE_BYTES tokens should be replaced with the total flash size of the AVR - * in bytes, and the allocated size of the bootloader section for the target AVR. - * - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm deleted file mode 100644 index c6de4e64dd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css deleted file mode 100644 index b0b8464beb..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css +++ /dev/null @@ -1,1123 +0,0 @@ -@media print - { - #top - { - display:none; - } - - #side-nav - { - display:none; - } - - #nav-path - { - display:none; - } - - body - { - overflow:visible; - } - - h1,h2,h3,h4,h5,h6 - { - page-break-after:avoid; - } - - .summary - { - display:none; - } - - .memitem - { - page-break-inside:avoid; - } - - #doc-content - { - display:inline; - height:auto !important; - margin-left:0 !important; - overflow:inherit; - width:auto !important; - } - - .fragment - { - background-color: #FFFFFF !important; - } -} - -body,table,div,p,dl -{ - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:13px; - line-height:1.3; -} - -div.contents p -{ - padding-left:12px; -} - -div.contents table.memberdecls,.paramname -{ - font-family:Consolas, Monaco, courier, sans-serif; - font-size:105%; - padding-right:20px; -} - -.title -{ - font-size:150%; - font-weight:bold; - margin:10px 2px; -} - -h1 -{ - font-size:25px; - margin-bottom:10px; -} - -h2 -{ - color:#42657B; - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:17px; -} - -h3 -{ - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:15px; -} - -h4 -{ - font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size:13px; -} - -dt -{ - font-weight:bold; -} - -div.multicol -{ - -moz-column-count:3px; - -moz-column-gap:1em; - -webkit-column-count:3px; - -webkit-column-gap:1em; -} - -p.startli,p.startdd,p.starttd -{ - margin-top:2px; -} - -p.endli -{ - margin-bottom:0; -} - -p.enddd -{ - margin-bottom:4px; -} - -p.endtd -{ - margin-bottom:2px; -} - -caption -{ - font-weight:bold; -} - -span.legend -{ - font-size:70%; - text-align:center; -} - -h3.version -{ - font-size:90%; - text-align:center; -} - -div.qindex,div.navtab -{ - background-color:#EAEFF7; - border:1px solid #9EB3DC; - text-align:center; -} - -div.qindex,div.navpath -{ - line-height:140%; - width:100%; -} - -div.navtab -{ - margin-right:15px; -} - -a -{ - color:#355594; - font-weight:normal; - text-decoration:none; -} - -.contents a:visited -{ - color:#3D62AB; -} - -a:hover -{ - text-decoration:underline; -} - -a.qindex -{ - font-weight:bold; -} - -a.qindexHL -{ - background-color:#97ADD9; - border:1px double #7F9BD1; - color:#ffffff; - font-weight:bold; -} - -.contents a.qindexHL:visited -{ - color:#ffffff; -} - -a.el -{ - font-weight:bold; -} - -a.code,a.code:visited -{ - color:#4665A2; -} - -a.codeRef,a.codeRef:visited -{ - color:#4665A2; -} - -dl.el -{ - margin-left:-1cm; -} - -pre.fragment { - border: 1px solid #C4CFE5; - background-color: #FBFCFD; - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; - font-family: monospace, fixed; - font-size: 105%; -} - -div.fragment { - padding: 4px; - margin: 4px; - background-color: #FBFCFD; - border: 1px solid #C4CFE5; -} - -div.line { - font-family: monospace, fixed; - font-size: 13px; - min-height: 13px; - line-height: 1.0; - text-wrap: unrestricted; - white-space: -moz-pre-wrap; /* Moz */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* IE 5.5+ */ - text-indent: -53px; - padding-left: 53px; - padding-bottom: 0px; - margin: 0px; -} - -span.lineno { - padding-right: 4px; - text-align: right; - border-right: 2px solid #0F0; - background-color: #E8E8E8; - white-space: pre; -} -span.lineno a { - background-color: #D8D8D8; -} - -span.lineno a:hover { - background-color: #C8C8C8; -} - -div.ah -{ - -moz-border-radius:.5em; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 2px 2px 2px; - -webkit-border-radius:.5em; - -webkit-box-shadow:2px 2px 3px #999; - background-color:black; - background-image:0; - border:solid thin #333; - border-radius:0.5em; - box-shadow:2px 2px 3px #999; - color:#ffffff; - font-weight:bold; - margin-bottom:3px; - margin-top:3px; - padding:0.2em; -} - -div.groupHeader -{ - font-weight:bold; - margin-left:16px; - margin-top:12px; -} - -div.groupText -{ - font-style:italic; - margin-left:16px; -} - -body -{ - background-color:white; - color:black; - margin:0; -} - -div.contents -{ - margin-left:8px; - margin-right:8px; - margin-top:10px; -} - -td.indexkey -{ - background-color:#EAEFF7; - border:1px solid #C1CEE8; - font-weight:bold; - margin:2px 0; - padding:2px 10px; - vertical-align:top; - white-space:nowrap; -} - -td.indexvalue -{ - background-color:#EAEFF7; - border:1px solid #C1CEE8; - margin:2px 0; - padding:2px 10px; -} - -tr.memlist -{ - background-color:#EDF1F8; -} - -p.formulaDsp -{ - text-align:center; -} - -img.formulaInl -{ - vertical-align:middle; -} - -div.center -{ - margin-bottom:0; - margin-top:0; - padding:0; - text-align:center; -} - -div.center img -{ - border:0; -} - -address.footer -{ - padding-right:12px; - text-align:right; -} - -img.footer -{ - border:0; - vertical-align:middle; -} - -span.keyword -{ - color:#008000; -} - -span.keywordtype -{ - color:#604020; -} - -span.keywordflow -{ - color:#e08000; -} - -span.comment -{ - color:#008000; -} - -span.preprocessor -{ - color:#806020; -} - -span.stringliteral -{ - color:#002080; -} - -span.charliteral -{ - color:#008080; -} - -span.vhdldigit -{ - color:#ff00ff; -} - -span.vhdlchar -{ - color:#000000; -} - -span.vhdlkeyword -{ - color:#700070; -} - -span.vhdllogic -{ - color:#ff0000; -} - -blockquote -{ - background-color:#F6F8FC; - border-left:2px solid #97ADD9; - margin:0 24px 0 4px; - padding:0 12px 0 16px; -} - -td.tiny -{ - font-size:75%; -} - -.dirtab -{ - border:1px solid #9EB3DC; - border-collapse:collapse; - padding:4px; -} - -th.dirtab -{ - background:#EAEFF7; - font-weight:bold; -} - -hr -{ - border:none; - border-top:1px solid #4067B4; - height:0; -} - -hr.footer -{ - height:1px; -} - -table.memberdecls -{ - border-spacing:0; - padding:0; -} - -.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,.memTemplItemLeft,.memTemplItemRight,.memTemplParams -{ - background-color:#F9FAFC; - border:none; - margin:4px; - padding:1px 0 0 8px; -} - -.mdescLeft,.mdescRight -{ - color:#555; - padding:0 8px 4px; -} - -.memItemLeft,.memItemRight,.memTemplParams -{ - border-top:1px solid #C1CEE8; -} - -.memItemLeft,.memTemplItemLeft -{ - white-space:nowrap; -} - -.memItemRight -{ - width:100%; -} - -.memTemplParams -{ - color:#3D62AB; - white-space:nowrap; -} - -.memtemplate -{ - color:#3D62AB; - font-size:80%; - font-weight:normal; - margin-left:9px; -} - -.memnav -{ - background-color:#EAEFF7; - border:1px solid #9EB3DC; - margin:2px 15px 2px 2px; - padding:2px; - text-align:center; -} - -.mempage -{ - width:100%; -} - -.memitem -{ - margin-bottom:10px; - margin-right:5px; - padding:0; -} - -.memname -{ - font-weight:bold; - margin-left:6px; - white-space:nowrap; -} - -.memproto,dl.reflist dt -{ - -moz-border-radius-topleft:8px; - -moz-border-radius-topright:8px; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 5px 5px 5px; - -webkit-border-top-left-radius:8px; - -webkit-border-top-right-radius:8px; - -webkit-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - background-color:#E1E7F4; - background-image:url('nav_f.png'); - background-repeat:repeat-x; - border-left:1px solid #A3B7DE; - border-right:1px solid #A3B7DE; - border-top:1px solid #A3B7DE; - border-top-left-radius:8px; - border-top-right-radius:8px; - box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - color:#20335A; - font-weight:bold; - padding:6px 0; - text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); -} - -.memdoc,dl.reflist dd -{ - -moz-border-radius-bottomleft:8px; - -moz-border-radius-bottomright:8px; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 5px 5px 5px; - -webkit-border-bottom-left-radius:8px; - -webkit-border-bottom-right-radius:8px; - -webkit-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - background-color:#FBFCFD; - background-image:0 color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F6F8FC), to(#EDF1F8)); - border-bottom:1px solid #A3B7DE; - border-bottom-left-radius:8px; - border-bottom-right-radius:8px; - border-left:1px solid #A3B7DE; - border-right:1px solid #A3B7DE; - border-top-width:0; - box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15); - padding:2px 5px; -} - -dl.reflist dt -{ - padding:5px; -} - -dl.reflist dd -{ - margin:0 0 10px; - padding:5px; -} - -.paramkey -{ - text-align:right; -} - -.paramtype -{ - white-space:nowrap; -} - -.paramname -{ - color:#602020; - white-space:nowrap; -} - -.paramname em -{ - font-style:normal; -} - -.params,.retval,.exception,.tparams -{ - border-spacing:6px 2px; -} - -.params .paramname,.retval .paramname -{ - font-weight:bold; - vertical-align:top; -} - -.params .paramtype -{ - font-style:italic; - vertical-align:top; -} - -.params .paramdir -{ - font-family:"courier new",courier,monospace; - vertical-align:top; -} - -.ftvtree -{ - font-family:sans-serif; - margin:0; -} - -.directory -{ - font-size:9pt; - font-weight:bold; - margin:5px; -} - -.directory h3 -{ - font-size:11pt; - margin:1em 0 0; -} - -.directory > h3 -{ - margin-top:0; -} - -.directory p -{ - margin:0; - white-space:nowrap; -} - -.directory div -{ - display:none; - margin:0; -} - -.directory img -{ - vertical-align:-30%; -} - -.directory-alt -{ - font-size:100%; - font-weight:bold; -} - -.directory-alt h3 -{ - font-size:11pt; - margin:1em 0 0; -} - -.directory-alt > h3 -{ - margin-top:0; -} - -.directory-alt p -{ - margin:0; - white-space:nowrap; -} - -.directory-alt div -{ - display:none; - margin:0; -} - -.directory-alt img -{ - vertical-align:-30%; -} - -div.dynheader -{ - margin-top:8px; -} - -address -{ - color:#253B67; - font-style:normal; -} - -table.doxtable -{ - border-collapse:collapse; - margin-bottom:4px; - margin-top:4px; -} - -table.doxtable td,table.doxtable th -{ - border:1px solid #273F6D; - padding:3px 7px 2px; -} - -table.doxtable th -{ - background-color:#304D86; - color:#FFFFFF; - font-size:110%; - padding-bottom:4px; - padding-top:5px; -} - -table.fieldtable -{ - -moz-border-radius:4px; - -moz-box-shadow:rgba(0, 0, 0, 0.15) 2px 2px 2px; - -webkit-border-radius:4px; - -webkit-box-shadow:2px 2px 2px rgba(0, 0, 0, 0.15); - border:1px solid #A3B7DE; - border-radius:4px; - border-spacing:0; - box-shadow:2px 2px 2px rgba(0, 0, 0, 0.15); - margin-bottom:10px; - width:100%; -} - -.fieldtable td,.fieldtable th -{ - padding:3px 7px 2px; -} - -.fieldtable td.fieldtype,.fieldtable td.fieldname -{ - border-bottom:1px solid #A3B7DE; - border-right:1px solid #A3B7DE; - vertical-align:top; - white-space:nowrap; -} - -.fieldtable td.fielddoc -{ - border-bottom:1px solid #A3B7DE; - width:100%; -} - -.fieldtable tr:last-child td -{ - border-bottom:none; -} - -.fieldtable th -{ - -moz-border-radius-topleft:4px; - -moz-border-radius-topright:4px; - -webkit-border-top-left-radius:4px; - -webkit-border-top-right-radius:4px; - background-color:#E1E7F4; - background-image:url('nav_f.png'); - background-repeat:repeat-x; - border-bottom:1px solid #A3B7DE; - border-top-left-radius:4px; - border-top-right-radius:4px; - color:#20335A; - font-size:90%; - padding-bottom:4px; - padding-top:5px; - text-align:left; -} - -.tabsearch -{ - background-image:url('tab_b.png'); - font-size:13px; - height:36px; - left:10px; - overflow:hidden; - top:0; - z-index:101; -} - -.navpath ul -{ - background-image:url('tab_b.png'); - background-repeat:repeat-x; - border:solid 1px #BFCCE8; - color:#839ED2; - font-size:11px; - height:30px; - line-height:30px; - margin:0; - overflow:hidden; - padding:0; -} - -.navpath li -{ - background-image:url('bc_s.png'); - background-position:right; - background-repeat:no-repeat; - color:#2F4B83; - float:left; - list-style-type:none; - padding-left:10px; - padding-right:15px; -} - -.navpath li.navelem a -{ - display:block; - height:32px; - outline:none; - text-decoration:none; -} - -.navpath li.navelem a:hover -{ - color:#6081C5; -} - -.navpath li.footer -{ - background-image:none; - background-position:right; - background-repeat:no-repeat; - color:#2F4B83; - float:right; - font-size:8pt; - list-style-type:none; - padding-left:10px; - padding-right:15px; -} - -div.summary -{ - float:right; - font-size:8pt; - padding-right:5px; - text-align:right; - width:50%; -} - -div.summary a -{ - white-space:nowrap; -} - -div.ingroups -{ - font-size:8pt; - margin-left:5px; - padding-left:5px; - text-align:left; - width:50%; -} - -div.ingroups a -{ - white-space:nowrap; -} - -div.header -{ - background-color:#F9FAFC; - background-image:url('nav_h.png'); - background-repeat:repeat-x; - border-bottom:1px solid #C1CEE8; - margin:0; -} - -div.headertitle -{ - padding:5px 5px 5px 7px; -} - -dl -{ - padding:0 0 0 10px; -} - -dl.section -{ - border-left:4px solid; - padding:0 0 0 6px; -} - -dl.note -{ - border-color:#D0C000; -} - -dl.warning,dl.attention -{ - border-color:#FF0000; -} - -dl.pre,dl.post,dl.invariant -{ - border-color:#00D000; -} - -dl.deprecated -{ - border-color:#505050; -} - -dl.todo -{ - border-color:#00C0E0; -} - -dl.test -{ - border-color:#3030E0; -} - -dl.bug -{ - border-color:#C08050; -} - -dl.section dd -{ - margin-bottom:6px; -} - -#projectlogo -{ - border-collapse:separate; - text-align:center; - vertical-align:bottom; - padding-left: 20px; -} - -#projectlogo img -{ - border:0 none; -} - -#projectname -{ - font:280% Arial, sans-serif; - margin:0; - padding-left:20px; -} - -#projectbrief -{ - font:120% Tahoma, Arial, sans-serif; - margin:0; - padding:0; -} - -#projectnumber:before -{ - content:"Version "; -} - -#projectnumber -{ - font:50% Tahoma, Arial, sans-serif; - margin:0; - padding:0; -} - -#titlearea -{ - margin:0; - padding:0; - width:100%; - background-color:#E1E7F4; - background-image:url('nav_f.png'); - background-repeat:repeat-x; - color:#20335A; - font-weight:bold; - text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); -} - -.image -{ - text-align:center; -} - -.dotgraph -{ - text-align:center; -} - -.mscgraph -{ - text-align:center; -} - -.caption -{ - font-weight:bold; -} - -div.zoom -{ - border:1px solid #8AA3D4; -} - -dl.citelist -{ - margin-bottom:50px; -} - -dl.citelist dt -{ - color:#2C477C; - float:left; - font-weight:bold; - margin-right:10px; - padding:5px; -} - -dl.citelist dd -{ - margin:2px 0; - padding:5px 0; -} - -div.toc -{ - background-color:#F4F6FB; - border:1px solid #D6DFF0; - border-radius:7px 7px 7px 7px; - float:right; - height:auto; - margin:0 20px 10px 10px; - padding:14px 25px; - width:200px; -} - -div.toc li -{ - background:url("bdwn.png") no-repeat scroll 0 5px transparent; - font:10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; - margin-top:5px; - padding-left:10px; - padding-top:2px; -} - -div.toc h3 -{ - border-bottom:0 none; - color:#3D62AB; - font:bold 12px/1.2 Arial,FreeSans,sans-serif; - margin:0; -} - -div.toc ul -{ - border:medium none; - list-style:none outside none; - padding:0; -} - -div.toc li.level1 -{ - margin-left:0; -} - -div.toc li.level2 -{ - margin-left:15px; -} - -div.toc li.level3 -{ - margin-left:30px; -} - -div.toc li.level4 -{ - margin-left:45px; -} diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt deleted file mode 100644 index ae9c7d44b3..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt +++ /dev/null @@ -1,424 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_VIDPID VID and PID values - * - * \section Sec_VIDPID_Allocations VID and PID Allocations - * The LUFA library uses VID/PID combinations generously donated by Atmel. The following VID/PID combinations - * are used within the LUFA demos, and thus may be re-used by derivations of each demo. Free PID values may be - * used by future LUFA demo projects. - * - * These VID/PID values should not be used in commercial designs under any circumstances. Private projects - * may use the following values freely, but must accept any collisions due to other LUFA derived private projects - * sharing identical values. It is suggested that private projects using interfaces compatible with existing - * demos share the same VID/PID value. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
- * VID - * - * PID - * - * Usage - *
- * 0x03EB - * - * 0x2040 - * - * Test VID/PID (See below) - *
- * 0x03EB - * - * 0x2041 - * - * Mouse Demo Application - *
- * 0x03EB - * - * 0x2042 - * - * Keyboard Demo Application - *
- * 0x03EB - * - * 0x2043 - * - * Joystick Demo Application - *
- * 0x03EB - * - * 0x2044 - * - * CDC Demo Application - *
- * 0x03EB - * - * 0x2045 - * - * Mass Storage Demo Application - *
- * 0x03EB - * - * 0x2046 - * - * Audio Output Demo Application - *
- * 0x03EB - * - * 0x2047 - * - * Audio Input Demo Application - *
- * 0x03EB - * - * 0x2048 - * - * MIDI Demo Application - *
- * 0x03EB - * - * 0x2049 - * - * MagStripe Project - *
- * 0x03EB - * - * 0x204A - * - * CDC Bootloader - *
- * 0x03EB - * - * 0x204B - * - * USB to Serial Demo Application - *
- * 0x03EB - * - * 0x204C - * - * RNDIS Demo Application - *
- * 0x03EB - * - * 0x204D - * - * Combined Keyboard and Mouse Demo Application - *
- * 0x03EB - * - * 0x204E - * - * Dual CDC Demo Application - *
- * 0x03EB - * - * 0x204F - * - * Generic HID Demo Application - *
- * 0x03EB - * - * 0x2060 - * - * Benito Programmer Project - *
- * 0x03EB - * - * 0x2061 - * - * Combined Mass Storage and Keyboard Demo - *
- * 0x03EB - * - * 0x2062 - * - * Combined CDC and Mouse Demo - *
- * 0x03EB - * - * 0x2063 - * - * Mass Storage/HID Interface Datalogger Project - *
- * 0x03EB - * - * 0x2064 - * - * Interfaceless Control-Only LUFA Devices - *
- * 0x03EB - * - * 0x2065 - * - * Test and Measurement Demo - *
- * 0x03EB - * - * 0x2066 - * - * Multiple Report Keyboard/Mouse HID Demo - *
- * 0x03EB - * - * 0x2067 - * - * HID Class Bootloader - *
- * 0x03EB - * - * 0x2068 - * - * Virtual Serial/Mass Storage Demo - *
- * 0x03EB - * - * 0x2069 - * - * Webserver Project - *
- * 0x03EB - * - * 0x206A - * - * Media Control Project - *
- * 0x03EB - * - * 0x206B - * - * Currently Unallocated - *
- * 0x03EB - * - * 0x206C - * - * Currently Unallocated - *
- * 0x03EB - * - * 0x206D - * - * Currently Unallocated - *
- * 0x03EB - * - * 0x206E - * - * Currently Unallocated - *
- * 0x03EB - * - * 0x206F - * - * Currently Unallocated - *
- * - * \section Sec_Test_VIDPID The Test VID/PID Combination - * For use in testing of LUFA powered devices during development only, by non-commercial entities. - * All devices must accept collisions on this VID/PID range (from other in-development LUFA devices) - * to be resolved by using a unique release number in the Device Descriptor. No devices using this - * VID/PID combination may be released to the general public. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt b/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt deleted file mode 100644 index 1b33269071..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt +++ /dev/null @@ -1,27 +0,0 @@ -/** \file - * - * This file contains special DoxyGen information for the generation of the main page and other special - * documentation pages. It is not a project source file. - */ - -/** \page Page_WritingBoardDrivers Writing LUFA Board Drivers - * - * LUFA ships with several basic pre-made board drivers, to control hardware present on the supported board - * hardware - such as Dataflash ICs, LEDs, Joysticks, or other hardware peripherals. When compiling an application - * which makes use of one or more board drivers located in LUFA/Drivers/Board, you must also indicate what board - * hardware you are using in your project makefile. This is done by defining the BOARD macro using the -D switch - * passed to the compiler, with a constant of BOARD_{Name}. For example -DBOARD=BOARD_USBKEY instructs the - * compiler to use the USBKEY board hardware drivers. - * - * If your application does not use *any* board level drivers, you can omit the definition of the BOARD macro. - * However, some users may wish to write their own custom board hardware drivers which are to remain compatible - * with the LUFA hardware API. To do this, the BOARD macro should be defined to the value BOARD_USER. This indicates - * that the board level drivers should be located in a folder named "Board" located inside the application's folder. - * - * When used, the driver stub files located in the LUFA/CodeTemplates/DriverStubs folder should be copied to the user - * Board/ directory, and fleshed out to include the values and code needed to control the custom board hardware. Once - * done, the existing LUFA board level APIs (accessed in the regular LUFA/Drivers/Board/ folder) will redirect to the - * user board drivers, maintaining code compatibility and allowing for a different board to be selected through the - * project makefile with no code changes. - */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h deleted file mode 100644 index c18054f823..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Adafruit U4 Breakout board. - * \copydetails Group_LEDs_ADAFRUITU4 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_ADAFRUITU4 ADAFRUITU4 - * \brief Board specific LED driver header for the Adafruit U4 Breakout board. - * - * Board specific LED driver header for the Adafruit U4 Breakout board (http://ladyada.net/products/atmega32u4breakout). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTE.6
- * - * @{ - */ - -#ifndef __LEDS_ADAFRUITU4_H__ -#define __LEDS_ADAFRUITU4_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for the none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRE |= LEDS_ALL_LEDS; - PORTE &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRE &= ~LEDS_ALL_LEDS; - PORTE &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTE |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTE &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTE = ((PORTE & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTE = ((PORTE & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINE = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTE & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h deleted file mode 100644 index 3470890b6a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel ATAVRUSBRF01. - * \copydetails Group_Buttons_ATAVRUSBRF01 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_ATAVRUSBRF01 ATAVRUSBRF01 - * \brief Board specific Buttons driver header for the Atmel ATAVRUSBRF01. - * - * Board specific Buttons driver header for the Atmel ATAVRUSBRF01. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_ATAVRUSBRF01_H__ -#define __BUTTONS_ATAVRUSBRF01_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h deleted file mode 100644 index 17b427155c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel ATAVRUSBRF01. - * \copydetails Group_LEDs_ATAVRUSBRF01 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_ATAVRUSBRF01 ATAVRUSBRF01 - * \brief Board specific LED driver header for the Atmel ATAVRUSBRF01. - * - * Board specific LED driver header for the Atmel ATAVRUSBRF01. - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenRX LEDHighPORTD.0
LEDS_LED2RedTX LEDHighPORTD.1
- * - * @{ - */ - -#ifndef __LEDS_ATAVRUSBRF01_H__ -#define __LEDS_ATAVRUSBRF01_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 0) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 1) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= (LEDMask & LEDS_ALL_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~(LEDMask & LEDS_ALL_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = (PORTD & ~LEDS_ALL_LEDS) | (LEDMask & LEDS_ALL_LEDS); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h deleted file mode 100644 index cecaca07ef..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Tempusdictum Benito. - * \copydetails Group_Buttons_BENITO - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_BENITO BENITO - * \brief Board specific Buttons driver header for the Tempusdictum Benito. - * - * Board specific Buttons driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_BENITO_H__ -#define __BUTTONS_BENITO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h deleted file mode 100644 index dc3d85df20..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Tempusdictum Benito. - * \copydetails Group_LEDs_BENITO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_BENITO BENITO - * \brief Board specific LED driver header for the Tempusdictum Benito. - * - * Board specific LED driver header for the Tempusdictum Benito (http://dorkbotpdx.org/wiki/benito). - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenTX LEDLowPORTC.7
LEDS_LED2RedRX LEDLowPORTC.6
- * - * @{ - */ - -#ifndef __LEDS_BENITO_H__ -#define __LEDS_BENITO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 7) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRC |= LEDS_ALL_LEDS; - PORTC |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRC &= ~LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTC &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTC |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTC = ((PORTC | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTC = ((PORTC | LEDMask) & ~ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINC = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTC & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h deleted file mode 100644 index d003680da5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Bitwizard Big-Multio. - * \copydetails Group_LEDs_BIGMULTIO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_BIGMULTIO BIGMULTIO - * \brief Board specific LED driver header for the Bitwizard Big-Multio. - * - * Board specific LED driver header for the Bitwizard Big-Multio (http://www.bitwizard.nl/wiki/index.php/Usbbigmultio). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1UnknownLED0HighPORTF.6
LEDS_LED2UnknownLED1HighPORTF.7
LEDS_LED3UnknownLED2HighPORTE.2
- * - * @{ - */ - -#ifndef __LEDS_BIGMULTIO_H__ -#define __LEDS_BIGMULTIO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTF_LEDS (LEDS_LED1 | LEDS_LED2) - #define LEDS_PORTE_LEDS LEDS_LED3 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 7) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED3 (1 << 2) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRF |= LEDS_PORTF_LEDS; - DDRE |= LEDS_PORTE_LEDS; - - PORTF &= ~LEDS_PORTF_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRF &= ~LEDS_PORTF_LEDS; - DDRE &= ~LEDS_PORTE_LEDS; - - PORTF &= ~LEDS_PORTF_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTF |= (LEDMask & LEDS_PORTF_LEDS); - PORTE |= (LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTF &= ~(LEDMask & LEDS_PORTF_LEDS); - PORTE &= ~(LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTF = (PORTF & ~LEDS_PORTF_LEDS) | (LEDMask & LEDS_PORTF_LEDS); - PORTE = (PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTF = (PORTF & ~(LEDMask & LEDS_PORTF_LEDS)) | (ActiveMask & LEDS_PORTF_LEDS); - PORTE = (PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINF = (LEDMask & LEDS_PORTF_LEDS); - PINE = (LEDMask & LEDS_PORTE_LEDS); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTF & LEDS_PORTF_LEDS) | (PORTE & LEDS_PORTE_LEDS)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h deleted file mode 100644 index 778bc321e1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the BLACKCAT USB JTAG. - * \copydetails Group_LEDs_BLACKCAT - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_BLACKCAT BLACKCAT - * \brief Board specific LED driver header for the BLACKCAT USB JTAG. - * - * Board specific LED driver header for the TCNISO Blackcat USB JTAG (http://www.embeddedcomputers.net/products/BlackcatUSB). - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1UnknownLED0HighPORTD.6
LEDS_LED2UnknownLED1HighPORTD.3
- * - * @{ - */ - -#ifndef __LEDS_BLACKCAT_H__ -#define __LEDS_BLACKCAT_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 3) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h deleted file mode 100644 index cc0c01c8ba..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Busware BUI. - * \copydetails Group_LEDs_BUI - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_BUI BUI - * \brief Board specific LED driver header for the Busware BUI. - * - * Board specific LED driver header for the Busware BUI (http://www.busware.de/tiki-index.php?page=BUI). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1RedRGB LEDHighPORTC.2
LEDS_LED2GreenRGB LEDHighPORTC.3
LEDS_LED3BlueRGB LEDHighPORTC.4
- * - * @{ - */ - -#ifndef __LEDS_BUI_H__ -#define __LEDS_BUI_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - -/* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 2) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 3) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRC |= LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRC &= ~LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTC |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTC &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTC = (PORTC & ~LEDS_ALL_LEDS) | LEDMask; - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTC = (PORTC & ~LEDMask) | ActiveMask; - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINC = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTC & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h deleted file mode 100644 index 96d1eee6dc..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Fletchtronics BUMBLEB. - * \copydetails Group_Buttons_BUMBLEB - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_BUMBLEB BUMBLEB - * \brief Board specific Buttons driver header for the Fletchtronics BUMBLEB. - * - * Board specific buttons driver header for the Fletchtronics BUMBLEB (http://fletchtronics.net/bumble-b). The BUMBLEB - * third-party board does not include any on-board peripherals, but does have an officially recommended external peripheral - * layout for buttons, LEDs and a Joystick. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_BUMBLEB_H__ -#define __BUTTONS_BUMBLEB_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h deleted file mode 100644 index 92c7a2e72f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Fletchtronics BUMBLEB. - * \copydetails Group_Joystick_BUMBLEB - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_BUMBLEB BUMBLEB - * \brief Board specific joystick driver header for the Fletchtronics BUMBLEB. - * - * Board specific joystick driver header for the Fletchtronics BUMBLEB (http://fletchtronics.net/bumble-b). The BUMBLEB - * third-party board does not include any on-board peripherals, but does have an officially recommended external peripheral - * layout for buttons, LEDs and a Joystick. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
PORTD.2PORTD.3PORTD.0PORTD.1PORTD.4
- * - * @{ - */ - -#ifndef __JOYSTICK_BUMBLEB_H__ -#define __JOYSTICK_BUMBLEB_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_MASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4)) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1 << 2) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1 << 3) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT (1 << 0) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN (1 << 1) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1 << 4) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - DDRD &= ~JOY_MASK; - PORTD |= JOY_MASK; - } - - static inline void Joystick_Disable(void) - { - DDRD &= ~JOY_MASK; - PORTD &= ~JOY_MASK; - } - - static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Joystick_GetStatus(void) - { - return (uint8_t)(~PIND & JOY_MASK); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h deleted file mode 100644 index dff0697858..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Fletchtronics BUMBLEB. - * \copydetails Group_LEDs_BUMBLEB - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_BUMBLEB BUMBLEB - * \brief Board specific LED driver header for the Fletchtronics BUMBLEB. - * - * Board specific LED driver header for the Fletchtronics BUMBLEB (http://fletchtronics.net/bumble-b). The BUMBLEB - * third-party board does not include any on-board peripherals, but does have an officially recommended external - * peripheral layout for buttons, LEDs and a Joystick. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1N/AUser SuppliedHighPORTB.4
LEDS_LED2N/AUser SuppliedHighPORTB.5
LEDS_LED3N/AUser SuppliedHighPORTB.6
LEDS_LED4N/AUser SuppliedHighPORTB.7
- * - * @{ - */ - -#ifndef __LEDS_BUMBLEB_H__ -#define __LEDS_BUMBLEB_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 6) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) - { - PORTB |= LedMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LedMask) - { - PORTB &= ~LedMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LedMask) - { - PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LedMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB & ~LedMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTB & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h deleted file mode 100644 index 6f6933b0d8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Busware CULV3. - * \copydetails Group_LEDs_CULV3 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_CULV3 CULV3 - * \brief Board specific Buttons driver header for the Busware CULV3. - * - * Board specific Buttons driver header for the Busware CUL V3 (http://busware.de/tiki-index.php?page=CUL). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_CULV3_H__ -#define __BUTTONS_CULV3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h deleted file mode 100644 index 86700d1471..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Busware CUL V3. - * \copydetails Group_LEDs_CULV3 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_CULV3 CULV3 - * \brief Board specific LED driver header for the Busware CUL V3. - * - * Board specific LED driver header for the Busware CUL V3 (http://busware.de/tiki-index.php?page=CUL). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowGeneral IndicatorHighPORTE.6
- * - * @{ - */ - -#ifndef __LEDS_CULV3_H__ -#define __LEDS_CULV3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for the none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRE |= LEDS_ALL_LEDS; - PORTE &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRE &= ~LEDS_ALL_LEDS; - PORTE &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTE |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTE &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTE = ((PORTE & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTE = ((PORTE & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINE = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTE & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h deleted file mode 100644 index 0d31b481c4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the DorkbotPDX Duce. - * \copydetails Group_LEDs_DUCE - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_DUCE DUCE - * \brief Board specific LED driver header for the DorkbotPDX Duce. - * - * Board specific LED driver header for the DorkbotPDX Duce (http://dorkbotpdx.org/wiki/duce). - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1RedBicolor Indicator 1HighPORTC.4
LEDS_LED2GreenBicolor Indicator 1HighPORTC.5
LEDS_LED3RedBicolor Indicator 2HighPORTC.6
LEDS_LED4GreenBicolor Indicator 2HighPORTC.7
- * - * @{ - */ - -#ifndef __LEDS_DUCE_H__ -#define __LEDS_DUCE_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 6) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRC |= LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRC &= ~LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTC |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTC &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTC = ((PORTC & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINC = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTC & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h deleted file mode 100644 index 82cb204eb6..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel EVK527. - * \copydetails Group_Buttons_EVK527 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_EVK527 EVK527 - * \brief Board specific Buttons driver header for the Atmel EVK527. - * - * Board specific Buttons driver header for the Atmel EVK527. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_EVK527_H__ -#define __BUTTONS_EVK527_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h deleted file mode 100644 index 53af741860..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the Atmel EVK527. - * \copydetails Group_Dataflash_EVK527 - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_EVK527 EVK527 - * \brief Board specific Dataflash driver header for the Atmel EVK527. - * - * Board specific Dataflash driver header for the Atmel EVK527. - * - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB321C (4MB)PORTE.6SPI0
- * - * @{ - */ - -#ifndef __DATAFLASH_EVK527_H__ -#define __DATAFLASH_EVK527_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../../../Misc/AT45DB321C.h" - #include "../../../Peripheral/SPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK (1 << 6) - #define DATAFLASH_CHIPCS_DDR DDRE - #define DATAFLASH_CHIPCS_PORT PORTE - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 0 - - /** Internal main memory page size for the board's dataflash IC. */ - #define DATAFLASH_PAGE_SIZE 512 - - /** Total number of pages inside the board's dataflash IC. */ - #define DATAFLASH_PAGES 8192 - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SPI_TransferByte(Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SPI_SendByte(Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SPI_ReceiveByte(); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= DATAFLASH_PAGES) - return; - - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h deleted file mode 100644 index 266b14907f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Atmel EVK527. - * \copydetails Group_Joystick_EVK527 - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_EVK527 EVK527 - * \brief Board specific joystick driver header for the Atmel EVK527. - * - * Board specific joystick driver header for the Atmel EVK527. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
PORTF.4PORTF.5PORTF.7PORTC.6PORTF.6
- * - * @{ - */ - -#ifndef __JOYSTICK_EVK527_H__ -#define __JOYSTICK_EVK527_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_FMASK ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)) - #define JOY_CMASK (1 << 6) - - #define JOY_PORTC_MASK_SHIFT 3 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1 << 4) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT (1 << 7) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1 << 5) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN ((1 << 6) >> JOY_PORTC_MASK_SHIFT) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1 << 6) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - DDRF &= ~JOY_FMASK; - DDRC &= ~JOY_CMASK; - - PORTF |= JOY_FMASK; - PORTC |= JOY_CMASK; - } - - static inline void Joystick_Disable(void) - { - DDRF &= ~JOY_FMASK; - DDRC &= ~JOY_CMASK; - - PORTF &= ~JOY_FMASK; - PORTC &= ~JOY_CMASK; - } - - static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Joystick_GetStatus(void) - { - return (((uint8_t)~PINF & JOY_FMASK) | (((uint8_t)~PINC & JOY_CMASK) >> JOY_PORTC_MASK_SHIFT)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h deleted file mode 100644 index 58483a9ba5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel EVK527. - * \copydetails Group_LEDs_EVK527 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_EVK527 EVK527 - * \brief Board specific LED driver header for the Atmel EVK527. - * - * Board specific LED driver header for the Atmel EVK527. - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.5
LEDS_LED2GreenGeneral IndicatorHighPORTD.6
LEDS_LED3GreenGeneral IndicatorHighPORTD.7
- * - * @{ - */ - -#ifndef __LEDS_EVK527_H__ -#define __LEDS_EVK527_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 5) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 6) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h deleted file mode 100644 index 67783ca2bd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Mattairtech JM-DB-U2. - * \copydetails Group_Buttons_JMDBU2 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_JMDBU2 JMDBU2 - * \brief Board specific Buttons driver header for the Mattairtech JM-DB-U2. - * - * Board specific Buttons driver header for the Mattairtech JM-DB-U2 (http://u2.mattair.net/index.html). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_JMDBU2_H__ -#define __BUTTONS_JMDBU2_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h deleted file mode 100644 index d64cdad6d9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Mattairtech JM-DB-U2. - * \copydetails Group_LEDs_JMDBU2 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_JMDBU2 JMDBU2 - * \brief Board specific LED driver header for the Mattairtech JM-DB-U2. - * - * Board specific LED driver header for the Mattairtech JM-DB-U2 (http://u2.mattair.net/index.html). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.4
- * - * @{ - */ - -#ifndef __LEDS_JMDBU2_H__ -#define __LEDS_JMDBU2_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h deleted file mode 100644 index 932bfa14a1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Maximus. - * \copydetails Group_LEDs_MAXIMUS - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MAXIMUS MAXIMUS - * \brief Board specific LED driver header for the Maximus. - * - * Board specific LED driver header for the Maximus (http://www.avrusb.com/). - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenLGHighPORTB.6
LEDS_LED2RedLRHighPORTB.7
- * - * @{ - */ - -#ifndef __LEDS_MAXIMUS_H__ -#define __LEDS_MAXIMUS_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) - - /** LED mask for the none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTB & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h deleted file mode 100644 index 36a7bebe9a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Micropendous series boards. - * \copydetails Group_Buttons_MICROPENDOUS_32U2 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_A MICROPENDOUS_A - * \brief Board specific Button driver header for the Micropendous A (https://code.google.com/p/micropendous/wiki/MicropendousA). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_1 MICROPENDOUS_1 - * \brief Board specific Button driver header for the Micropendous 1 (https://code.google.com/p/micropendous/wiki/Micropendous1). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_2 MICROPENDOUS_2 - * \brief Board specific Button driver header for the Micropendous 2 (https://code.google.com/p/micropendous/wiki/Micropendous2). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_3 MICROPENDOUS_3 - * \brief Board specific Button driver header for the Micropendous 3 (https://code.google.com/p/micropendous/wiki/Micropendous3). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_4 MICROPENDOUS_4 - * \brief Board specific Button driver header for the Micropendous 4 (https://code.google.com/p/micropendous/wiki/Micropendous4). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_DIP MICROPENDOUS_DIP - * \brief Board specific Button driver header for the Micropendous DIP (https://code.google.com/p/micropendous/wiki/MicropendousDIP). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_REV1 MICROPENDOUS_REV1 - * \brief Board specific Button driver header for the Micropendous Arduino-like Revision 1 (https://code.google.com/p/micropendous/wiki/Micropendous). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_REV2 MICROPENDOUS_REV2 - * \brief Board specific Button driver header for the Micropendous Arduino-like Revision 2 (https://code.google.com/p/micropendous/wiki/Micropendous). - * - * See \ref Group_Buttons_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROPENDOUS_32U2 MICROPENDOUS_32U2 - * \brief Board specific Buttons driver header for the Micropendous 32U2. - * - * \note There are multiple supported Micropendous boards, compile with BOARD = MICROPENDOUS_{VERSION}. - * - * Board specific Buttons driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2). - * - * BOARD_MICROPENDOUS_1 and BOARD_MICROPENDOUS_32U2: - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * Other Revisions: - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_MICROPENDOUS_H__ -#define __BUTTONS_MICROPENDOUS_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - #if (BOARD == BOARD_MICROPENDOUS_32U2) - #define _BOARD_BUTTON1_MASK (1 << 7) - #define _BOARD_BUTTON_PORTLETTER D - #elif (BOARD == BOARD_MICROPENDOUS_A) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_1) - #define _BOARD_BUTTON1_MASK (1 << 7) - #define _BOARD_BUTTON_PORTLETTER D - #elif (BOARD == BOARD_MICROPENDOUS_2) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_3) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_4) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_DIP) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_REV1) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #elif (BOARD == BOARD_MICROPENDOUS_REV2) - #define _BOARD_BUTTON1_MASK (1 << 2) - #define _BOARD_BUTTON_PORTLETTER E - #endif - - #define _BOARD_BUTTON_CONCAT2(Reg, Letter) Reg ## Letter - #define _BOARD_BUTTON_CONCAT(Reg, Letter) _BOARD_BUTTON_CONCAT2(Reg, Letter) - - #define _BOARD_BUTTON_PORT _BOARD_BUTTON_CONCAT(PORT, _BOARD_BUTTON_PORTLETTER) - #define _BOARD_BUTTON_PIN _BOARD_BUTTON_CONCAT(PIN, _BOARD_BUTTON_PORTLETTER) - #define _BOARD_BUTTON_DDR _BOARD_BUTTON_CONCAT(DDR, _BOARD_BUTTON_PORTLETTER) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 _BOARD_BUTTON1_MASK - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - _BOARD_BUTTON_DDR &= ~BUTTONS_BUTTON1; - _BOARD_BUTTON_PORT |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - _BOARD_BUTTON_DDR &= ~BUTTONS_BUTTON1; - _BOARD_BUTTON_PORT &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((_BOARD_BUTTON_PIN & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h deleted file mode 100644 index eeb337711f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Micropendous-32U2. - * \copydetails Group_LEDs_MICROPENDOUS_32U2 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MICROPENDOUS_REV1 MICROPENDOUS_REV1 - * \brief Board specific LED driver header for the Micropendous Arduino-like Revision 1 (https://code.google.com/p/micropendous/wiki/Micropendous). - * - * See \ref Group_LEDs_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MICROPENDOUS_REV2 MICROPENDOUS_REV2 - * \brief Board specific LED driver header for the Micropendous Arduino-like Revision 2 (https://code.google.com/p/micropendous/wiki/Micropendous). - * - * See \ref Group_LEDs_MICROPENDOUS_32U2 for more details. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MICROPENDOUS_32U2 MICROPENDOUS_32U2 - * \brief Board specific LED driver header for the Micropendous-32U2. - * - * Board specific LED driver header for the Micropendous 32U2 (https://code.google.com/p/micropendous/wiki/Micropendous_32U2). - * - * BOARD_MICROPENDOUS_32U2: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.6
- * - * Other Revisions: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTB.1
- * - * @{ - */ - -#ifndef __LEDS_MICROPENDOUS_H__ -#define __LEDS_MICROPENDOUS_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - #if (BOARD == BOARD_MICROPENDOUS_32U2) - #define _BOARD_LED1_MASK (1 << 6) - #define _BOARD_LED_PORTLETTER D - #elif (BOARD == BOARD_MICROPENDOUS_REV1) - #define _BOARD_LED1_MASK (1 << 1) - #define _BOARD_LED_PORTLETTER B - #elif (BOARD == BOARD_MICROPENDOUS_REV2) - #define _BOARD_LED1_MASK (1 << 1) - #define _BOARD_LED_PORTLETTER B - #endif - - #define _BOARD_LED_CONCAT2(Reg, Letter) Reg ## Letter - #define _BOARD_LED_CONCAT(Reg, Letter) _BOARD_LED_CONCAT2(Reg, Letter) - - #define _BOARD_LED_PORT _BOARD_LED_CONCAT(PORT, _BOARD_LED_PORTLETTER) - #define _BOARD_LED_PIN _BOARD_LED_CONCAT(PIN, _BOARD_LED_PORTLETTER) - #define _BOARD_LED_DDR _BOARD_LED_CONCAT(DDR, _BOARD_LED_PORTLETTER) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 _BOARD_LED1_MASK - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for the none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - _BOARD_LED_DDR |= LEDS_ALL_LEDS; - _BOARD_LED_PORT &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - _BOARD_LED_DDR &= ~LEDS_ALL_LEDS; - _BOARD_LED_PORT &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - _BOARD_LED_PORT |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - _BOARD_LED_PORT &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - _BOARD_LED_PORT = ((_BOARD_LED_PORT & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - _BOARD_LED_PORT = ((_BOARD_LED_PORT & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - _BOARD_LED_PIN = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (_BOARD_LED_PORT & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h deleted file mode 100644 index 01366a71a5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Microsin AVR-USB162 board. - * \copydetails Group_Buttons_MICROSIN162 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MICROSIN162 MICROSIN162 - * \brief Board specific Buttons driver header for the Microsin AVR-USB162 board. - * - * Board specific Buttons driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_MICROSIN162_H__ -#define __BUTTONS_MICROSIN162_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h deleted file mode 100644 index 3507036439..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Microsin AVR-USB162 board. - * \copydetails Group_LEDs_MICROSIN162 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MICROSIN162 MICROSIN162 - * \brief Board specific LED driver header for the Microsin AVR-USB162 board. - * - * Board specific LED driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorLowPORTD.4
- * - * @{ - */ - -#ifndef __LEDS_MICROSIN162_H__ -#define __LEDS_MICROSIN162_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD | LEDMask) & ~ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (~PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h deleted file mode 100644 index 3f1b592d3f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the MINIMUS. - * \copydetails Group_Buttons_MINIMUS - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_MINIMUS MINIMUS - * \brief Board specific Buttons driver header for the MINIMUS. - * - * Board specific Buttons driver header for the MINIMUS. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_MINIMUS_H__ -#define __BUTTONS_MINIMUS_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h deleted file mode 100644 index 4889722bdc..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the MINIMUS. - * \copydetails Group_LEDs_MINIMUS - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MINIMUS MINIMUS - * \brief Board specific LED driver header for the MINIMUS. - * - * Board specific LED driver header for the Minimus USB (http://www.minimususb.com/). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1RedGeneral IndicatorLowPORTD.5
LEDS_LED2GreenGeneral IndicatorLowPORTD.6
LEDS_LED3BlueGeneral IndicatorLowPORTD.7
- * - * @{ - */ - -#ifndef __LEDS_MINIMUS_H__ -#define __LEDS_MINIMUS_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 5) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 6) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for the none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h deleted file mode 100644 index 9da569271e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Bitwizard Multio. - * \copydetails Group_LEDs_MULTIO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_MULTIO MULTIO - * \brief Board specific LED driver header for the Bitwizard Multio. - * - * Board specific LED driver header for the Bitwizard Multio (http://www.bitwizard.nl/wiki/index.php/USB-multio). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.0
LEDS_LED2GreenGeneral IndicatorHighPORTC.2
LEDS_LED3GreenGeneral IndicatorHighPORTD.7
- * - * @{ - */ - -#ifndef __LEDS_MULTIO_H__ -#define __LEDS_MULTIO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED3) - #define LEDS_PORTC_LEDS LEDS_LED2 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 0) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 2) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_PORTD_LEDS; - DDRC |= LEDS_PORTC_LEDS; - - PORTD &= ~LEDS_PORTD_LEDS; - PORTC &= ~LEDS_PORTC_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_PORTD_LEDS; - DDRC &= ~LEDS_PORTC_LEDS; - - PORTD &= ~LEDS_PORTD_LEDS; - PORTC &= ~LEDS_PORTC_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= (LEDMask & LEDS_PORTD_LEDS); - PORTC |= (LEDMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~(LEDMask & LEDS_PORTD_LEDS); - PORTC &= ~(LEDMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = (PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS); - PORTC = (PORTC & ~LEDS_PORTC_LEDS) | (LEDMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = (PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS); - PORTC = (PORTC & ~(LEDMask & LEDS_PORTC_LEDS)) | (ActiveMask & LEDS_PORTC_LEDS); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = (LEDMask & LEDS_PORTD_LEDS); - PINC = (LEDMask & LEDS_PORTC_LEDS); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTD & LEDS_PORTD_LEDS) | (PORTC & LEDS_PORTC_LEDS)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h deleted file mode 100644 index 9f02729cc6..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Olimex AVR-USB-162 Development Board. - * \copydetails Group_Buttons_OLIMEX162 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_OLIMEX162 OLIMEX162 - * \brief Board specific Buttons driver header for the Olimex AVR-USB-162 Development Board. - * - * Board specific Buttons driver header for the Olimex AVR-USB-162 Development Board (http://www.olimex.com/dev/avr-usb-162.html). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_OLIMEX162_H__ -#define __BUTTONS_OLIMEX162_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h deleted file mode 100644 index 0e35eae4ab..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Olimex AVR-USB-162. - * \copydetails Group_LEDs_OLIMEX162 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_OLIMEX162 OLIMEX162 - * \brief Board specific LED driver header for the Olimex AVR-USB-162. - * - * Board specific LED driver header for the Olimex AVR-USB-162 (http://www.olimex.com/dev/avr-usb-162.html). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowGeneral IndicatorHighPORTD.4
- * - * @{ - */ - -#ifndef __LEDS_OLIMEX162_H__ -#define __LEDS_OLIMEX162_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h deleted file mode 100644 index 4ae89acee2..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board. - * \copydetails Group_Buttons_OLIMEX32U4 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_OLIMEX32U4 OLIMEX32U4 - * \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board. - * - * Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board (http://www.olimex.com/dev/olimexino-32u4.html). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_OLIMEX32U4_H__ -#define __BUTTONS_OLIMEX32U4_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h deleted file mode 100644 index 38dde2c740..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Olimex AVR-USB-32U4. - * \copydetails Group_LEDs_OLIMEX32U4 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_OLIMEX32U4 OLIMEX32U4 - * \brief Board specific LED driver header for the Olimex AVR-USB-32U4. - * - * Board specific LED driver header for the Olimex AVR-USB-32U4 (http://www.olimex.com/dev/olimexino-32u4.html). - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenTXHighPORTD.5
LEDS_LED2YellowRXHighPORTB.0
LEDS_LED3GreenGeneral Indicator (Default Unconnected)HighPORTE.6
LEDS_LED4YellowGeneral Indicator (Default Unconnected)HighPORTB.5
- * - * @{ - */ - -#ifndef __LEDS_OLIMEX32U4_H__ -#define __LEDS_OLIMEX32U4_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTB_LEDS (LEDS_LED2 | LEDS_LED4) - #define LEDS_PORTD_LEDS (LEDS_LED1) - #define LEDS_PORTE_LEDS (LEDS_LED3) - - #define LEDS_PORTD_MASK_SHIFT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 ((1 << 5) >> LEDS_PORTD_MASK_SHIFT) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 0) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 5) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_PORTB_LEDS; - PORTB &= ~LEDS_PORTB_LEDS; - DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); - PORTD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); - DDRE |= LEDS_PORTE_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_PORTB_LEDS; - PORTB &= ~LEDS_PORTB_LEDS; - DDRD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); - PORTD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); - DDRE &= ~LEDS_PORTE_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB |= (LEDMask & LEDS_PORTB_LEDS); - PORTD |= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - PORTE |= (LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB &= ~(LEDMask & LEDS_PORTB_LEDS); - PORTD &= ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - PORTE &= ~(LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS)); - PORTD = ((PORTD & ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) | - ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)); - PORTE = ((PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS)); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS)); - PORTD = ((PORTD & ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)) | - ((ActiveMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)); - PORTE = ((PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS)); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = (LEDMask & LEDS_PORTB_LEDS); - PIND = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - PINE = (LEDMask & LEDS_PORTE_LEDS); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTB & LEDS_PORTB_LEDS) | - ((PORTD & (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) >> LEDS_PORTD_MASK_SHIFT) | - (PORTE & LEDS_PORTE_LEDS)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h deleted file mode 100644 index 70b2467bbc..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Olimex AVR-ISP-MK2 Development Board. - * \copydetails Group_Buttons_OLIMEXISPMK2 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_OLIMEXISPMK2 OLIMEXISPMK2 - * \brief Board specific Buttons driver header for the Olimex AVR-ISP-MK2. - * - * Board specific Buttons driver header for the Olimex AVR-ISP-MK2 Development Board (https://www.olimex.com/dev/avr-isp-mk2.html). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_OLIMEXISPMK2_H__ -#define __BUTTONS_OLIMEXISPMK2_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h deleted file mode 100644 index a1b8825dad..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Olimex AVR-ISP-MK2 Development Board. - * \copydetails Group_LEDs_OLIMEXISPMK2 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_OLIMEXISPMK2 OLIMEXISPMK2 - * \brief Board specific LED driver header for the Olimex AVR-ISP-MK2. - * - * Board specific LED driver header for the Olimex AVR-ISP-MK2 Development Board (https://www.olimex.com/dev/avr-isp-mk2.html). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowTarget PowerHighPORTB.5
LEDS_LED2RedActivityHighPORTB.6
LEDS_LED3GreenReadyHighPORTB.7
- * - * @{ - */ - -#ifndef __LEDS_OLIMEXISPMK2_H__ -#define __LEDS_OLIMEXISPMK2_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 5) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 6) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTB & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h deleted file mode 100644 index c779c55785..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Olimex AVR-USB-T32U4 Development Board. - * \copydetails Group_Buttons_OLIMEXT32U4 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_OLIMEXT32U4 OLIMEXT32U4 - * \brief Board specific Buttons driver header for the Olimex AVR-USB-32U4 Development Board. - * - * Board specific Buttons driver header for the Olimex AVR-USB-T32U4 Development Board (http://www.olimex.com/dev/avr-t32u4.html). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_OLIMEXT32U4_H__ -#define __BUTTONS_OLIMEXT32U4_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h deleted file mode 100644 index b3e4c701d1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Olimex AVR-USB-T32U4. - * \copydetails Group_LEDs_OLIMEXT32U4 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_OLIMEXT32U4 OLIMEXT32U4 - * \brief Board specific LED driver header for the Olimex AVR-USB-T32U4. - * - * Board specific LED driver header for the Olimex AVR-USB-T32U4 (http://www.olimex.com/dev/avr-t32u4.html). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenTXHighPORTD.5
LEDS_LED2YellowRXHighPORTB.0
LEDS_LED3N/AGeneral Indicator (Not Mounted)HighPORTE.6
- * - * @{ - */ - -#ifndef __LEDS_OLIMEXT32U4_H__ -#define __LEDS_OLIMEXT32U4_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTB_LEDS (LEDS_LED2) - #define LEDS_PORTD_LEDS (LEDS_LED1) - #define LEDS_PORTE_LEDS (LEDS_LED3) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 5) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 0) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_PORTB_LEDS; - PORTB &= ~LEDS_PORTB_LEDS; - DDRD |= LEDS_PORTD_LEDS; - PORTD &= ~LEDS_PORTD_LEDS; - DDRE |= LEDS_PORTE_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_PORTB_LEDS; - PORTB &= ~LEDS_PORTB_LEDS; - DDRD &= ~LEDS_PORTD_LEDS; - PORTD &= ~LEDS_PORTD_LEDS; - DDRE &= ~LEDS_PORTE_LEDS; - PORTE &= ~LEDS_PORTE_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB |= (LEDMask & LEDS_PORTB_LEDS); - PORTD |= (LEDMask & LEDS_PORTD_LEDS); - PORTE |= (LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB &= ~(LEDMask & LEDS_PORTB_LEDS); - PORTD &= ~(LEDMask & LEDS_PORTD_LEDS); - PORTE &= ~(LEDMask & LEDS_PORTE_LEDS); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS)); - PORTD = ((PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS)); - PORTE = ((PORTE & ~LEDS_PORTE_LEDS) | (LEDMask & LEDS_PORTE_LEDS)); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS)); - PORTD = ((PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS)); - PORTE = ((PORTE & ~(LEDMask & LEDS_PORTE_LEDS)) | (ActiveMask & LEDS_PORTE_LEDS)); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = (LEDMask & LEDS_PORTB_LEDS); - PIND = (LEDMask & LEDS_PORTD_LEDS); - PINE = (LEDMask & LEDS_PORTE_LEDS); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTB & LEDS_PORTB_LEDS) | (PORTD & LEDS_PORTD_LEDS) | (PORTE & LEDS_PORTE_LEDS)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h deleted file mode 100644 index a440b6f000..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel RZUSBSTICK. - * \copydetails Group_LEDs_RZUSBSTICK - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_RZUSBSTICK RZUSBSTICK - * \brief Board specific LED driver header for the Atmel RZUSBSTICK. - * - * Board specific LED driver header for the Atmel RZUSBSTICK. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1BlueGeneral IndicatorHighPORTD.7
LEDS_LED1RedGeneral IndicatorLowPORTD.5
LEDS_LED1GreenGeneral IndicatorLowPORTE.6
LEDS_LED1YellowGeneral IndicatorLowPORTE.7
- * - * @{ - */ - -#ifndef __LEDS_RZUSBSTICK_H__ -#define __LEDS_RZUSBSTICK_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED2) - #define LEDS_PORTE_LEDS (LEDS_LED3 | LEDS_LED4) - - #define LEDS_PORTE_MASK_SHIFT 4 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 7) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 ((1 << 6) >> LEDS_PORTE_MASK_SHIFT) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 ((1 << 7) >> LEDS_PORTE_MASK_SHIFT) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_PORTD_LEDS; - PORTD &= ~LEDS_LED1; - PORTD |= LEDS_LED2; - - DDRE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - PORTE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_PORTD_LEDS; - PORTD &= ~LEDS_PORTD_LEDS; - - DDRE &= ~(LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - PORTE &= ~(LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= (LEDMask & LEDS_LED1); - PORTD &= ~(LEDMask & LEDS_LED2); - PORTE &= ~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~(LEDMask & LEDS_LED1); - PORTD |= (LEDMask & LEDS_LED2); - PORTE |= ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = (((PORTD & ~LEDS_LED1) | (LEDMask & LEDS_LED1)) | - ((PORTD | LEDS_LED2) & ~(LEDMask & LEDS_LED2))); - PORTE = ((PORTE | (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT)) & - ~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = (((PORTD & ~(LEDMask & LEDS_LED1)) | (ActiveMask & LEDS_LED1)) | - ((PORTD | (LEDMask & LEDS_LED2)) & ~(ActiveMask & LEDS_LED2))); - PORTE = ((PORTE | ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)) & - ~((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = (LEDMask & LEDS_PORTD_LEDS); - PINE = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (((PORTD & LEDS_LED1) | (~PORTD & LEDS_LED2)) | - ((~PORTE & (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT)) >> LEDS_PORTE_MASK_SHIFT)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h deleted file mode 100644 index 39267055e0..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board. - * \copydetails Group_LEDs_SPARKFUN8U2 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_SPARKFUN8U2 SPARKFUN8U2 - * \brief Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board. - * - * Board specific LED driver header for the Sparkfun ATMEGA8U2 breakout board (http://www.sparkfun.com/products/10277). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorLowPORTB.4
- * - * @{ - */ - -#ifndef __LEDS_SPARKFUN8U2_H__ -#define __LEDS_SPARKFUN8U2_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_ALL_LEDS; - PORTB |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = ((PORTB | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB | LEDMask) & ~ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (~PORTB & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h deleted file mode 100644 index dcca4d0216..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel STK525. - * \copydetails Group_Buttons_STK525 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_STK525 STK525 - * \brief Board specific Buttons driver header for the Atmel STK525. - * - * Board specific Buttons driver header for the Atmel STK525. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_STK525_H__ -#define __BUTTONS_STK525_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h deleted file mode 100644 index 1e24c5263c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the Atmel STK525. - * \copydetails Group_Dataflash_STK525 - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_STK525 STK525 - * \brief Board specific Dataflash driver header for the Atmel STK525. - * - * Board specific Dataflash driver header for the Atmel STK525. - * - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB321C (4MB)PORTB.4SPI0
- * - * @{ - */ - -#ifndef __DATAFLASH_STK525_H__ -#define __DATAFLASH_STK525_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../../../Misc/AT45DB321C.h" - #include "../../../Peripheral/SPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK (1 << 4) - #define DATAFLASH_CHIPCS_DDR DDRB - #define DATAFLASH_CHIPCS_PORT PORTB - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 0 - - /** Internal main memory page size for the board's dataflash IC. */ - #define DATAFLASH_PAGE_SIZE 512 - - /** Total number of pages inside the board's dataflash IC. */ - #define DATAFLASH_PAGES 8192 - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SPI_TransferByte(Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SPI_SendByte(Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SPI_ReceiveByte(); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= DATAFLASH_PAGES) - return; - - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - Dataflash_SendByte(PageAddress >> 6); - Dataflash_SendByte((PageAddress << 2) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h deleted file mode 100644 index dfa86acaab..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Atmel STK525. - * \copydetails Group_Joystick_STK525 - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_STK525 STK525 - * \brief Board specific joystick driver header for the Atmel STK525. - * - * Board specific joystick driver header for the Atmel STK525. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
PORTB.6PORTB.7PORTE.4PORTE.5PORTB.5
- * - * @{ - */ - -#ifndef __JOYSTICK_STK525_H__ -#define __JOYSTICK_STK525_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_BMASK ((1 << 5) | (1 << 6) | (1 << 7)) - #define JOY_EMASK ((1 << 4) | (1 << 5)) - - #define JOY_PORTE_MASK_SHIFT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1 << 6) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT ((1 << 4) >> JOY_PORTE_MASK_SHIFT) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1 << 7) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN ((1 << 5) >> JOY_PORTE_MASK_SHIFT) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1 << 5) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - DDRB &= ~JOY_BMASK; - DDRE &= ~JOY_EMASK; - - PORTB |= JOY_BMASK; - PORTE |= JOY_EMASK; - } - - static inline void Joystick_Disable(void) - { - DDRB &= ~JOY_BMASK; - DDRE &= ~JOY_EMASK; - - PORTB &= ~JOY_BMASK; - PORTE &= ~JOY_EMASK; - } - - static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Joystick_GetStatus(void) - { - return (((uint8_t)~PINB & JOY_BMASK) | (((uint8_t)~PINE & JOY_EMASK) >> JOY_PORTE_MASK_SHIFT)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h deleted file mode 100644 index 48ac4860cd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel STK525. - * \copydetails Group_LEDs_STK525 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_STK525 STK525 - * \brief Board specific LED driver header for the Atmel STK525. - * - * Board specific LED driver header for the Atmel STK525. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.4
LEDS_LED2GreenGeneral IndicatorHighPORTD.5
LEDS_LED3GreenGeneral IndicatorHighPORTD.6
LEDS_LED4GreenGeneral IndicatorHighPORTD.7
- * - * @{ - */ - -#ifndef __LEDS_STK525_H__ -#define __LEDS_STK525_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h deleted file mode 100644 index ec5a7e0e67..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel STK526. - * \copydetails Group_Buttons_STK526 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_STK526 STK526 - * \brief Board specific Buttons driver header for the Atmel STK526. - * - * Board specific Buttons driver header for the Atmel STK526. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_STK526_H__ -#define __BUTTONS_STK526_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h deleted file mode 100644 index 07d44b146b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the Atmel STK525. - * \copydetails Group_Dataflash_STK526 - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_STK526 STK526 - * \brief Board specific Dataflash driver header for the Atmel STK525. - * - * Board specific Dataflash driver header for the Atmel STK525. - * - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB642D (8MB)PORTC.2SPI0
- * - * @{ - */ - -#ifndef __DATAFLASH_STK526_H__ -#define __DATAFLASH_STK526_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../../../Misc/AT45DB642D.h" - #include "../../../Peripheral/SPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK (1 << 2) - #define DATAFLASH_CHIPCS_DDR DDRC - #define DATAFLASH_CHIPCS_PORT PORTC - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 0 - - /** Internal main memory page size for the board's dataflash IC. */ - #define DATAFLASH_PAGE_SIZE 1024 - - /** Total number of pages inside the board's dataflash IC. */ - #define DATAFLASH_PAGES 8192 - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SPI_TransferByte(Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SPI_SendByte(Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SPI_ReceiveByte(); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= DATAFLASH_PAGES) - return; - - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h deleted file mode 100644 index bc5f489ed1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Atmel STK526. - * \copydetails Group_Joystick_STK526 - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_STK526 STK526 - * \brief Board specific joystick driver header for the Atmel STK526. - * - * Board specific joystick driver header for the Atmel STK526. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
PORTB.4PORTB.5PORTB.6PORTB.7PORTB.0
- * - * @{ - */ - -#ifndef __JOYSTICK_STK526_H__ -#define __JOYSTICK_STK526_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_BMASK ((1 << 0) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1 << 4) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT (1 << 6) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1 << 5) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN (1 << 7) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1 << 0) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - DDRB &= ~JOY_BMASK; - - PORTB |= JOY_BMASK; - } - - static inline void Joystick_Disable(void) - { - DDRB &= ~JOY_BMASK; - - PORTB &= ~JOY_BMASK; - } - - static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Joystick_GetStatus(void) - { - return ((uint8_t)~PINB & JOY_BMASK); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h deleted file mode 100644 index d9bb3b99b8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel STK526. - * \copydetails Group_LEDs_STK526 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_STK526 STK526 - * \brief Board specific LED driver header for the Atmel STK526. - * - * Board specific LED driver header for the Atmel STK526. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.1
LEDS_LED2GreenGeneral IndicatorHighPORTD.0
LEDS_LED3GreenGeneral IndicatorHighPORTD.5
LEDS_LED4GreenGeneral IndicatorHighPORTD.4
- * - * @{ - */ - -#ifndef __LEDS_STK526_H__ -#define __LEDS_STK526_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 1) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 0) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 5) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h deleted file mode 100644 index 8f0cfafb26..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the PJRC Teensy 1.x/2.x boards. - * \copydetails Group_LEDs_TEENSY - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_TEENSY2 TEENSY2 - * \brief Board specific LED driver header for the PJRC Teensy 2 boards. - * - * See \ref Group_LEDs_TEENSY for more details. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_TEENSY TEENSY - * \brief Board specific LED driver header for the PJRC Teensy 1.x/2.x boards. - * - * \note For version 2 Teensy boards, compile with BOARD = TEENSY2. - * - * Board specific LED driver header for the PJRC Teensy boards (http://www.pjrc.com/teensy/index.html). - * - * TEENSY: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.6
- * - * TEENSY2: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorLowPORTD.6
- * - * @{ - */ - -#ifndef __LEDS_TEENSY_H__ -#define __LEDS_TEENSY_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - - #if (BOARD == BOARD_TEENSY2) - PORTD &= ~LEDS_ALL_LEDS; - #else - PORTD |= LEDS_ALL_LEDS; - #endif - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_TEENSY2) - PORTD |= LEDMask; - #else - PORTD &= ~LEDMask; - #endif - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_TEENSY2) - PORTD &= ~LEDMask; - #else - PORTD |= LEDMask; - #endif - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_TEENSY2) - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - #else - PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); - #endif - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - #if (BOARD == BOARD_TEENSY2) - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - #else - PORTD = ((PORTD | LEDMask) & ~ActiveMask); - #endif - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - #if (BOARD == BOARD_TEENSY2) - return (PORTD & LEDS_ALL_LEDS); - #else - return (~PORTD & LEDS_ALL_LEDS); - #endif - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h deleted file mode 100644 index a8e1041280..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the TUL. - * \copydetails Group_Buttons_TUL - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_TUL TUL - * \brief Board specific Buttons driver header for the TUL. - * - * Board specific Buttons driver header for the Busware TUL (http://www.busware.de/tiki-index.php?page=TUL). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_TUL_H__ -#define __BUTTONS_TUL_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h deleted file mode 100644 index 494396bfcd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Busware TUL. - * \copydetails Group_LEDs_TUL - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_TUL TUL - * \brief Board specific LED driver header for the Busware TUL. - * - * Board specific LED driver header for the Busware TUL (http://www.busware.de/tiki-index.php?page=TUL). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTF.0
- * - * @{ - */ - -#ifndef __LEDS_TUL_H__ -#define __LEDS_TUL_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 0) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for the none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRF |= LEDS_ALL_LEDS; - PORTF &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRF &= ~LEDS_ALL_LEDS; - PORTF &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTF |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTF &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTF = ((PORTF & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTF = ((PORTF & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINF = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTF & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h deleted file mode 100644 index 3e0bede075..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the UDIP. - * \copydetails Group_Buttons_UDIP - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_UDIP UDIP - * \brief Board specific Buttons driver header for the UDIP. - * - * Board specific Buttons driver header for the Linnix UDIP (http://linnix.com/udip/). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_UDIP_H__ -#define __BUTTONS_UDIP_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h deleted file mode 100644 index 1cff6fc694..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Linnix UDIP. - * \copydetails Group_LEDs_UDIP - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_UDIP UDIP - * \brief Board specific LED driver header for the Linnix UDIP. - * - * Board specific LED driver header for the Linnix UDIP (http://linnix.com/udip/). - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenBicolor Indicator 1HighPORTB.6
LEDS_LED2RedBicolor Indicator 1HighPORTB.5
LEDS_LED3GreenBicolor Indicator 2HighPORTD.5
LEDS_LED4RedBicolor Indicator 2HighPORTD.4
- * - * @{ - */ - -#ifndef __LEDS_UDIP_H__ -#define __LEDS_UDIP_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTB_LEDS (LEDS_LED1 | LEDS_LED2) - #define LEDS_PORTD_LEDS (LEDS_LED3 | LEDS_LED4) - - #define LEDS_PORTD_MASK_SHIFT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 ((1 << 5) >> LEDS_PORTD_MASK_SHIFT) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 ((1 << 4) >> LEDS_PORTD_MASK_SHIFT) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_PORTB_LEDS; - DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_PORTB_LEDS; - DDRD &= ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT); - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB |= (LEDMask & LEDS_PORTB_LEDS); - PORTD |= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB &= ~(LEDMask & LEDS_PORTB_LEDS); - PORTD &= ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = (PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS); - PORTD = (PORTD & ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) | - ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = (PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS); - PORTD = (PORTD & ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)) | - ((ActiveMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = (LEDMask & LEDS_PORTB_LEDS); - PIND = ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTB & LEDS_PORTB_LEDS) | ((PORTD & LEDS_PORTD_LEDS) >> LEDS_PORTD_MASK_SHIFT)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h deleted file mode 100644 index c7e09d4cbc..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Arduino Uno. - * \copydetails Group_LEDs_UNO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_UNO UNO - * \brief Board specific LED driver header for the Arduino Uno. - * - * Board specific LED driver header for the Arduino Uno (http://arduino.cc/en/Main/ArduinoBoardUno). - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowRXLowPORTD.4
LEDS_LED2YellowTXLowPORTD.5
- * - * @{ - */ - -#ifndef __LEDS_UNO_H__ -#define __LEDS_UNO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD | LEDMask) & ~ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h deleted file mode 100644 index 3775e5c845..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Paranoid Studio USB2AX. - * \copydetails Group_Buttons_USB2AX - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USB2AX_V3 USB2AX_V3 - * \brief Board specific Button driver header for the Paranoid Studio USB2AX revision 3. - * - * See \ref Group_Buttons_USB2AX for more details. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USB2AX USB2AX - * \brief Board specific Buttons driver header for the Paranoid Studio USB2AX. - * - * \note For version 3 USB2AX boards, compile with BOARD = USB2AX_V3. - * - * Board specific Buttons driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_USB2AX_H__ -#define __BUTTONS_USB2AX_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h deleted file mode 100644 index b8d2db01d5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Paranoid Studio USB2AX. - * \copydetails Group_LEDs_USB2AX - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USB2AX_V3 USB2AX_V3 - * \brief Board specific LED driver header for the Paranoid Studio USB2AX revision 3. - * - * See \ref Group_LEDs_USB2AX for more details. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USB2AX USB2AX - * \brief Board specific LED driver header for the Paranoid Studio USB2AX. - * - * \note For version 3 USB2AX boards, compile with BOARD = USB2AX_V3. - * - * Board specific LED driver header for the Paranoid Studio USB2AX (http://paranoidstudio.assembla.com/wiki/show/paranoidstudio/USB2AX). - * - * USB2AX: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTC.6
- * - * USB2AX_V3: - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorHighPORTD.1
- * - * @{ - */ - -#ifndef __LEDS_USB2AX_H__ -#define __LEDS_USB2AX_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #if (BOARD == BOARD_USB2AX) - #define USB2AX_LEDS_LED1 (1 << 6) - #else - #define USB2AX_LEDS_LED1 (1 << 1) - #endif - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 USB2AX_LEDS_LED1 - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - #if (BOARD == BOARD_USB2AX) - DDRC |= LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - #else - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - #endif - } - - static inline void LEDs_Disable(void) - { - #if (BOARD == BOARD_USB2AX) - DDRC &= ~LEDS_ALL_LEDS; - PORTC &= ~LEDS_ALL_LEDS; - #else - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - #endif - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC |= LEDMask; - #else - PORTD |= LEDMask; - #endif - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC &= ~LEDMask; - #else - PORTD &= ~LEDMask; - #endif - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC = ((PORTC & ~LEDS_ALL_LEDS) | LEDMask); - #else - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - #endif - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - #if (BOARD == BOARD_USB2AX) - PORTC = ((PORTC & ~LEDMask) | ActiveMask); - #else - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - #endif - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - #if (BOARD == BOARD_USB2AX) - PINC = LEDMask; - #else - PIND = LEDMask; - #endif - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - #if (BOARD == BOARD_USB2AX) - return (PORTC & LEDS_ALL_LEDS); - #else - return (PORTD & LEDS_ALL_LEDS); - #endif - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h deleted file mode 100644 index 876939cb74..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Kernel Concepts USBFOO. - * \copydetails Group_Buttons_USBFOO - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USBFOO USBFOO - * \brief Board specific Buttons driver header for the Kernel Concepts USBFOO. - * - * Board specific Buttons driver header for the Kernel Concepts USBFOO (http://shop.kernelconcepts.de/product_info.php?products_id=102). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_USBFOO_H__ -#define __BUTTONS_USBFOO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h deleted file mode 100644 index 7d093df18e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Kernel Concepts USBFOO. - * \copydetails Group_LEDs_USBFOO - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USBFOO USBFOO - * \brief Board specific LED driver header for the Kernel Concepts USBFOO. - * - * Board specific LED driver header for the Kernel Concepts USBFOO (http://shop.kernelconcepts.de/product_info.php?products_id=102). - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorLowPORTD.4
- * - * @{ - */ - -#ifndef __LEDS_USBFOO_H__ -#define __LEDS_USBFOO_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD | LEDMask) & ~ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (~PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h deleted file mode 100644 index 63a3ae274d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel USBKEY. - * \copydetails Group_Buttons_USBKEY - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USBKEY USBKEY - * \brief Board specific Buttons driver header for the Atmel USBKEY. - * - * Board specific Buttons driver header for the Atmel USBKEY. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTE.2
- * - * @{ - */ - -#ifndef __BUTTONS_USBKEY_H__ -#define __BUTTONS_USBKEY_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRE &= ~BUTTONS_BUTTON1; - PORTE &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PINE & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h deleted file mode 100644 index c47cfa9c22..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the Atmel USBKEY. - * \copydetails Group_Dataflash_USBKEY - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_USBKEY USBKEY - * \brief Board specific Dataflash driver header for the Atmel USBKEY. - * - * Board specific Dataflash driver header for the Atmel USBKEY board. - * - * - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB642D (8MB)PORTE.0SPI0
DATAFLASH_CHIP2AT45DB642D (8MB)PORTE.1SPI0
- * - * @{ - */ - -#ifndef __DATAFLASH_USBKEY_H__ -#define __DATAFLASH_USBKEY_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../../../Misc/AT45DB642D.h" - #include "../../../Peripheral/SPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK ((1 << 1) | (1 << 0)) - #define DATAFLASH_CHIPCS_DDR DDRE - #define DATAFLASH_CHIPCS_PORT PORTE - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 2 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 (1 << 1) - - /** Mask for the second dataflash chip selected. */ - #define DATAFLASH_CHIP2 (1 << 0) - - /** Internal main memory page size for the board's dataflash ICs. */ - #define DATAFLASH_PAGE_SIZE 1024 - - /** Total number of pages inside each of the board's dataflash ICs. */ - #define DATAFLASH_PAGES 8192 - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SPI_TransferByte(Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SPI_SendByte(Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SPI_ReceiveByte(); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) - return; - - if (PageAddress & 0x01) - Dataflash_SelectChip(DATAFLASH_CHIP2); - else - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - PageAddress >>= 1; - - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h deleted file mode 100644 index 9e9320ea08..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Atmel USBKEY. - * \copydetails Group_Joystick_USBKEY - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_USBKEY USBKEY - * \brief Board specific joystick driver header for the Atmel USBKEY. - * - * Board specific joystick driver header for the Atmel USBKEY. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
PORTB.6PORTB.7PORTE.4PORTE.5PORTB.5
- * - * @{ - */ - -#ifndef __JOYSTICK_USBKEY_H__ -#define __JOYSTICK_USBKEY_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_BMASK ((1 << 5) | (1 << 6) | (1 << 7)) - #define JOY_EMASK ((1 << 4) | (1 << 5)) - - #define JOY_PORTE_MASK_SHIFT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1 << 6) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT ((1 << 4) >> JOY_PORTE_MASK_SHIFT) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1 << 7) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN ((1 << 5) >> JOY_PORTE_MASK_SHIFT) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1 << 5) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - DDRB &= ~JOY_BMASK; - DDRE &= ~JOY_EMASK; - - PORTB |= JOY_BMASK; - PORTE |= JOY_EMASK; - } - - static inline void Joystick_Disable(void) - { - DDRB &= ~JOY_BMASK; - DDRE &= ~JOY_EMASK; - - PORTB &= ~JOY_BMASK; - PORTE &= ~JOY_EMASK; - } - - static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Joystick_GetStatus(void) - { - return (((uint8_t)~PINB & JOY_BMASK) | (((uint8_t)~PINE & JOY_EMASK) >> JOY_PORTE_MASK_SHIFT)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h deleted file mode 100644 index 77cab1ecf8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel USBKEY. - * \copydetails Group_LEDs_USBKEY - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USBKEY USBKEY - * \brief Board specific LED driver header for the Atmel USBKEY. - * - * Board specific LED driver header for the Atmel USBKEY. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1RedBicolor Indicator 1LowPORTD.4
LEDS_LED2GreenBicolor Indicator 1LowPORTD.5
LEDS_LED3RedBicolor Indicator 2LowPORTD.6
LEDS_LED4GreenBicolor Indicator 2LowPORTD.7
- * - * @{ - */ - -#ifndef __LEDS_USBKEY_H__ -#define __LEDS_USBKEY_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 7) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRD |= LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRD &= ~LEDS_ALL_LEDS; - PORTD &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTD |= LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTD &= ~LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTD = ((PORTD & ~LEDMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PIND = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTD & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h deleted file mode 100644 index 29e73b7b53..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for Tom's USBTINY MKII. - * \copydetails Group_Buttons_USBTINYMKII - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_USBTINYMKII USBTINYMKII - * \brief Board specific Buttons driver header for Tom's USBTINY MKII. - * - * Board specific Buttons driver header for Tom's USBTINY MKII (http://tom-itx.dyndns.org:81/~webpage/). - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1HWB ButtonLowPORTD.7
- * - * @{ - */ - -#ifndef __BUTTONS_USBTINYMKII_H__ -#define __BUTTONS_USBTINYMKII_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; - } - - static inline void Buttons_Disable(void) - { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h deleted file mode 100644 index 0e6192ee36..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for Tom's USBTINY MKII. - * \copydetails Group_LEDs_USBTINYMKII - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_USBTINYMKII USBTINYMKII - * \brief Board specific LED driver header for Tom's USBTINY MKII. - * - * Board specific LED driver header for Tom's USBTINY MKII (http://tom-itx.dyndns.org:81/~webpage/). - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1RedBicolor Indicator 1HighPORTB.6
LEDS_LED2GreenBicolor Indicator 1HighPORTB.7
LEDS_LED3RedTarget PowerHighPORTB.5
- * - * @{ - */ - -#ifndef __LEDS_USBTINYMKII_H__ -#define __LEDS_USBTINYMKII_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 7) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 5) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) - { - PORTB |= LedMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LedMask) - { - PORTB &= ~LedMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LedMask) - { - PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LedMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB & ~LedMask) | ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTB & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h deleted file mode 100644 index ef428b0dc4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h +++ /dev/null @@ -1,243 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the original Atmel XPLAIN. - * \copydetails Group_Dataflash_XPLAIN - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_XPLAIN_REV1 XPLAIN_REV1 - * \brief Board specific Dataflash driver header for the original Atmel XPLAIN, revision 1. - * - * See \ref Group_Dataflash_XPLAIN for more details. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_XPLAIN XPLAIN - * \brief Board specific Dataflash driver header for the original Atmel XPLAIN. - * - * \note For the first revision XPLAIN board, compile with BOARD = BOARD_XPLAIN_REV1. - * - * Board specific Dataflash driver header for the Atmel XPLAIN. - * - * Revision 1 Boards: - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB041D (512KB)PORTB.5SPI0
- * - * Other Board Revisions: - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB642D (8MB)PORTB.5SPI0
- * - * @{ - */ - -#ifndef __DATAFLASH_XPLAIN_H__ -#define __DATAFLASH_XPLAIN_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - #include "../../../Misc/AT45DB642D.h" - #include "../../../Peripheral/SPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK (1 << 5) - #define DATAFLASH_CHIPCS_DDR DDRB - #define DATAFLASH_CHIPCS_PORT PORTB - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 0 - - #if ((BOARD != BOARD_XPLAIN_REV1) || defined(__DOXYGEN__)) - /** Internal main memory page size for the board's dataflash ICs. */ - #define DATAFLASH_PAGE_SIZE 1024 - - /** Total number of pages inside each of the board's dataflash ICs. */ - #define DATAFLASH_PAGES 8192 - #else - #define DATAFLASH_PAGE_SIZE 256 - - #define DATAFLASH_PAGES 2048 - #endif - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SPI_TransferByte(Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SPI_SendByte(Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SPI_ReceiveByte(); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= DATAFLASH_PAGES) - return; - - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h deleted file mode 100644 index c7d74591d4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the original Atmel XPLAIN. - * \copydetails Group_LEDs_XPLAIN - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_XPLAIN_REV1 XPLAIN_REV1 - * \brief Board specific LED driver header for the original Atmel XPLAIN, revision 1. - * - * See \ref Group_LEDs_XPLAIN for more details. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_XPLAIN XPLAIN - * \brief Board specific LED driver header for the original Atmel XPLAIN. - * - * Board specific LED driver header for the Atmel XPLAIN. - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenGeneral IndicatorLowPORTB.6
- * - * @{ - */ - -#ifndef __LEDS_XPLAIN_H__ -#define __LEDS_XPLAIN_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS LEDS_LED1 - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - DDRB |= LEDS_ALL_LEDS; - PORTB |= LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - DDRB &= ~LEDS_ALL_LEDS; - PORTB &= ~LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB &= ~LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB |= LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB = ((PORTB | LEDS_ALL_LEDS) & ~LEDMask); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, - const uint8_t ActiveMask) - { - PORTB = ((PORTB | LEDMask) & ~ActiveMask); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PINB = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (~PORTB & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h deleted file mode 100644 index c5c09bedb8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Digital button board hardware driver. - * - * This file is the master dispatch header file for the board-specific Buttons driver, for boards containing - * physical pushbuttons connected to the microcontroller's GPIO pins. - * - * User code should include this file, which will in turn include the correct Button driver header file for the - * currently selected board. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Buttons.h file in the user project - * directory. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - */ - -/** \ingroup Group_BoardDrivers - * \defgroup Group_Buttons Buttons Driver - LUFA/Drivers/Board/Buttons.h - * \brief Digital button board hardware driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Hardware buttons driver. This provides an easy to use driver for the hardware buttons present on many boards. - * It provides a way to easily configure and check the status of all the buttons on the board so that appropriate - * actions can be taken. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Buttons.h file in the user project - * directory. Otherwise, it will include the appropriate built in board driver header file. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the button driver before first use - * Buttons_Init(); - * - * printf("Waiting for button press...\r\n"); - * - * // Loop until a board button has been pressed - * uint8_t ButtonPress; - * while (!(ButtonPress = Buttons_GetStatus())) {}; - * - * // Display which button was pressed (assuming two board buttons) - * printf("Button pressed: %s\r\n", (ButtonPress == BUTTONS_BUTTON1) ? "Button 1" : "Button 2"); - * \endcode - * - * @{ - */ - -#ifndef __BUTTONS_H__ -#define __BUTTONS_H__ - - /* Macros: */ - #define __INCLUDE_FROM_BUTTONS_H - - /* Includes: */ - #include "../../Common/Common.h" - - #if (BOARD == BOARD_NONE) - #error The Board Buttons driver cannot be used if the makefile BOARD option is not set. - #elif (BOARD == BOARD_USBKEY) - #include "AVR8/USBKEY/Buttons.h" - #elif (BOARD == BOARD_STK525) - #include "AVR8/STK525/Buttons.h" - #elif (BOARD == BOARD_STK526) - #include "AVR8/STK526/Buttons.h" - #elif (BOARD == BOARD_ATAVRUSBRF01) - #include "AVR8/ATAVRUSBRF01/Buttons.h" - #elif (BOARD == BOARD_BUMBLEB) - #include "AVR8/BUMBLEB/Buttons.h" - #elif (BOARD == BOARD_EVK527) - #include "AVR8/EVK527/Buttons.h" - #elif (BOARD == BOARD_USBTINYMKII) - #include "AVR8/USBTINYMKII/Buttons.h" - #elif (BOARD == BOARD_BENITO) - #include "AVR8/BENITO/Buttons.h" - #elif (BOARD == BOARD_JMDBU2) - #include "AVR8/JMDBU2/Buttons.h" - #elif (BOARD == BOARD_OLIMEX162) - #include "AVR8/OLIMEX162/Buttons.h" - #elif (BOARD == BOARD_USBFOO) - #include "AVR8/USBFOO/Buttons.h" - #elif (BOARD == BOARD_UDIP) - #include "AVR8/UDIP/Buttons.h" - #elif (BOARD == BOARD_CULV3) - #include "AVR8/CULV3/Buttons.h" - #elif (BOARD == BOARD_MINIMUS) - #include "AVR8/MINIMUS/Buttons.h" - #elif (BOARD == BOARD_MICROSIN162) - #include "AVR8/MICROSIN162/Buttons.h" - #elif (BOARD == BOARD_EVK1101) - #include "UC3/EVK1101/Buttons.h" - #elif (BOARD == BOARD_TUL) - #include "AVR8/TUL/Buttons.h" - #elif (BOARD == BOARD_EVK1100) - #include "UC3/EVK1100/Buttons.h" - #elif (BOARD == BOARD_EVK1104) - #include "UC3/EVK1104/Buttons.h" - #elif (BOARD == BOARD_A3BU_XPLAINED) - #include "XMEGA/A3BU_XPLAINED/Buttons.h" - #elif ((BOARD == BOARD_USB2AX) || (BOARD == BOARD_USB2AX_V3)) - #include "AVR8/USB2AX/Buttons.h" - #elif ((BOARD == BOARD_MICROPENDOUS_32U2) || (BOARD == BOARD_MICROPENDOUS_A) || \ - (BOARD == BOARD_MICROPENDOUS_1) || (BOARD == BOARD_MICROPENDOUS_2) || \ - (BOARD == BOARD_MICROPENDOUS_3) || (BOARD == BOARD_MICROPENDOUS_4) || \ - (BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \ - (BOARD == BOARD_MICROPENDOUS_DIP)) - #include "AVR8/MICROPENDOUS/Buttons.h" - #elif (BOARD == BOARD_B1_XPLAINED) - #include "XMEGA/B1_XPLAINED/Buttons.h" - #elif (BOARD == BOARD_OLIMEX32U4) - #include "AVR8/OLIMEX32U4/Buttons.h" - #elif (BOARD == BOARD_OLIMEXT32U4) - #include "AVR8/OLIMEXT32U4/Buttons.h" - #elif (BOARD == BOARD_OLIMEXISPMK2) - #include "AVR8/OLIMEXISPMK2/Buttons.h" - #else - #include "Board/Buttons.h" - #endif - - /* Pseudo-Functions for Doxygen: */ - #if defined(__DOXYGEN__) - /** Initializes the buttons driver, so that the current button position can be read. This sets the appropriate - * I/O pins to an inputs with pull-ups enabled. - * - * This must be called before any Button driver functions are used. - */ - static inline void Buttons_Init(void); - - /** Disables the buttons driver, releasing the I/O pins back to their default high-impedance input mode. */ - static inline void Buttons_Disable(void); - - /** Returns a mask indicating which board buttons are currently pressed. - * - * \return Mask indicating which board buttons are currently pressed. - */ - static inline uint_reg_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h deleted file mode 100644 index 944ea5ffe4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the board dataflash IC driver. - * \brief Atmel Dataflash storage IC board hardware driver. - * - * This file is the master dispatch header file for the board-specific Atmel dataflash driver, for boards containing - * Atmel Dataflash ICs for external non-volatile storage. - * - * User code should include this file, which will in turn include the correct dataflash driver header file for - * the currently selected board. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Dataflash.h file in the user project - * directory. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - */ - -/** \ingroup Group_BoardDrivers - * \defgroup Group_Dataflash Dataflash Driver - LUFA/Drivers/Board/Dataflash.h - * \brief Atmel Dataflash storage IC board hardware driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Dataflash driver. This module provides an easy to use interface for the Dataflash ICs located on many boards, - * for the storage of large amounts of data into the Dataflash's non-volatile memory. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Dataflash.h file in the user project - * directory. Otherwise, it will include the appropriate built in board driver header file. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the SPI and board Dataflash drivers before first use - * SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | - * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); - * Dataflash_Init(); - * - * uint8_t WriteBuffer[DATAFLASH_PAGE_SIZE]; - * uint8_t ReadBuffer[DATAFLASH_PAGE_SIZE]; - * - * // Fill page write buffer with a repeating pattern - * for (uint16_t i = 0; i < DATAFLASH_PAGE_SIZE; i++) - * WriteBuffer[i] = (i & 0xFF); - * - * // Must select the chip of interest first before operating on it - * Dataflash_SelectChip(DATAFLASH_CHIP1); - * - * // Write to the Dataflash's first internal memory buffer - * printf("Writing data to first dataflash buffer:\r\n"); - * Dataflash_SendByte(DF_CMD_BUFF1WRITE); - * Dataflash_SendAddressBytes(0, 0); - * - * for (uint16_t i = 0; i < DATAFLASH_PAGE_SIZE; i++) - * Dataflash_SendByte(WriteBuffer[i]); - * - * // Commit the Dataflash's first memory buffer to the non-volatile FLASH memory - * printf("Committing page to non-volatile memory page index 5:\r\n"); - * Dataflash_SendByte(DF_CMD_BUFF1TOMAINMEMWITHERASE); - * Dataflash_SendAddressBytes(5, 0); - * Dataflash_WaitWhileBusy(); - * - * // Read the page from non-volatile FLASH memory into the Dataflash's second memory buffer - * printf("Reading data into second dataflash buffer:\r\n"); - * Dataflash_SendByte(DF_CMD_MAINMEMTOBUFF2); - * Dataflash_SendAddressBytes(5, 0); - * Dataflash_WaitWhileBusy(); - * - * // Read the Dataflash's second internal memory buffer - * Dataflash_SendByte(DF_CMD_BUFF2READ); - * Dataflash_SendAddressBytes(0, 0); - * - * for (uint16_t i = 0; i < DATAFLASH_PAGE_SIZE; i++) - * ReadBuffer[i] = Dataflash_ReceiveByte(); - * - * // Deselect the chip after use - * Dataflash_DeselectChip(); - * \endcode - * - * @{ - */ - -#ifndef __DATAFLASH_H__ -#define __DATAFLASH_H__ - - /* Macros: */ - #define __INCLUDE_FROM_DATAFLASH_H - - /* Includes: */ - #include "../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if !defined(__DOXYGEN__) - #define __GET_DATAFLASH_MASK2(x, y) x ## y - #define __GET_DATAFLASH_MASK(x) __GET_DATAFLASH_MASK2(DATAFLASH_CHIP,x) - #endif - - /** Retrieves the Dataflash chip select mask for the given Dataflash chip index. - * - * \param[in] index Index of the dataflash chip mask to retrieve - * - * \return Mask for the given Dataflash chip's /CS pin - */ - #define DATAFLASH_CHIP_MASK(index) __GET_DATAFLASH_MASK(index) - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * - * \note The microcontroller's physical interface driver connected to the Dataflash IC must be initialized before - * any of the dataflash commands are used. This is usually a SPI hardware port, but on some devices/boards may - * be a USART operating in SPI Master mode. - */ - static inline void Dataflash_Init(void); - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a \c DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of \c DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select \ref DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress); - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void); - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void); - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte); - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - - /* Includes: */ - #if (BOARD == BOARD_NONE) - #error The Board Dataflash driver cannot be used if the makefile BOARD option is not set. - #elif (BOARD == BOARD_USBKEY) - #include "AVR8/USBKEY/Dataflash.h" - #elif (BOARD == BOARD_STK525) - #include "AVR8/STK525/Dataflash.h" - #elif (BOARD == BOARD_STK526) - #include "AVR8/STK526/Dataflash.h" - #elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) - #include "AVR8/XPLAIN/Dataflash.h" - #elif (BOARD == BOARD_EVK527) - #include "AVR8/EVK527/Dataflash.h" - #elif (BOARD == BOARD_A3BU_XPLAINED) - #include "XMEGA/A3BU_XPLAINED/Dataflash.h" - #elif (BOARD == BOARD_B1_XPLAINED) - #include "XMEGA/B1_XPLAINED/Dataflash.h" - #else - #include "Board/Dataflash.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h deleted file mode 100644 index 640939a936..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Digital joystick board hardware driver. - * - * This file is the master dispatch header file for the board-specific Joystick driver, for boards containing a - * digital joystick. - * - * User code should include this file, which will in turn include the correct joystick driver header file for the - * currently selected board. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Joystick.h file in the user project - * directory. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - */ - -/** \ingroup Group_BoardDrivers - * \defgroup Group_Joystick Joystick Driver - LUFA/Drivers/Board/Joystick.h - * \brief Digital joystick board hardware driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Hardware Joystick driver. This module provides an easy to use interface to control the hardware digital Joystick - * located on many boards. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/Joystick.h file in the user project - * directory. Otherwise, it will include the appropriate built in board driver header file. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the board Joystick driver before first use - * Joystick_Init(); - * - * printf("Waiting for joystick movement...\r\n"); - * - * // Loop until a the joystick has been moved - * uint8_t JoystickMovement; - * while (!(JoystickMovement = Joystick_GetStatus())) {}; - * - * // Display which direction the joystick was moved in - * printf("Joystick moved:\r\n"); - * - * if (JoystickMovement & (JOY_UP | JOY_DOWN)) - * printf("%s ", (JoystickMovement & JOY_UP) ? "Up" : "Down"); - * - * if (JoystickMovement & (JOY_LEFT | JOY_RIGHT)) - * printf("%s ", (JoystickMovement & JOY_LEFT) ? "Left" : "Right"); - * - * if (JoystickMovement & JOY_PRESS) - * printf("Pressed"); - * \endcode - * - * @{ - */ - -#ifndef __JOYSTICK_H__ -#define __JOYSTICK_H__ - - /* Macros: */ - #define __INCLUDE_FROM_JOYSTICK_H - - /* Includes: */ - #include "../../Common/Common.h" - - #if (BOARD == BOARD_NONE) - #error The Board Joystick driver cannot be used if the makefile BOARD option is not set. - #elif (BOARD == BOARD_USBKEY) - #include "AVR8/USBKEY/Joystick.h" - #elif (BOARD == BOARD_STK525) - #include "AVR8/STK525/Joystick.h" - #elif (BOARD == BOARD_STK526) - #include "AVR8/STK526/Joystick.h" - #elif (BOARD == BOARD_BUMBLEB) - #include "AVR8/BUMBLEB/Joystick.h" - #elif (BOARD == BOARD_EVK527) - #include "AVR8/EVK527/Joystick.h" - #elif (BOARD == BOARD_EVK1101) - #include "UC3/EVK1101/Joystick.h" - #elif (BOARD == BOARD_EVK1100) - #include "UC3/EVK1100/Joystick.h" - #else - #include "Board/Joystick.h" - #endif - - /* Pseudo-Functions for Doxygen: */ - #if defined(__DOXYGEN__) - /** Initializes the joystick driver so that the joystick position can be read. This sets the appropriate - * I/O pins to inputs with their pull-ups enabled. - */ - static inline void Joystick_Init(void); - - /** Disables the joystick driver, releasing the I/O pins back to their default high-impedance input mode. */ - static inline void Joystick_Disable(void); - - /** Returns the current status of the joystick, as a mask indicating the direction the joystick is - * currently facing in (multiple bits can be set). - * - * \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file - * for direction masks. - */ - static inline uint_reg_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h deleted file mode 100644 index 96438d0dae..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief LED board hardware driver. - * - * This file is the master dispatch header file for the board-specific LED driver, for boards containing user - * controllable LEDs. - * - * User code should include this file, which will in turn include the correct LED driver header file for the - * currently selected board. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/LEDs.h file in the user project - * directory. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - */ - -/** \ingroup Group_BoardDrivers - * \defgroup Group_LEDs LEDs Driver - LUFA/Drivers/Board/LEDs.h - * \brief LED board hardware driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Hardware LEDs driver. This provides an easy to use driver for the hardware LEDs present on many boards. It - * provides an interface to configure, test and change the status of all the board LEDs. - * - * If the \c BOARD value is set to \c BOARD_USER, this will include the \c /Board/LEDs.h file in the user project - * directory. Otherwise, it will include the appropriate built in board driver header file. If the BOARD value - * is set to \c BOARD_NONE, this driver is silently disabled. - * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. - * - * \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If - * a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect. - * If other behavior is desired, either alias the remaining LED masks to existing LED masks via the -D - * switch in the project makefile, or alias them to nothing in the makefile to cause compilation errors when - * a non-existing LED is referenced in application code. Note that this means that it is possible to make - * compatible code for a board with no LEDs by making a board LED driver (see \ref Page_WritingBoardDrivers) - * which contains only stub functions and defines no LEDs. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the board LED driver before first use - * LEDs_Init(); - * - * // Turn on each of the four LEDs in turn - * LEDs_SetAllLEDs(LEDS_LED1); - * Delay_MS(500); - * LEDs_SetAllLEDs(LEDS_LED2); - * Delay_MS(500); - * LEDs_SetAllLEDs(LEDS_LED3); - * Delay_MS(500); - * LEDs_SetAllLEDs(LEDS_LED4); - * Delay_MS(500); - * - * // Turn on all LEDs - * LEDs_SetAllLEDs(LEDS_ALL_LEDS); - * Delay_MS(1000); - * - * // Turn on LED 1, turn off LED 2, leaving LEDs 3 and 4 in their current state - * LEDs_ChangeLEDs((LEDS_LED1 | LEDS_LED2), LEDS_LED1); - * \endcode - * - * @{ - */ - -#ifndef __LEDS_H__ -#define __LEDS_H__ - - /* Macros: */ - #define __INCLUDE_FROM_LEDS_H - - /* Includes: */ - #include "../../Common/Common.h" - - #if (BOARD == BOARD_NONE) - static inline void LEDs_Init(void) {}; - static inline void LEDs_Disable(void) {}; - static inline void LEDs_TurnOnLEDs(const uint_reg_t LEDMask) {}; - static inline void LEDs_TurnOffLEDs(const uint_reg_t LEDMask) {}; - static inline void LEDs_SetAllLEDs(const uint_reg_t LEDMask) {}; - static inline void LEDs_ChangeLEDs(const uint_reg_t LEDMask, const uint_reg_t ActiveMask) {}; - static inline void LEDs_ToggleLEDs(const uint_reg_t LEDMask) {}; - static inline uint_reg_t LEDs_GetLEDs(void) { return 0; } - #elif (BOARD == BOARD_USBKEY) - #include "AVR8/USBKEY/LEDs.h" - #elif (BOARD == BOARD_STK525) - #include "AVR8/STK525/LEDs.h" - #elif (BOARD == BOARD_STK526) - #include "AVR8/STK526/LEDs.h" - #elif (BOARD == BOARD_RZUSBSTICK) - #include "AVR8/RZUSBSTICK/LEDs.h" - #elif (BOARD == BOARD_ATAVRUSBRF01) - #include "AVR8/ATAVRUSBRF01/LEDs.h" - #elif ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) - #include "AVR8/XPLAIN/LEDs.h" - #elif (BOARD == BOARD_BUMBLEB) - #include "AVR8/BUMBLEB/LEDs.h" - #elif (BOARD == BOARD_EVK527) - #include "AVR8/EVK527/LEDs.h" - #elif ((BOARD == BOARD_TEENSY) || (BOARD == BOARD_TEENSY2)) - #include "AVR8/TEENSY/LEDs.h" - #elif (BOARD == BOARD_USBTINYMKII) - #include "AVR8/USBTINYMKII/LEDs.h" - #elif (BOARD == BOARD_BENITO) - #include "AVR8/BENITO/LEDs.h" - #elif (BOARD == BOARD_JMDBU2) - #include "AVR8/JMDBU2/LEDs.h" - #elif (BOARD == BOARD_OLIMEX162) - #include "AVR8/OLIMEX162/LEDs.h" - #elif (BOARD == BOARD_USBFOO) - #include "AVR8/USBFOO/LEDs.h" - #elif (BOARD == BOARD_UDIP) - #include "AVR8/UDIP/LEDs.h" - #elif (BOARD == BOARD_BUI) - #include "AVR8/BUI/LEDs.h" - #elif (BOARD == BOARD_UNO) - #include "AVR8/UNO/LEDs.h" - #elif (BOARD == BOARD_CULV3) - #include "AVR8/CULV3/LEDs.h" - #elif (BOARD == BOARD_BLACKCAT) - #include "AVR8/BLACKCAT/LEDs.h" - #elif (BOARD == BOARD_MAXIMUS) - #include "AVR8/MAXIMUS/LEDs.h" - #elif (BOARD == BOARD_MINIMUS) - #include "AVR8/MINIMUS/LEDs.h" - #elif (BOARD == BOARD_ADAFRUITU4) - #include "AVR8/ADAFRUITU4/LEDs.h" - #elif (BOARD == BOARD_MICROSIN162) - #include "AVR8/MICROSIN162/LEDs.h" - #elif (BOARD == BOARD_SPARKFUN8U2) - #include "AVR8/SPARKFUN8U2/LEDs.h" - #elif (BOARD == BOARD_EVK1101) - #include "UC3/EVK1101/LEDs.h" - #elif (BOARD == BOARD_TUL) - #include "AVR8/TUL/LEDs.h" - #elif (BOARD == BOARD_EVK1100) - #include "UC3/EVK1100/LEDs.h" - #elif (BOARD == BOARD_EVK1104) - #include "UC3/EVK1104/LEDs.h" - #elif (BOARD == BOARD_A3BU_XPLAINED) - #include "XMEGA/A3BU_XPLAINED/LEDs.h" - #elif ((BOARD == BOARD_USB2AX) || (BOARD == BOARD_USB2AX_V3)) - #include "AVR8/USB2AX/LEDs.h" - #elif ((BOARD == BOARD_MICROPENDOUS_REV1) || (BOARD == BOARD_MICROPENDOUS_REV2) || \ - (BOARD == BOARD_MICROPENDOUS_32U2)) - #include "AVR8/MICROPENDOUS/LEDs.h" - #elif (BOARD == BOARD_B1_XPLAINED) - #include "XMEGA/B1_XPLAINED/LEDs.h" - #elif (BOARD == BOARD_MULTIO) - #include "AVR8/MULTIO/LEDs.h" - #elif (BOARD == BOARD_BIGMULTIO) - #include "AVR8/BIGMULTIO/LEDs.h" - #elif (BOARD == BOARD_DUCE) - #include "AVR8/DUCE/LEDs.h" - #elif (BOARD == BOARD_OLIMEX32U4) - #include "AVR8/OLIMEX32U4/LEDs.h" - #elif (BOARD == BOARD_OLIMEXT32U4) - #include "AVR8/OLIMEXT32U4/LEDs.h" - #elif (BOARD == BOARD_OLIMEXISPMK2) - #include "AVR8/OLIMEXISPMK2/LEDs.h" - #else - #include "Board/LEDs.h" - #endif - - /* Preprocessor Checks: */ - #if !defined(__DOXYGEN__) - #if !defined(LEDS_LED1) - #define LEDS_LED1 0 - #endif - - #if !defined(LEDS_LED2) - #define LEDS_LED2 0 - #endif - - #if !defined(LEDS_LED3) - #define LEDS_LED3 0 - #endif - - #if !defined(LEDS_LED4) - #define LEDS_LED4 0 - #endif - #endif - - /* Pseudo-Functions for Doxygen: */ - #if defined(__DOXYGEN__) - /** Initializes the board LED driver so that the LEDs can be controlled. This sets the appropriate port - * I/O pins as outputs, and sets the LEDs to default to off. - */ - static inline void LEDs_Init(void); - - /** Disables the board LED driver, releasing the I/O pins back to their default high-impedance input mode. */ - static inline void LEDs_Disable(void); - - /** Turns on the LEDs specified in the given LED mask. - * - * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). - */ - static inline void LEDs_TurnOnLEDs(const uint_reg_t LEDMask); - - /** Turns off the LEDs specified in the given LED mask. - * - * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). - */ - static inline void LEDs_TurnOffLEDs(const uint_reg_t LEDMask); - - /** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED - * mask. - * - * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). - */ - static inline void LEDs_SetAllLEDs(const uint_reg_t LEDMask); - - /** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs - * specified in both the LED and active masks. - * - * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). - * \param[in] ActiveMask Mask of whether the LEDs in the LED mask should be turned on or off. - */ - static inline void LEDs_ChangeLEDs(const uint_reg_t LEDMask, - const uint_reg_t ActiveMask); - - /** Toggles all LEDs in the LED mask, leaving all others in their current states. - * - * \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file). - */ - static inline void LEDs_ToggleLEDs(const uint_reg_t LEDMask); - - /** Returns the status of all the board LEDs; set LED masks in the return value indicate that the - * corresponding LED is on. - * - * \return Mask of the board LEDs which are currently turned on. - */ - static inline uint_reg_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c deleted file mode 100644 index 94843115fe..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_TEMPERATURE_C -#include "Temperature.h" - -#if defined(TEMPERATURE_SENSOR_DRIVER_COMPATIBLE) - -static const uint16_t PROGMEM Temperature_Lookup[TEMP_TABLE_SIZE] = -{ - 0x3B4, 0x3B0, 0x3AB, 0x3A6, 0x3A0, 0x39A, 0x394, 0x38E, 0x388, 0x381, 0x37A, 0x373, - 0x36B, 0x363, 0x35B, 0x353, 0x34A, 0x341, 0x338, 0x32F, 0x325, 0x31B, 0x311, 0x307, - 0x2FC, 0x2F1, 0x2E6, 0x2DB, 0x2D0, 0x2C4, 0x2B8, 0x2AC, 0x2A0, 0x294, 0x288, 0x27C, - 0x26F, 0x263, 0x256, 0x24A, 0x23D, 0x231, 0x225, 0x218, 0x20C, 0x200, 0x1F3, 0x1E7, - 0x1DB, 0x1CF, 0x1C4, 0x1B8, 0x1AC, 0x1A1, 0x196, 0x18B, 0x180, 0x176, 0x16B, 0x161, - 0x157, 0x14D, 0x144, 0x13A, 0x131, 0x128, 0x11F, 0x117, 0x10F, 0x106, 0x0FE, 0x0F7, - 0x0EF, 0x0E8, 0x0E1, 0x0DA, 0x0D3, 0x0CD, 0x0C7, 0x0C0, 0x0BA, 0x0B5, 0x0AF, 0x0AA, - 0x0A4, 0x09F, 0x09A, 0x096, 0x091, 0x08C, 0x088, 0x084, 0x080, 0x07C, 0x078, 0x074, - 0x071, 0x06D, 0x06A, 0x067, 0x064, 0x061, 0x05E, 0x05B, 0x058, 0x055, 0x053, 0x050, - 0x04E, 0x04C, 0x049, 0x047, 0x045, 0x043, 0x041, 0x03F, 0x03D, 0x03C, 0x03A, 0x038 -}; - -int8_t Temperature_GetTemperature(void) -{ - uint16_t Temp_ADC = ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | TEMP_ADC_CHANNEL_MASK); - - if (Temp_ADC > pgm_read_word(&Temperature_Lookup[0])) - return TEMP_MIN_TEMP; - - for (uint16_t Index = 0; Index < TEMP_TABLE_SIZE; Index++) - { - if (Temp_ADC > pgm_read_word(&Temperature_Lookup[Index])) - return (Index + TEMP_TABLE_OFFSET_DEGREES); - } - - return TEMP_MAX_TEMP; -} - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h deleted file mode 100644 index ed3aa7bd8b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief NTC Temperature Sensor board hardware driver. - * - * Master include file for the board temperature sensor driver, for the USB boards which contain a temperature sensor. - */ - -/** \ingroup Group_BoardDrivers - * \defgroup Group_Temperature Temperature Sensor Driver - LUFA/Drivers/Board/Temperature.h - * \brief NTC Temperature Sensor board hardware driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/Board/Temperature.c (Makefile source module name: LUFA_SRC_TEMPERATURE) - * - * \section Sec_ModDescription Module Description - * Temperature sensor driver. This provides an easy to use interface for the hardware temperature sensor located - * on many boards. It provides an interface to configure the sensor and appropriate ADC channel, plus read out the - * current temperature in degrees C. It is designed for and will only work with the temperature sensor located on the - * official Atmel USB AVR boards, as each sensor has different characteristics. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the ADC and board temperature sensor drivers before first use - * ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128); - * Temperature_Init(); - * - * // Display converted temperature in degrees Celsius - * printf("Current Temperature: %d Degrees\r\n", Temperature_GetTemperature()); - * \endcode - * - * @{ - */ - -#ifndef __TEMPERATURE_H__ -#define __TEMPERATURE_H__ - - /* Includes: */ - #include "../../Common/Common.h" - - /* Preprocessor Checks: */ - #if ((BOARD == BOARD_USBKEY) || (BOARD == BOARD_STK525) || \ - (BOARD == BOARD_STK526) || (BOARD == BOARD_EVK527)) - #define TEMPERATURE_SENSOR_DRIVER_COMPATIBLE - #endif - - #if !defined(__INCLUDE_FROM_TEMPERATURE_C) && !defined(TEMPERATURE_SENSOR_DRIVER_COMPATIBLE) - #error The selected board does not contain a compatible temperature sensor. - #endif - - #if defined(TEMPERATURE_SENSOR_DRIVER_COMPATIBLE) - - /* Includes: */ - #include "../Peripheral/ADC.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** ADC channel number for the temperature sensor. */ - #define TEMP_ADC_CHANNEL 0 - - /** ADC channel MUX mask for the temperature sensor. */ - #define TEMP_ADC_CHANNEL_MASK ADC_CHANNEL0 - - /** Size of the temperature sensor lookup table, in lookup values */ - #define TEMP_TABLE_SIZE 120 - - /** Minimum returnable temperature from the \ref Temperature_GetTemperature() function. */ - #define TEMP_MIN_TEMP TEMP_TABLE_OFFSET_DEGREES - - /** Maximum returnable temperature from the \ref Temperature_GetTemperature() function. */ - #define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET_DEGREES) - - /* Inline Functions: */ - /** Initializes the temperature sensor driver, including setting up the appropriate ADC channel. - * This must be called before any other temperature sensor routines. - * - * \pre The ADC itself (not the ADC channel) must be configured separately before calling the - * temperature sensor functions. - */ - static inline void Temperature_Init(void) ATTR_ALWAYS_INLINE; - static inline void Temperature_Init(void) - { - ADC_SetupChannel(TEMP_ADC_CHANNEL); - } - - /* Function Prototypes: */ - /** Performs a complete ADC on the temperature sensor channel, and converts the result into a - * valid temperature between \ref TEMP_MIN_TEMP and \ref TEMP_MAX_TEMP in degrees Celsius. - * - * \return Signed temperature value in degrees Celsius. - */ - int8_t Temperature_GetTemperature(void) ATTR_WARN_UNUSED_RESULT; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define TEMP_TABLE_OFFSET_DEGREES -21 - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h deleted file mode 100644 index f0f596e84a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel EVK1100. - * \copydetails Group_Buttons_EVK1100 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_EVK1100 EVK1100 - * \brief Board specific Buttons driver header for the Atmel EVK1100. - * - * Board specific Buttons driver header for the Atmel EVK1100. - * - * - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1SW0 ButtonLowGPIO88
BUTTONS_BUTTON2SW1 ButtonLowGPIO85
BUTTONS_BUTTON3SW2 ButtonLowGPIO82
- * - * @{ - */ - -#ifndef __BUTTONS_EVK1100_H__ -#define __BUTTONS_EVK1100_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define BUTTONS_PORT 2 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask of the first button on the board */ - #define BUTTONS_BUTTON1 (1UL << 24) - - /** Mask of the second button on the board */ - #define BUTTONS_BUTTON2 (1UL << 21) - - /** Mask of the third button on the board */ - #define BUTTONS_BUTTON3 (1UL << 18) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - AVR32_GPIO.port[BUTTONS_PORT].gpers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - } - - static inline void Buttons_Disable(void) - { - AVR32_GPIO.port[BUTTONS_PORT].gperc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - AVR32_GPIO.port[BUTTONS_PORT].puerc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - } - - static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t Buttons_GetStatus(void) - { - return (~(AVR32_GPIO.port[JOY_MOVE_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2))); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h deleted file mode 100644 index adc6aea626..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Atmel EVK1100. - * \copydetails Group_Joystick_EVK1100 - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_EVK1100 EVK1100 - * \brief Board specific joystick driver header for the Atmel EVK1100. - * - * Board specific joystick driver header for the Atmel EVK1100. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
GPIO25GPIO26GPIO28GPIO27GPIO20
- * - * @{ - */ - -#ifndef __JOYSTICK_EVK1100_H__ -#define __JOYSTICK_EVK1100_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_PORT 0 - #define JOY_MASK ((1UL << 28) | (1UL << 27) | (1UL << 26) | (1UL << 25) | (1UL << 20)) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1UL << 25) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1UL << 26) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT (1UL << 28) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN (1UL << 27) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1UL << 20) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - AVR32_GPIO.port[JOY_PORT].gpers = JOY_MASK; - AVR32_GPIO.port[JOY_PORT].gpers = JOY_MASK; - }; - - static inline void Joystick_Disable(void) - { - AVR32_GPIO.port[JOY_PORT].gperc = JOY_MASK; - AVR32_GPIO.port[JOY_PORT].gperc = JOY_MASK; - }; - - static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t Joystick_GetStatus(void) - { - return (uint32_t)(~(AVR32_GPIO.port[JOY_PORT].pvr & JOY_MASK)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h deleted file mode 100644 index 3e5ab85160..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel EVK1100. - * \copydetails Group_LEDs_EVK1100 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_EVK1100 EVK1100 - * \brief Board specific LED driver header for the Atmel EVK1100. - * - * Board specific LED driver header for the Atmel EVK1100. - * - * - * - * - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenLED0 LEDLowGPIO51
LEDS_LED2GreenLED1 LEDLowGPIO52
LEDS_LED3GreenLED2 LEDLowGPIO53
LEDS_LED4GreenLED3 LEDLowGPIO54
LEDS_LED5GreenLED4 LEDLowGPIO59
LEDS_LED6GreenLED5 LEDLowGPIO60
LEDS_LED7GreenLED6 LEDLowGPIO61
LEDS_LED8GreenLED7 LEDLowGPIO62
- * - * @{ - */ - -#ifndef __LEDS_EVK1100_H__ -#define __LEDS_EVK1100_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1UL << 19) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1UL << 20) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1UL << 21) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1UL << 22) - - /** LED mask for the fifth LED on the board. */ - #define LEDS_LED5 (1UL << 27) - - /** LED mask for the sixth LED on the board. */ - #define LEDS_LED6 (1UL << 28) - - /** LED mask for the seventh LED on the board. */ - #define LEDS_LED7 (1UL << 29) - - /** LED mask for the eighth LED on the board. */ - #define LEDS_LED8 (1UL << 30) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4 \ - LEDS_LED5 | LEDS_LED6 | LEDS_LED7 | LEDS_LED8) - - /** LED mask for the none of the board LEDs */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - AVR32_GPIO.port[LEDS_PORT].gpers = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].oders = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - AVR32_GPIO.port[LEDS_PORT].gperc = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].oderc = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].ovrc = LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask; - } - - static inline void LEDs_ChangeLEDs(const uint32_t LEDMask, const uint32_t ActiveMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDMask; - AVR32_GPIO.port[LEDS_PORT].ovrc = ActiveMask; - } - - static inline void LEDs_ToggleLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrt = LEDMask; - } - - static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t LEDs_GetLEDs(void) - { - return (~AVR32_GPIO.port[LEDS_PORT].ovr & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h deleted file mode 100644 index 40f8aecf33..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel EVK1101. - * \copydetails Group_Buttons_EVK1101 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_EVK1101 EVK1101 - * \brief Board specific Buttons driver header for the Atmel EVK1101. - * - * Board specific Buttons driver header for the Atmel EVK1101. - * - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1SW0 ButtonLowGPIO34
BUTTONS_BUTTON2SW1 ButtonLowGPIO35
- * - * @{ - */ - -#ifndef __BUTTONS_EVK1101_H__ -#define __BUTTONS_EVK1101_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define BUTTONS_PORT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask of the first button on the board */ - #define BUTTONS_BUTTON1 (1UL << 2) - - /** Mask of the second button on the board */ - #define BUTTONS_BUTTON2 (1UL << 3) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - AVR32_GPIO.port[BUTTONS_PORT].gpers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - } - - static inline void Buttons_Disable(void) - { - AVR32_GPIO.port[BUTTONS_PORT].gperc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - AVR32_GPIO.port[BUTTONS_PORT].puerc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - } - - static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t Buttons_GetStatus(void) - { - return (~(AVR32_GPIO.port[BUTTONS_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2))); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h deleted file mode 100644 index d61c52e335..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific joystick driver header for the Atmel EVK1101. - * \copydetails Group_Joystick_EVK1101 - * - * \note This file should not be included directly. It is automatically included as needed by the joystick driver - * dispatch header located in LUFA/Drivers/Board/Joystick.h. - */ - -/** \ingroup Group_Joystick - * \defgroup Group_Joystick_EVK1101 EVK1101 - * \brief Board specific joystick driver header for the Atmel EVK1101. - * - * Board specific joystick driver header for the Atmel EVK1101. - * - * - * - * - *
Left Port PinUp Port PinRight Port PinDown Port PinPress Port Pin
GPIO38GPIO39GPIO41GPIO40GPIO13
- * - * @{ - */ - -#ifndef __JOYSTICK_EVK1101_H__ -#define __JOYSTICK_EVK1101_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_JOYSTICK_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define JOY_MOVE_PORT 1 - #define JOY_MOVE_MASK ((1UL << 6) | (1UL << 7) | (1UL << 8) | (1UL << 9)) - #define JOY_PRESS_PORT 0 - #define JOY_PRESS_MASK (1UL << 13) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1UL << 6) - - /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1UL << 7) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT (1UL << 9) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN (1UL << 8) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1UL << 13) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Joystick_Init(void) - { - AVR32_GPIO.port[JOY_MOVE_PORT].gpers = JOY_MOVE_MASK; - AVR32_GPIO.port[JOY_PRESS_PORT].gpers = JOY_PRESS_MASK; - - AVR32_GPIO.port[JOY_MOVE_PORT].puers = JOY_MOVE_MASK; - AVR32_GPIO.port[JOY_PRESS_PORT].puers = JOY_PRESS_MASK; - }; - - static inline void Joystick_Disable(void) - { - AVR32_GPIO.port[JOY_MOVE_PORT].gperc = JOY_MOVE_MASK; - AVR32_GPIO.port[JOY_PRESS_PORT].gperc = JOY_PRESS_MASK; - - AVR32_GPIO.port[JOY_MOVE_PORT].puerc = JOY_MOVE_MASK; - AVR32_GPIO.port[JOY_PRESS_PORT].puerc = JOY_PRESS_MASK; - }; - - static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t Joystick_GetStatus(void) - { - return (uint32_t)(~((AVR32_GPIO.port[JOY_MOVE_PORT].pvr & JOY_MOVE_MASK) | - (AVR32_GPIO.port[JOY_PRESS_PORT].pvr & JOY_PRESS_MASK))); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h deleted file mode 100644 index 1f1960d1f2..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel EVK1101. - * \copydetails Group_LEDs_EVK1101 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_EVK1101 EVK1101 - * \brief Board specific LED driver header for the Atmel EVK1101. - * - * Board specific LED driver header for the Atmel EVK1101. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenLED0 LEDLowGPIO7
LEDS_LED2GreenLED1 LEDLowGPIO8
LEDS_LED3GreenLED2 LEDLowGPIO21
LEDS_LED4GreenLED3 LEDLowGPIO22
- * - * @{ - */ - -#ifndef __LEDS_EVK1101_H__ -#define __LEDS_EVK1101_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORT 0 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1UL << 7) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1UL << 8) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1UL << 21) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1UL << 22) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for the none of the board LEDs */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - AVR32_GPIO.port[LEDS_PORT].gpers = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].oders = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS; - } - - static inline void LEDs_Disable(void) - { - AVR32_GPIO.port[LEDS_PORT].gperc = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].oderc = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].ovrc = LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS; - AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask; - } - - static inline void LEDs_ChangeLEDs(const uint32_t LEDMask, const uint32_t ActiveMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrs = LEDMask; - AVR32_GPIO.port[LEDS_PORT].ovrc = ActiveMask; - } - - static inline void LEDs_ToggleLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[LEDS_PORT].ovrt = LEDMask; - } - - static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t LEDs_GetLEDs(void) - { - return (~AVR32_GPIO.port[LEDS_PORT].ovr & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h deleted file mode 100644 index 1c6bdd0d41..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel EVK1104. - * \copydetails Group_Buttons_EVK1104 - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_EVK1104 EVK1104 - * \brief Board specific Buttons driver header for the Atmel EVK1104. - * - * Board specific Buttons driver header for the Atmel EVK1104. - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1SW0 ButtonLowGPIO42
- * - * @{ - */ - -#ifndef __BUTTONS_EVK1104_H__ -#define __BUTTONS_EVK1104_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define BUTTONS_PORT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask of the first button on the board */ - #define BUTTONS_BUTTON1 (1UL << 10) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - AVR32_GPIO.port[BUTTONS_PORT].gpers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - AVR32_GPIO.port[BUTTONS_PORT].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - } - - static inline void Buttons_Disable(void) - { - AVR32_GPIO.port[BUTTONS_PORT].gperc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - AVR32_GPIO.port[BUTTONS_PORT].puerc = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2); - } - - static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t Buttons_GetStatus(void) - { - return (~(AVR32_GPIO.port[JOY_MOVE_PORT].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2))); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h deleted file mode 100644 index 145955174a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel EVK1104. - * \copydetails Group_LEDs_EVK1104 - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_EVK1104 EVK1104 - * \brief Board specific LED driver header for the Atmel EVK1104. - * - * Board specific LED driver header for the Atmel EVK1104. - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1GreenLED0 LEDLowGPIO67
LEDS_LED2GreenLED1 LEDLowGPIO101
LEDS_LED3GreenLED2 LEDLowGPIO102
LEDS_LED4GreenLED3 LEDLowGPIO105
- * - * @{ - */ - -#ifndef __LEDS_EVK1104_H__ -#define __LEDS_EVK1104_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_LEDMASK2 (1UL << 3) - #define LEDS_LEDMASK3 ((1UL << 9) | (1UL << 6) | (1UL << 5)) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1UL << 3) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1UL << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1UL << 9) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1UL << 6) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - - /** LED mask for the none of the board LEDs */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - AVR32_GPIO.port[2].gpers = LEDS_LEDMASK2; - AVR32_GPIO.port[2].oders = LEDS_LEDMASK2; - AVR32_GPIO.port[2].ovrs = LEDS_LEDMASK2; - - AVR32_GPIO.port[3].gpers = LEDS_LEDMASK3; - AVR32_GPIO.port[3].oders = LEDS_LEDMASK3; - AVR32_GPIO.port[3].ovrs = LEDS_LEDMASK3; - } - - static inline void LEDs_Disable(void) - { - AVR32_GPIO.port[2].gperc = LEDS_LEDMASK2; - AVR32_GPIO.port[2].oderc = LEDS_LEDMASK2; - AVR32_GPIO.port[2].ovrc = LEDS_LEDMASK2; - - AVR32_GPIO.port[3].gperc = LEDS_LEDMASK3; - AVR32_GPIO.port[3].oderc = LEDS_LEDMASK3; - AVR32_GPIO.port[3].ovrc = LEDS_LEDMASK3; - } - - static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[2].ovrc = (LEDMask & LEDS_LEDMASK2); - AVR32_GPIO.port[3].ovrc = (LEDMask & LEDS_LEDMASK3); - } - - static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[2].ovrs = (LEDMask & LEDS_LEDMASK2); - AVR32_GPIO.port[3].ovrs = (LEDMask & LEDS_LEDMASK3); - } - - static inline void LEDs_SetAllLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[2].ovrs = LEDS_LEDMASK2; - AVR32_GPIO.port[2].ovrc = (LEDMask & LEDS_LEDMASK2); - - AVR32_GPIO.port[3].ovrs = LEDS_LEDMASK3; - AVR32_GPIO.port[3].ovrc = (LEDMask & LEDS_LEDMASK3); - } - - static inline void LEDs_ChangeLEDs(const uint32_t LEDMask, const uint32_t ActiveMask) - { - AVR32_GPIO.port[2].ovrs = (LEDMask & LEDS_LEDMASK2); - AVR32_GPIO.port[2].ovrc = (ActiveMask & LEDS_LEDMASK2); - - AVR32_GPIO.port[3].ovrs = (LEDMask & LEDS_LEDMASK3); - AVR32_GPIO.port[3].ovrc = (ActiveMask & LEDS_LEDMASK3); - } - - static inline void LEDs_ToggleLEDs(const uint32_t LEDMask) - { - AVR32_GPIO.port[2].ovrt = (LEDMask & LEDS_LEDMASK2); - AVR32_GPIO.port[3].ovrt = (LEDMask & LEDS_LEDMASK3); - } - - static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint32_t LEDs_GetLEDs(void) - { - return ((~AVR32_GPIO.port[2].ovr & LEDS_LEDMASK2) | (~AVR32_GPIO.port[3].ovr & LEDS_LEDMASK3)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h deleted file mode 100644 index ebe24a74f9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained. - * \copydetails Group_Buttons_A3BU_XPLAINED - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_A3BU_XPLAINED A3BU_XPLAINED - * \brief Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained. - * - * Board specific Buttons driver header for the Atmel XMEGA A3BU Xplained. - * - * - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1SW0 ButtonLowPORTE.5
BUTTONS_BUTTON2SW1 ButtonLowPORTF.1
BUTTONS_BUTTON3SW2 ButtonLowPORTF.2
- * - * @{ - */ - -#ifndef __BUTTONS_A3BU_XPLAINED_H__ -#define __BUTTONS_A3BU_XPLAINED_H__ - - /* Includes: */ - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 5) - - /** Button mask for the second button on the board. */ - #define BUTTONS_BUTTON2 (1 << 1) - - /** Button mask for the third button on the board. */ - #define BUTTONS_BUTTON3 (1 << 2) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - PORTE.OUTCLR = BUTTONS_BUTTON1; - PORTE.PIN5CTRL = (PORT_OPC_PULLUP_gc | PORT_INVEN_bm); - - PORTF.OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3); - PORTF.PIN1CTRL = (PORT_OPC_PULLUP_gc | PORT_INVEN_bm); - PORTF.PIN2CTRL = (PORT_OPC_PULLUP_gc | PORT_INVEN_bm); - } - - static inline void Buttons_Disable(void) - { - PORTE.OUTCLR = BUTTONS_BUTTON1; - PORTE.PIN5CTRL = 0; - - PORTF.OUTCLR = (BUTTONS_BUTTON2 | BUTTONS_BUTTON3); - PORTF.PIN1CTRL = 0; - PORTF.PIN2CTRL = 0; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return ((PORTE_IN & BUTTONS_BUTTON1) | (PORTF_IN & (BUTTONS_BUTTON2 | BUTTONS_BUTTON3))); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h deleted file mode 100644 index 34f8ce121d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained. - * \copydetails Group_Dataflash_B1_XPLAINED - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_B1_XPLAINED B1_XPLAINED - * \brief Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained. - * - * Board specific Dataflash driver header for the Atmel XMEGA B1 Xplained board. - * - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB642D (8MB)PORTF.4USARTD0 (In SPI Mode)
- * - * @{ - */ - -#ifndef __DATAFLASH_B1_XPLAINED_H__ -#define __DATAFLASH_B1_XPLAINED_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../../../Misc/AT45DB642D.h" - #include "../../../Peripheral/SerialSPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK (1 << 4) - #define DATAFLASH_CHIPCS_PORT PORTF - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP 0 - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 (1 << 4) - - /** Internal main memory page size for the board's dataflash ICs. */ - #define DATAFLASH_PAGE_SIZE 1024 - - /** Total number of pages inside each of the board's dataflash ICs. */ - #define DATAFLASH_PAGES 8192 - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK; - - PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SerialSPI_TransferByte(&USARTD0, Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SerialSPI_SendByte(&USARTD0, Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SerialSPI_ReceiveByte(&USARTD0); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT.OUT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT.OUTCLR = DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT.OUTSET = ChipMask; - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) - return; - - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h deleted file mode 100644 index f930844c88..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel XMEGA A3BU Xplained. - * \copydetails Group_LEDs_A3BU_XPLAINED - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_A3BU_XPLAINED A3BU_XPLAINED - * \brief Board specific LED driver header for the Atmel XMEGA A3BU Xplained. - * - * Board specific LED driver header for the Atmel XMEGA A3BU Xplained. - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowLED0 LEDLowPORTR.0
LEDS_LED2YellowLED1 LEDLowPORTR.1
- * - * @{ - */ - -#ifndef __LEDS_A3BU_XPLAINED_H__ -#define __LEDS_A3BU_XPLAINED_H__ - - /* Includes: */ - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 0) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 1) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - PORTR.DIRSET = LEDS_ALL_LEDS; - PORTR.OUTCLR = LEDS_ALL_LEDS; - - PORTCFG.MPCMASK = LEDS_ALL_LEDS; - PORTR.PIN0CTRL = PORT_INVEN_bm; - } - - static inline void LEDs_Disable(void) - { - PORTR.DIRCLR = LEDS_ALL_LEDS; - PORTR.OUTCLR = LEDS_ALL_LEDS; - - PORTCFG.MPCMASK = 0; - PORTR.PIN0CTRL = LEDS_ALL_LEDS; - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTR_OUTSET = LEDMask; - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTR_OUTCLR = LEDMask; - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTR_OUT = (PORTR.OUT & ~LEDS_ALL_LEDS) | LEDMask; - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) - { - PORTR_OUT = (PORTR.OUT & ~LEDMask) | ActiveMask; - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PORTR_OUTTGL = LEDMask; - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return (PORTR_OUT & LEDS_ALL_LEDS); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h deleted file mode 100644 index ae5445a1f8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Buttons driver header for the Atmel XMEGA B1 Xplained. - * \copydetails Group_Buttons_B1_XPLAINED - * - * \note This file should not be included directly. It is automatically included as needed by the Buttons driver - * dispatch header located in LUFA/Drivers/Board/Buttons.h. - */ - -/** \ingroup Group_Buttons - * \defgroup Group_Buttons_B1_XPLAINED B1_XPLAINED - * \brief Board specific Buttons driver header for the Atmel XMEGA B1 Xplained. - * - * Board specific Buttons driver header for the Atmel XMEGA B1 Xplained. - * - * - * - * - * - * - * - *
NameInfoActive LevelPort Pin
BUTTONS_BUTTON1Touch CS0 ButtonLowPORTE.0
BUTTONS_BUTTON2Touch CS1 ButtonLowPORTE.1
BUTTONS_BUTTON3Touch CS2 ButtonLowPORTE.2
BUTTONS_BUTTON4Touch CS3 ButtonLowPORTE.3
- * - * @{ - */ - -#ifndef __BUTTONS_B1_XPLAINED_H__ -#define __BUTTONS_B1_XPLAINED_H__ - - /* Includes: */ - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_BUTTONS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 0) - - /** Button mask for the second button on the board. */ - #define BUTTONS_BUTTON2 (1 << 1) - - /** Button mask for the third button on the board. */ - #define BUTTONS_BUTTON3 (1 << 2) - - /** Button mask for the fourth button on the board. */ - #define BUTTONS_BUTTON4 (1 << 3) - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) - { - PORTE.OUTSET = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2 | BUTTONS_BUTTON3 | BUTTONS_BUTTON4); - - PORTCFG.MPCMASK = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2 | BUTTONS_BUTTON3 | BUTTONS_BUTTON4); - PORTE.PIN0CTRL = (PORT_INVEN_bm | PORT_OPC_PULLUP_gc); - } - - static inline void Buttons_Disable(void) - { - PORTE.OUTCLR = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2 | BUTTONS_BUTTON3 | BUTTONS_BUTTON4); - - PORTCFG.MPCMASK = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2 | BUTTONS_BUTTON3 | BUTTONS_BUTTON4); - PORTE.PIN0CTRL = 0; - } - - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) - { - return (PORTE_IN & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2 | BUTTONS_BUTTON3 | BUTTONS_BUTTON4)); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h deleted file mode 100644 index 2f58c48406..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained. - * \copydetails Group_Dataflash_A3BU_XPLAINED - * - * \note This file should not be included directly. It is automatically included as needed by the dataflash driver - * dispatch header located in LUFA/Drivers/Board/Dataflash.h. - */ - -/** \ingroup Group_Dataflash - * \defgroup Group_Dataflash_A3BU_XPLAINED A3BU_XPLAINED - * \brief Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained. - * - * Board specific Dataflash driver header for the Atmel XMEGA A3BU Xplained board. - * - * - * - * - *
NameInfoSelect PinSPI Port
DATAFLASH_CHIP1AT45DB642D (8MB)PORTD.2USARTC0 (In SPI Mode, Remapped)
- * - * @{ - */ - -#ifndef __DATAFLASH_A3BU_XPLAINED_H__ -#define __DATAFLASH_A3BU_XPLAINED_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../../../Misc/AT45DB642D.h" - #include "../../../Peripheral/SerialSPI.h" - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_DATAFLASH_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define DATAFLASH_CHIPCS_MASK (1 << 2) - #define DATAFLASH_CHIPCS_PORT PORTD - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Constant indicating the total number of dataflash ICs mounted on the selected board. */ - #define DATAFLASH_TOTALCHIPS 1 - - /** Mask for no dataflash chip selected. */ - #define DATAFLASH_NO_CHIP 0 - - /** Mask for the first dataflash chip selected. */ - #define DATAFLASH_CHIP1 (1 << 2) - - /** Internal main memory page size for the board's dataflash ICs. */ - #define DATAFLASH_PAGE_SIZE 1024 - - /** Total number of pages inside each of the board's dataflash ICs. */ - #define DATAFLASH_PAGES 8192 - - /* Inline Functions: */ - /** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. - */ - static inline void Dataflash_Init(void) - { - DATAFLASH_CHIPCS_PORT.DIRSET = DATAFLASH_CHIPCS_MASK; - - PORTCFG.MPCMASK = DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT.PIN0CTRL = PORT_INVEN_bm; - - PORTC.REMAP |= PORT_USART0_bm; - } - - /** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) - { - return SerialSPI_TransferByte(&USARTC0, Byte); - } - - /** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash. - * - * \param[in] Byte Byte of data to send to the dataflash - */ - static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SendByte(const uint8_t Byte) - { - SerialSPI_SendByte(&USARTC0, Byte); - } - - /** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash. - * - * \return Last response byte from the dataflash - */ - static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_ReceiveByte(void) - { - return SerialSPI_ReceiveByte(&USARTC0); - } - - /** Determines the currently selected dataflash chip. - * - * \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected - * or a DATAFLASH_CHIPn mask (where n is the chip number). - */ - static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Dataflash_GetSelectedChip(void) - { - return (DATAFLASH_CHIPCS_PORT.OUT & DATAFLASH_CHIPCS_MASK); - } - - /** Selects the given dataflash chip. - * - * \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is - * the chip number). - */ - static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE; - static inline void Dataflash_SelectChip(const uint8_t ChipMask) - { - DATAFLASH_CHIPCS_PORT.OUTCLR = DATAFLASH_CHIPCS_MASK; - DATAFLASH_CHIPCS_PORT.OUTSET = (ChipMask & DATAFLASH_CHIPCS_MASK); - } - - /** Deselects the current dataflash chip, so that no dataflash is selected. */ - static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE; - static inline void Dataflash_DeselectChip(void) - { - Dataflash_SelectChip(DATAFLASH_NO_CHIP); - } - - /** Selects a dataflash IC from the given page number, which should range from 0 to - * ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one - * dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside - * the total number of pages contained in the boards dataflash ICs, all dataflash ICs - * are deselected. - * - * \param[in] PageAddress Address of the page to manipulate, ranging from - * 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). - */ - static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) - { - Dataflash_DeselectChip(); - - if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) - return; - - Dataflash_SelectChip(DATAFLASH_CHIP1); - } - - /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive - * a new command. - */ - static inline void Dataflash_ToggleSelectedChipCS(void) - { - uint8_t SelectedChipMask = Dataflash_GetSelectedChip(); - - Dataflash_DeselectChip(); - Dataflash_SelectChip(SelectedChipMask); - } - - /** Spin-loops while the currently selected dataflash is busy executing a command, such as a main - * memory page program or main memory to buffer transfer. - */ - static inline void Dataflash_WaitWhileBusy(void) - { - Dataflash_ToggleSelectedChipCS(); - Dataflash_SendByte(DF_CMD_GETSTATUS); - while (!(Dataflash_ReceiveByte() & DF_STATUS_READY)); - Dataflash_ToggleSelectedChipCS(); - } - - /** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with - * dataflash commands which require a complete 24-bit address. - * - * \param[in] PageAddress Page address within the selected dataflash IC - * \param[in] BufferByte Address within the dataflash's buffer - */ - static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, - const uint16_t BufferByte) - { - Dataflash_SendByte(PageAddress >> 5); - Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); - Dataflash_SendByte(BufferByte); - } - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h deleted file mode 100644 index b4b743214a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Board specific LED driver header for the Atmel XMEGA B1 Xplained. - * \copydetails Group_LEDs_B1_XPLAINED - * - * \note This file should not be included directly. It is automatically included as needed by the LEDs driver - * dispatch header located in LUFA/Drivers/Board/LEDs.h. - */ - -/** \ingroup Group_LEDs - * \defgroup Group_LEDs_B1_XPLAINED B1_XPLAINED - * \brief Board specific LED driver header for the Atmel XMEGA B1 Xplained. - * - * Board specific LED driver header for the Atmel XMEGA B1 Xplained. - * - * - * - * - * - * - * - * - *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowLED0 LEDHighPORTB.4
LEDS_LED2YellowLED1 LEDHighPORTB.5
LEDS_LED3YellowLED2 LEDHighPORTB.6
LEDS_LED4YellowLED3 LEDHighPORTB.7
LEDS_LED5GreenUSB LEDLowPORTE.4
- * - * @{ - */ - -#ifndef __LEDS_B1_XPLAINED_H__ -#define __LEDS_B1_XPLAINED_H__ - - /* Includes: */ - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_LEDS_H) - #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define LEDS_PORTB_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) - #define LEDS_PORTE_LEDS LEDS_LED5 - - #define LEDS_PORTE_MASK_SHIFT 1 - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 4) - - /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) - - /** LED mask for the third LED on the board. */ - #define LEDS_LED3 (1 << 6) - - /** LED mask for the fourth LED on the board. */ - #define LEDS_LED4 (1 << 7) - - /** LED mask for the fifth LED on the board. */ - #define LEDS_LED5 ((1 << 4) >> LEDS_PORTE_MASK_SHIFT) - - /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4 | LEDS_LED5) - - /** LED mask for none of the board LEDs. */ - #define LEDS_NO_LEDS 0 - - /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void LEDs_Init(void) - { - PORTB.DIRSET = LEDS_PORTB_LEDS; - PORTB.OUTCLR = LEDS_PORTB_LEDS; - - PORTCFG.MPCMASK = LEDS_PORTB_LEDS; - PORTB.PIN0CTRL = PORT_INVEN_bm; - - PORTE.DIRSET = (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - PORTE.OUTCLR = (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_Disable(void) - { - PORTB.DIRCLR = LEDS_PORTB_LEDS; - PORTB.OUTCLR = LEDS_PORTB_LEDS; - - PORTCFG.MPCMASK = 0; - PORTB.PIN0CTRL = LEDS_PORTB_LEDS; - - PORTE.DIRCLR = (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - PORTE.OUTCLR = (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) - { - PORTB_OUTSET = (LEDMask & LEDS_PORTB_LEDS); - PORTE_OUTSET = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) - { - PORTB_OUTCLR = (LEDMask & LEDS_PORTB_LEDS); - PORTE_OUTCLR = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) - { - PORTB_OUTCLR = LEDS_PORTB_LEDS; - PORTE_OUTCLR = (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT); - - PORTB_OUTSET = (LEDMask & LEDS_PORTB_LEDS); - PORTE_OUTSET = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) - { - PORTB_OUTCLR = (LEDMask & LEDS_PORTB_LEDS); - PORTE_OUTCLR = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - - PORTB_OUTSET = (ActiveMask & LEDS_PORTB_LEDS); - PORTE_OUTSET = ((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) - { - PORTB_OUTTGL = (LEDMask & LEDS_PORTB_LEDS); - PORTE_OUTTGL = ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT); - } - - static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t LEDs_GetLEDs(void) - { - return ((PORTB_OUT & LEDS_PORTB_LEDS) | (PORTE_OUT & (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT))); - } - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h deleted file mode 100644 index 5c6780f332..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Command constants for the Atmel AT45DB321C Dataflash. - * \copydetails Group_AT45DB321C - */ - -/** \ingroup Group_MiscDrivers - * \defgroup Group_AT45DB321C Atmel AT45DB321C Dataflash Commands - * \brief Command constants for the Atmel AT45DB321C Dataflash. - * - * Dataflash command constants for the Atmel AT45DB321C Dataflash IC. - * - * @{ - */ - -#ifndef __AT45DB321C_CMDS_H__ -#define __AT45DB321C_CMDS_H__ - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name Dataflash Status Values */ - //@{ - #define DF_STATUS_READY (1 << 7) - #define DF_STATUS_COMPMISMATCH (1 << 6) - #define DF_STATUS_SECTORPROTECTION_ON (1 << 1) - //@} - - /** \name Dataflash Commands */ - //@{ - #define DF_CMD_GETSTATUS 0xD7 - - #define DF_CMD_MAINMEMTOBUFF1 0x53 - #define DF_CMD_MAINMEMTOBUFF2 0x55 - #define DF_CMD_MAINMEMTOBUFF1COMP 0x60 - #define DF_CMD_MAINMEMTOBUFF2COMP 0x61 - #define DF_CMD_AUTOREWRITEBUFF1 0x58 - #define DF_CMD_AUTOREWRITEBUFF2 0x59 - - #define DF_CMD_MAINMEMPAGEREAD 0xD2 - #define DF_CMD_CONTARRAYREAD_LF 0xE8 - #define DF_CMD_BUFF1READ_LF 0xD4 - #define DF_CMD_BUFF2READ_LF 0xD6 - - #define DF_CMD_BUFF1WRITE 0x84 - #define DF_CMD_BUFF2WRITE 0x87 - #define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83 - #define DF_CMD_BUFF2TOMAINMEMWITHERASE 0x86 - #define DF_CMD_BUFF1TOMAINMEM 0x88 - #define DF_CMD_BUFF2TOMAINMEM 0x89 - #define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82 - #define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85 - - #define DF_CMD_PAGEERASE 0x81 - #define DF_CMD_BLOCKERASE 0x50 - - #define DF_CMD_SECTORPROTECTIONOFF ((char[]){0x3D, 0x2A, 0x7F, 0xCF}) - #define DF_CMD_SECTORPROTECTIONOFF_BYTE1 0x3D - #define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A - #define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F - #define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0xCF - - #define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F - //@} - - /** Manufacturer code for Atmel Corporation, returned by Atmel Dataflash ICs in response to the \c DF_CMD_READMANUFACTURERDEVICEINFO command. */ - #define DF_MANUFACTURER_ATMEL 0x1F - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h deleted file mode 100644 index cbd15d63ff..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Command constants for the Atmel AT45DB642D Dataflash. - * \copydetails Group_AT45DB642D - */ - -/** \ingroup Group_MiscDrivers - * \defgroup Group_AT45DB642D Atmel AT45DB642D Dataflash Commands - * \brief Command constants for the Atmel AT45DB642D Dataflash. - * - * Dataflash command constants for the Atmel AT45DB642D Dataflash IC. - * - * @{ - */ - -#ifndef __AT45DB642D_CMDS_H__ -#define __AT45DB642D_CMDS_H__ - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name Dataflash Status Values */ - //@{ - #define DF_STATUS_READY (1 << 7) - #define DF_STATUS_COMPMISMATCH (1 << 6) - #define DF_STATUS_SECTORPROTECTION_ON (1 << 1) - #define DF_STATUS_BINARYPAGESIZE_ON (1 << 0) - //@} - - /** \name Dataflash Commands */ - //@{ - #define DF_CMD_GETSTATUS 0xD7 - #define DF_CMD_POWERDOWN 0xB9 - #define DF_CMD_WAKEUP 0xAB - - #define DF_CMD_MAINMEMTOBUFF1 0x53 - #define DF_CMD_MAINMEMTOBUFF2 0x55 - #define DF_CMD_MAINMEMTOBUFF1COMP 0x60 - #define DF_CMD_MAINMEMTOBUFF2COMP 0x61 - #define DF_CMD_AUTOREWRITEBUFF1 0x58 - #define DF_CMD_AUTOREWRITEBUFF2 0x59 - - #define DF_CMD_MAINMEMPAGEREAD 0xD2 - #define DF_CMD_CONTARRAYREAD_LF 0x03 - #define DF_CMD_BUFF1READ_LF 0xD1 - #define DF_CMD_BUFF2READ_LF 0xD3 - - #define DF_CMD_BUFF1WRITE 0x84 - #define DF_CMD_BUFF2WRITE 0x87 - #define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83 - #define DF_CMD_BUFF2TOMAINMEMWITHERASE 0x86 - #define DF_CMD_BUFF1TOMAINMEM 0x88 - #define DF_CMD_BUFF2TOMAINMEM 0x89 - #define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82 - #define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85 - - #define DF_CMD_PAGEERASE 0x81 - #define DF_CMD_BLOCKERASE 0x50 - #define DF_CMD_SECTORERASE 0x7C - - #define DF_CMD_CHIPERASE ((char[]){0xC7, 0x94, 0x80, 0x9A}) - #define DF_CMD_CHIPERASE_BYTE1 0xC7 - #define DF_CMD_CHIPERASE_BYTE2 0x94 - #define DF_CMD_CHIPERASE_BYTE3 0x80 - #define DF_CMD_CHIPERASE_BYTE4 0x9A - - #define DF_CMD_SECTORPROTECTIONOFF ((char[]){0x3D, 0x2A, 0x7F, 0x9A}) - #define DF_CMD_SECTORPROTECTIONOFF_BYTE1 0x3D - #define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A - #define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F - #define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0x9A - - #define DF_CMD_BINARYPAGESIZEMODEON ((char[]){0x3D, 0x2A, 0x80, 0xA6}) - #define DF_CMD_BINARYPAGESIZEMODEON_BYTE1 0x3D - #define DF_CMD_BINARYPAGESIZEMODEON_BYTE2 0x2A - #define DF_CMD_BINARYPAGESIZEMODEON_BYTE3 0x80 - #define DF_CMD_BINARYPAGESIZEMODEON_BYTE4 0xA6 - - #define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F - //@} - - /** Manufacturer code for Atmel Corporation, returned by Atmel Dataflash ICs in response to the \c DF_CMD_READMANUFACTURERDEVICEINFO command. */ - #define DF_MANUFACTURER_ATMEL 0x1F - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h deleted file mode 100644 index 6d0f60ffa8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h +++ /dev/null @@ -1,303 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Lightweight ring (circular) buffer, for fast insertion/deletion of bytes. - * - * Lightweight ring buffer, for fast insertion/deletion. Multiple buffers can be created of - * different sizes to suit different needs. - * - * Note that for each buffer, insertion and removal operations may occur at the same time (via - * a multi-threaded ISR based system) however the same kind of operation (two or more insertions - * or deletions) must not overlap. If there is possibility of two or more of the same kind of - * operating occurring at the same point in time, atomic (mutex) locking should be used. - */ - -/** \ingroup Group_MiscDrivers - * \defgroup Group_RingBuff Generic Byte Ring Buffer - LUFA/Drivers/Misc/RingBuffer.h - * \brief Lightweight ring buffer, for fast insertion/deletion of bytes. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Lightweight ring buffer, for fast insertion/deletion. Multiple buffers can be created of - * different sizes to suit different needs. - * - * Note that for each buffer, insertion and removal operations may occur at the same time (via - * a multi-threaded ISR based system) however the same kind of operation (two or more insertions - * or deletions) must not overlap. If there is possibility of two or more of the same kind of - * operating occurring at the same point in time, atomic (mutex) locking should be used. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Create the buffer structure and its underlying storage array - * RingBuffer_t Buffer; - * uint8_t BufferData[128]; - * - * // Initialize the buffer with the created storage array - * RingBuffer_InitBuffer(&Buffer, BufferData, sizeof(BufferData)); - * - * // Insert some data into the buffer - * RingBuffer_Insert(Buffer, 'H'); - * RingBuffer_Insert(Buffer, 'E'); - * RingBuffer_Insert(Buffer, 'L'); - * RingBuffer_Insert(Buffer, 'L'); - * RingBuffer_Insert(Buffer, 'O'); - * - * // Cache the number of stored bytes in the buffer - * uint16_t BufferCount = RingBuffer_GetCount(&Buffer); - * - * // Printer stored data length - * printf("Buffer Length: %d, Buffer Data: \r\n", BufferCount); - * - * // Print contents of the buffer one character at a time - * while (BufferCount--) - * putc(RingBuffer_Remove(&Buffer)); - * \endcode - * - * @{ - */ - -#ifndef __RING_BUFFER_H__ -#define __RING_BUFFER_H__ - - /* Includes: */ - #include "../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Type Defines: */ - /** \brief Ring Buffer Management Structure. - * - * Type define for a new ring buffer object. Buffers should be initialized via a call to - * \ref RingBuffer_InitBuffer() before use. - */ - typedef struct - { - uint8_t* In; /**< Current storage location in the circular buffer. */ - uint8_t* Out; /**< Current retrieval location in the circular buffer. */ - uint8_t* Start; /**< Pointer to the start of the buffer's underlying storage array. */ - uint8_t* End; /**< Pointer to the end of the buffer's underlying storage array. */ - uint16_t Size; /**< Size of the buffer's underlying storage array. */ - uint16_t Count; /**< Number of bytes currently stored in the buffer. */ - } RingBuffer_t; - - /* Inline Functions: */ - /** Initializes a ring buffer ready for use. Buffers must be initialized via this function - * before any operations are called upon them. Already initialized buffers may be reset - * by re-initializing them using this function. - * - * \param[out] Buffer Pointer to a ring buffer structure to initialize. - * \param[out] DataPtr Pointer to a global array that will hold the data stored into the ring buffer. - * \param[out] Size Maximum number of bytes that can be stored in the underlying data array. - */ - static inline void RingBuffer_InitBuffer(RingBuffer_t* Buffer, uint8_t* const DataPtr, const uint16_t Size) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - static inline void RingBuffer_InitBuffer(RingBuffer_t* Buffer, uint8_t* const DataPtr, const uint16_t Size) - { - GCC_FORCE_POINTER_ACCESS(Buffer); - - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - Buffer->In = DataPtr; - Buffer->Out = DataPtr; - Buffer->Start = &DataPtr[0]; - Buffer->End = &DataPtr[Size]; - Buffer->Size = Size; - Buffer->Count = 0; - - SetGlobalInterruptMask(CurrentGlobalInt); - } - - /** Retrieves the current number of bytes stored in a particular buffer. This value is computed - * by entering an atomic lock on the buffer, so that the buffer cannot be modified while the - * computation takes place. This value should be cached when reading out the contents of the buffer, - * so that as small a time as possible is spent in an atomic lock. - * - * \note The value returned by this function is guaranteed to only be the minimum number of bytes - * stored in the given buffer; this value may change as other threads write new data, thus - * the returned number should be used only to determine how many successive reads may safely - * be performed on the buffer. - * - * \param[in] Buffer Pointer to a ring buffer structure whose count is to be computed. - * - * \return Number of bytes currently stored in the buffer. - */ - static inline uint16_t RingBuffer_GetCount(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static inline uint16_t RingBuffer_GetCount(RingBuffer_t* const Buffer) - { - uint16_t Count; - - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - Count = Buffer->Count; - - SetGlobalInterruptMask(CurrentGlobalInt); - return Count; - } - - /** Retrieves the free space in a particular buffer. This value is computed by entering an atomic lock - * on the buffer, so that the buffer cannot be modified while the computation takes place. - * - * \note The value returned by this function is guaranteed to only be the maximum number of bytes - * free in the given buffer; this value may change as other threads write new data, thus - * the returned number should be used only to determine how many successive writes may safely - * be performed on the buffer when there is a single writer thread. - * - * \param[in] Buffer Pointer to a ring buffer structure whose free count is to be computed. - * - * \return Number of free bytes in the buffer. - */ - static inline uint16_t RingBuffer_GetFreeCount(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static inline uint16_t RingBuffer_GetFreeCount(RingBuffer_t* const Buffer) - { - return (Buffer->Size - RingBuffer_GetCount(Buffer)); - } - - /** Atomically determines if the specified ring buffer contains any data. This should - * be tested before removing data from the buffer, to ensure that the buffer does not - * underflow. - * - * If the data is to be removed in a loop, store the total number of bytes stored in the - * buffer (via a call to the \ref RingBuffer_GetCount() function) in a temporary variable - * to reduce the time spent in atomicity locks. - * - * \param[in,out] Buffer Pointer to a ring buffer structure to insert into. - * - * \return Boolean \c true if the buffer contains no free space, false otherwise. - */ - static inline bool RingBuffer_IsEmpty(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static inline bool RingBuffer_IsEmpty(RingBuffer_t* const Buffer) - { - return (RingBuffer_GetCount(Buffer) == 0); - } - - /** Atomically determines if the specified ring buffer contains any free space. This should - * be tested before storing data to the buffer, to ensure that no data is lost due to a - * buffer overrun. - * - * \param[in,out] Buffer Pointer to a ring buffer structure to insert into. - * - * \return Boolean \c true if the buffer contains no free space, false otherwise. - */ - static inline bool RingBuffer_IsFull(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static inline bool RingBuffer_IsFull(RingBuffer_t* const Buffer) - { - return (RingBuffer_GetCount(Buffer) == Buffer->Size); - } - - /** Inserts an element into the ring buffer. - * - * \warning Only one execution thread (main program thread or an ISR) may insert into a single buffer - * otherwise data corruption may occur. Insertion and removal may occur from different execution - * threads. - * - * \param[in,out] Buffer Pointer to a ring buffer structure to insert into. - * \param[in] Data Data element to insert into the buffer. - */ - static inline void RingBuffer_Insert(RingBuffer_t* Buffer, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); - static inline void RingBuffer_Insert(RingBuffer_t* Buffer, const uint8_t Data) - { - GCC_FORCE_POINTER_ACCESS(Buffer); - - *Buffer->In = Data; - - if (++Buffer->In == Buffer->End) - Buffer->In = Buffer->Start; - - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - Buffer->Count++; - - SetGlobalInterruptMask(CurrentGlobalInt); - } - - /** Removes an element from the ring buffer. - * - * \warning Only one execution thread (main program thread or an ISR) may remove from a single buffer - * otherwise data corruption may occur. Insertion and removal may occur from different execution - * threads. - * - * \param[in,out] Buffer Pointer to a ring buffer structure to retrieve from. - * - * \return Next data element stored in the buffer. - */ - static inline uint8_t RingBuffer_Remove(RingBuffer_t* Buffer) ATTR_NON_NULL_PTR_ARG(1); - static inline uint8_t RingBuffer_Remove(RingBuffer_t* Buffer) - { - GCC_FORCE_POINTER_ACCESS(Buffer); - - uint8_t Data = *Buffer->Out; - - if (++Buffer->Out == Buffer->End) - Buffer->Out = Buffer->Start; - - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - Buffer->Count--; - - SetGlobalInterruptMask(CurrentGlobalInt); - - return Data; - } - - /** Returns the next element stored in the ring buffer, without removing it. - * - * \param[in,out] Buffer Pointer to a ring buffer structure to retrieve from. - * - * \return Next data element stored in the buffer. - */ - static inline uint8_t RingBuffer_Peek(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static inline uint8_t RingBuffer_Peek(RingBuffer_t* const Buffer) - { - return *Buffer->Out; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h deleted file mode 100644 index 2f71a84b2a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief ANSI terminal special escape code macros. - * - * ANSI terminal compatible escape sequences. These escape sequences are designed to be concatenated with existing - * strings to modify their display on a compatible terminal application. - */ - -/** \ingroup Group_MiscDrivers - * \defgroup Group_Terminal ANSI Terminal Escape Codes - LUFA/Drivers/Misc/TerminalCodes.h - * \brief ANSI terminal special escape code macros. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Escape code macros for ANSI compliant text terminals. - * - * \note If desired, the macro \c DISABLE_TERMINAL_CODES can be defined in the project makefile and passed to the GCC - * compiler via the -D switch to disable the terminal codes without modifying the source, for use with non - * compatible terminals (any terminal codes then equate to empty strings). - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * printf("Normal String, " - * ESC_BOLD_ON "Bold String, " - * ESC_UNDERLINE_ON "Bold and Underlined String" - * ESC_RESET ESC_FG_BLUE ESC_BG_YELLOW "Normal Blue-on-Yellow String"); - * \endcode - * - * @{ - */ - -#ifndef __TERMINALCODES_H__ -#define __TERMINALCODES_H__ - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if !defined(DISABLE_TERMINAL_CODES) - /** Creates an ANSI escape sequence with the specified payload. - * - * \param[in] EscapeSeq Payload to encode as an ANSI escape sequence, a \c ESC_* mask. - */ - #define ANSI_ESCAPE_SEQUENCE(EscapeSeq) "\33[" EscapeSeq - #else - #define ANSI_ESCAPE_SEQUENCE(EscapeSeq) - #endif - - /** \name Text Display Modifier Control Sequences */ - //@{ - /** Turns on bold so that any following text is printed to the terminal in bold. */ - #define ESC_BOLD_ON ANSI_ESCAPE_SEQUENCE("1m") - - /** Turns on italics so that any following text is printed to the terminal in italics. */ - #define ESC_ITALICS_ON ANSI_ESCAPE_SEQUENCE("3m") - - /** Turns on underline so that any following text is printed to the terminal underlined. */ - #define ESC_UNDERLINE_ON ANSI_ESCAPE_SEQUENCE("4m") - - /** Turns on inverse so that any following text is printed to the terminal in inverted colours. */ - #define ESC_INVERSE_ON ANSI_ESCAPE_SEQUENCE("7m") - - /** Turns on strikethrough so that any following text is printed to the terminal with a line through the - * center. - */ - #define ESC_STRIKETHROUGH_ON ANSI_ESCAPE_SEQUENCE("9m") - - /** Turns off bold so that any following text is printed to the terminal in non bold. */ - #define ESC_BOLD_OFF ANSI_ESCAPE_SEQUENCE("22m") - - /** Turns off italics so that any following text is printed to the terminal in non italics. */ - #define ESC_ITALICS_OFF ANSI_ESCAPE_SEQUENCE("23m") - - /** Turns off underline so that any following text is printed to the terminal non underlined. */ - #define ESC_UNDERLINE_OFF ANSI_ESCAPE_SEQUENCE("24m") - - /** Turns off inverse so that any following text is printed to the terminal in non inverted colours. */ - #define ESC_INVERSE_OFF ANSI_ESCAPE_SEQUENCE("27m") - - /** Turns off strikethrough so that any following text is printed to the terminal without a line through - * the center. - */ - #define ESC_STRIKETHROUGH_OFF ANSI_ESCAPE_SEQUENCE("29m") - //@} - - /** \name Text Colour Control Sequences */ - //@{ - /** Sets the foreground (text) colour to black. */ - #define ESC_FG_BLACK ANSI_ESCAPE_SEQUENCE("30m") - - /** Sets the foreground (text) colour to red. */ - #define ESC_FG_RED ANSI_ESCAPE_SEQUENCE("31m") - - /** Sets the foreground (text) colour to green. */ - #define ESC_FG_GREEN ANSI_ESCAPE_SEQUENCE("32m") - - /** Sets the foreground (text) colour to yellow. */ - #define ESC_FG_YELLOW ANSI_ESCAPE_SEQUENCE("33m") - - /** Sets the foreground (text) colour to blue. */ - #define ESC_FG_BLUE ANSI_ESCAPE_SEQUENCE("34m") - - /** Sets the foreground (text) colour to magenta. */ - #define ESC_FG_MAGENTA ANSI_ESCAPE_SEQUENCE("35m") - - /** Sets the foreground (text) colour to cyan. */ - #define ESC_FG_CYAN ANSI_ESCAPE_SEQUENCE("36m") - - /** Sets the foreground (text) colour to white. */ - #define ESC_FG_WHITE ANSI_ESCAPE_SEQUENCE("37m") - - /** Sets the foreground (text) colour to the terminal's default. */ - #define ESC_FG_DEFAULT ANSI_ESCAPE_SEQUENCE("39m") - - /** Sets the text background colour to black. */ - #define ESC_BG_BLACK ANSI_ESCAPE_SEQUENCE("40m") - - /** Sets the text background colour to red. */ - #define ESC_BG_RED ANSI_ESCAPE_SEQUENCE("41m") - - /** Sets the text background colour to green. */ - #define ESC_BG_GREEN ANSI_ESCAPE_SEQUENCE("42m") - - /** Sets the text background colour to yellow. */ - #define ESC_BG_YELLOW ANSI_ESCAPE_SEQUENCE("43m") - - /** Sets the text background colour to blue. */ - #define ESC_BG_BLUE ANSI_ESCAPE_SEQUENCE("44m") - - /** Sets the text background colour to magenta. */ - #define ESC_BG_MAGENTA ANSI_ESCAPE_SEQUENCE("45m") - - /** Sets the text background colour to cyan. */ - #define ESC_BG_CYAN ANSI_ESCAPE_SEQUENCE("46m") - - /** Sets the text background colour to white. */ - #define ESC_BG_WHITE ANSI_ESCAPE_SEQUENCE("47m") - - /** Sets the text background colour to the terminal's default. */ - #define ESC_BG_DEFAULT ANSI_ESCAPE_SEQUENCE("49m") - //@} - - /** \name Cursor Positioning Control Sequences */ - //@{ - /** Saves the current cursor position so that it may be restored with \ref ESC_CURSOR_POS_RESTORE. */ - #define ESC_CURSOR_POS_SAVE ANSI_ESCAPE_SEQUENCE("s") - - /** Restores the cursor position to the last position saved with \ref ESC_CURSOR_POS_SAVE. */ - #define ESC_CURSOR_POS_RESTORE ANSI_ESCAPE_SEQUENCE("u") - - /** Sets the cursor position to the given line and column. - * - * \param[in] Line Line number to position the cursor at. - * \param[in] Column Column number to position the cursor at. - */ - #define ESC_CURSOR_POS(Line, Column) ANSI_ESCAPE_SEQUENCE(#Line ";" #Column "H") - - /** Moves the cursor up the given number of lines. - * - * \param[in] Lines Number of lines to move the cursor position - */ - #define ESC_CURSOR_UP(Lines) ANSI_ESCAPE_SEQUENCE(#Lines "A") - - /** Moves the cursor down the given number of lines. - * - * \param[in] Lines Number of lines to move the cursor position - */ - #define ESC_CURSOR_DOWN(Lines) ANSI_ESCAPE_SEQUENCE(#Lines "B") - - /** Moves the cursor to the right the given number of columns. - * - * \param[in] Columns Number of columns to move the cursor position - */ - #define ESC_CURSOR_FORWARD(Columns) ANSI_ESCAPE_SEQUENCE(#Columns "C") - - /** Moves the cursor to the left the given number of columns. - * - * \param[in] Columns Number of columns to move the cursor position - */ - #define ESC_CURSOR_BACKWARD(Columns) ANSI_ESCAPE_SEQUENCE(#Columns "D") - //@} - - /** \name Miscellaneous Control Sequences */ - //@{ - /** Resets any escape sequence modifiers back to their defaults. */ - #define ESC_RESET ANSI_ESCAPE_SEQUENCE("0m") - - /** Erases the entire display, returning the cursor to the top left. */ - #define ESC_ERASE_DISPLAY ANSI_ESCAPE_SEQUENCE("2J") - - /** Erases the current line, returning the cursor to the far left. */ - #define ESC_ERASE_LINE ANSI_ESCAPE_SEQUENCE("K") - //@} - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h deleted file mode 100644 index ebce11b330..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Hardware Analogue-to-Digital converter driver. - * - * This file is the master dispatch header file for the device-specific ADC driver, for microcontrollers - * containing an ADC. - * - * User code should include this file, which will in turn include the correct ADC driver header file for the - * currently selected architecture and microcontroller model. - */ - -/** \ingroup Group_PeripheralDrivers - * \defgroup Group_ADC ADC Driver - LUFA/Drivers/Peripheral/ADC.h - * \brief Hardware Analogue-to-Digital converter driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Hardware ADC driver. This module provides an easy to use driver for the hardware ADC - * present on many microcontrollers, for the conversion of analogue signals into the - * digital domain. - * - * \note The exact API for this driver may vary depending on the target used - see - * individual target module documentation for the API specific to your target processor. - */ - -#ifndef __ADC_H__ -#define __ADC_H__ - - /* Macros: */ - #define __INCLUDE_FROM_ADC_H - - /* Includes: */ - #include "../../Common/Common.h" - - /* Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/ADC_AVR8.h" - #else - #error The ADC peripheral driver is not currently available for your selected architecture. - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h deleted file mode 100644 index c002f79f7b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h +++ /dev/null @@ -1,456 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief ADC Peripheral Driver (AVR8) - * - * On-chip Analogue-to-Digital converter (ADC) driver for supported U4, U6 and U7 model AVRs that contain an ADC - * peripheral internally. - * - * \note This file should not be included directly. It is automatically included as needed by the ADC driver - * dispatch header located in LUFA/Drivers/Peripheral/ADC.h. - */ - -/** \ingroup Group_ADC - * \defgroup Group_ADC_AVR8 ADC Peripheral Driver (AVR8) - * - * \section Sec_ModDescription Module Description - * On-chip Analogue-to-Digital converter (ADC) driver for supported U4, U6 and U7 model AVRs that contain an ADC - * peripheral internally. - * - * \note This file should not be included directly. It is automatically included as needed by the ADC driver - * dispatch header located in LUFA/Drivers/Peripheral/ADC.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the ADC driver before first use - * ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32); - * - * // Must setup the ADC channel to read beforehand - * ADC_SetupChannel(1); - * - * // Perform a single conversion of the ADC channel 1 - * ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_CHANNEL1); - * printf("Conversion Result: %d\r\n", ADC_GetResult()); - * - * // Start reading ADC channel 1 in free running (continuous conversion) mode - * ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_CHANNEL1); - * for (;;) - * { - * while (!(ADC_IsReadingComplete())) {}; - * printf("Conversion Result: %d\r\n", ADC_GetResult()); - * } - * \endcode - * - * @{ - */ - -#ifndef __ADC_AVR8_H__ -#define __ADC_AVR8_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_ADC_H) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/ADC.h instead. - #endif - - #if !(defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \ - defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \ - defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \ - defined(__AVR_ATmega32U6__)) - #error The ADC peripheral driver is not currently available for your selected microcontroller model. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define _ADC_GET_MUX_MASK2(y) ADC_CHANNEL ## y - #define _ADC_GET_MUX_MASK(y) _ADC_GET_MUX_MASK2(y) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name ADC Reference Configuration Masks */ - //@{ - /** Reference mask, for using the voltage present at the AVR's AREF pin for the ADC reference. */ - #define ADC_REFERENCE_AREF 0 - - /** Reference mask, for using the voltage present at the AVR's AVCC pin for the ADC reference. */ - #define ADC_REFERENCE_AVCC (1 << REFS0) - - /** Reference mask, for using the internally generated 2.56V reference voltage as the ADC reference. */ - #define ADC_REFERENCE_INT2560MV ((1 << REFS1) | (1 << REFS0)) - //@} - - /** \name ADC Result Adjustment Configuration Masks */ - //@{ - /** Left-adjusts the 10-bit ADC result, so that the upper 8 bits of the value returned by the - * \ref ADC_GetResult() macro contain the 8 most significant bits of the result. - */ - #define ADC_LEFT_ADJUSTED (1 << ADLAR) - - /** Right-adjusts the 10-bit ADC result, so that the lower 8 bits of the value returned by the - * \ref ADC_GetResult() macro contain the 8 least significant bits of the result. - */ - #define ADC_RIGHT_ADJUSTED (0 << ADLAR) - //@} - - /** \name ADC Mode Configuration Masks */ - //@{ - /** Sets the ADC mode to free running, so that conversions take place continuously as fast as the ADC - * is capable of at the given input clock speed. - */ - #define ADC_FREE_RUNNING (1 << ADATE) - - /** Sets the ADC mode to single conversion, so that only a single conversion will take place before - * the ADC returns to idle. - */ - #define ADC_SINGLE_CONVERSION (0 << ADATE) - //@} - - /** \name ADC Prescaler Configuration Masks */ - //@{ - /** Sets the ADC input clock to prescale by a factor of 2 the AVR's system clock. */ - #define ADC_PRESCALE_2 (1 << ADPS0) - - /** Sets the ADC input clock to prescale by a factor of 4 the AVR's system clock. */ - #define ADC_PRESCALE_4 (1 << ADPS1) - - /** Sets the ADC input clock to prescale by a factor of 8 the AVR's system clock. */ - #define ADC_PRESCALE_8 ((1 << ADPS0) | (1 << ADPS1)) - - /** Sets the ADC input clock to prescale by a factor of 16 the AVR's system clock. */ - #define ADC_PRESCALE_16 (1 << ADPS2) - - /** Sets the ADC input clock to prescale by a factor of 32 the AVR's system clock. */ - #define ADC_PRESCALE_32 ((1 << ADPS2) | (1 << ADPS0)) - - /** Sets the ADC input clock to prescale by a factor of 64 the AVR's system clock. */ - #define ADC_PRESCALE_64 ((1 << ADPS2) | (1 << ADPS1)) - - /** Sets the ADC input clock to prescale by a factor of 128 the AVR's system clock. */ - #define ADC_PRESCALE_128 ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)) - //@} - - /** \name ADC MUX Masks */ - //@{ - /** MUX mask define for the ADC0 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ - #define ADC_CHANNEL0 (0x00 << MUX0) - - /** MUX mask define for the ADC1 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ - #define ADC_CHANNEL1 (0x01 << MUX0) - - #if (!(defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) || defined(__DOXYGEN__)) - /** MUX mask define for the ADC2 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL2 (0x02 << MUX0) - - /** MUX mask define for the ADC3 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL3 (0x03 << MUX0) - #endif - - /** MUX mask define for the ADC4 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ - #define ADC_CHANNEL4 (0x04 << MUX0) - - /** MUX mask define for the ADC5 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ - #define ADC_CHANNEL5 (0x05 << MUX0) - - /** MUX mask define for the ADC6 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ - #define ADC_CHANNEL6 (0x06 << MUX0) - - /** MUX mask define for the ADC7 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. */ - #define ADC_CHANNEL7 (0x07 << MUX0) - - #if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__)) - /** MUX mask define for the ADC8 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL8 ((1 << 8) | (0x00 << MUX0)) - - /** MUX mask define for the ADC9 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL9 ((1 << 8) | (0x01 << MUX0)) - - /** MUX mask define for the ADC10 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL10 ((1 << 8) | (0x02 << MUX0)) - - /** MUX mask define for the ADC11 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL11 ((1 << 8) | (0x03 << MUX0)) - - /** MUX mask define for the ADC12 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL12 ((1 << 8) | (0x04 << MUX0)) - - /** MUX mask define for the ADC13 channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_CHANNEL13 ((1 << 8) | (0x05 << MUX0)) - - /** MUX mask define for the internal temperature sensor channel of the ADC. See \ref ADC_StartReading() and - * \ref ADC_GetChannelReading(). - * - * \note Not available on all AVR models. - */ - #define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0)) - #endif - - /** MUX mask define for the internal 1.1V band-gap channel of the ADC. See \ref ADC_StartReading() and \ref ADC_GetChannelReading(). */ - #define ADC_1100MV_BANDGAP (0x1E << MUX0) - - /** Retrieves the ADC MUX mask for the given ADC channel number. - * - * \attention This macro will only work correctly on channel numbers that are compile-time - * constants defined by the preprocessor. - * - * \param[in] Channel Index of the ADC channel whose MUX mask is to be retrieved. - */ - #define ADC_GET_CHANNEL_MASK(Channel) _ADC_GET_MUX_MASK(Channel) - //@} - - /* Inline Functions: */ - /** Configures the given ADC channel, ready for ADC conversions. This function sets the - * associated port pin as an input and disables the digital portion of the I/O to reduce - * power consumption. - * - * \note This must only be called for ADC channels with are connected to a physical port - * pin of the AVR, denoted by its special alternative function ADCx. - * - * \warning The channel number must be specified as an integer, and not a \c ADC_CHANNEL* mask. - * - * \param[in] ChannelIndex ADC channel number to set up for conversions. - */ - static inline void ADC_SetupChannel(const uint8_t ChannelIndex) - { - #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \ - defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \ - defined(__AVR_ATmega32U6__)) - DDRF &= ~(1 << ChannelIndex); - DIDR0 |= (1 << ChannelIndex); - #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) - if (ChannelIndex < 8) - { - DDRF &= ~(1 << ChannelIndex); - DIDR0 |= (1 << ChannelIndex); - } - else if (ChannelIndex == 8) - { - DDRD &= ~(1 << 4); - DIDR2 |= (1 << 0); - } - else if (ChannelIndex < 11) - { - DDRD &= ~(1 << (ChannelIndex - 3)); - DIDR2 |= (1 << (ChannelIndex - 8)); - } - else - { - DDRB &= ~(1 << (ChannelIndex - 7)); - DIDR2 |= (1 << (ChannelIndex - 8)); - } - #endif - } - - /** De-configures the given ADC channel, re-enabling digital I/O mode instead of analog. This - * function sets the associated port pin as an input and re-enabled the digital portion of - * the I/O. - * - * \note This must only be called for ADC channels with are connected to a physical port - * pin of the AVR, denoted by its special alternative function ADCx. - * - * \warning The channel number must be specified as an integer, and not a \c ADC_CHANNEL* mask. - * - * \param[in] ChannelIndex ADC channel number to set up for conversions. - */ - static inline void ADC_DisableChannel(const uint8_t ChannelIndex) - { - #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \ - defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \ - defined(__AVR_ATmega32U6__)) - DDRF &= ~(1 << ChannelIndex); - DIDR0 &= ~(1 << ChannelIndex); - #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) - if (ChannelIndex < 8) - { - DDRF &= ~(1 << ChannelIndex); - DIDR0 &= ~(1 << ChannelIndex); - } - else if (ChannelIndex == 8) - { - DDRD &= ~(1 << 4); - DIDR2 &= ~(1 << 0); - } - else if (ChannelIndex < 11) - { - DDRD &= ~(1 << (ChannelIndex - 3)); - DIDR2 &= ~(1 << (ChannelIndex - 8)); - } - else - { - DDRB &= ~(1 << (ChannelIndex - 7)); - DIDR2 &= ~(1 << (ChannelIndex - 8)); - } - #endif - } - - /** Starts the reading of the given channel, but does not wait until the conversion has completed. - * Once executed, the conversion status can be determined via the \ref ADC_IsReadingComplete() macro and - * the result read via the \ref ADC_GetResult() macro. - * - * If the ADC has been initialized in free running mode, calling this function once will begin the repeated - * conversions. If the ADC is in single conversion mode (or the channel to convert from is to be changed), - * this function must be called each time a conversion is to take place. - * - * \param[in] MUXMask ADC channel mask, reference mask and adjustment mask. - */ - static inline void ADC_StartReading(const uint16_t MUXMask) - { - ADMUX = MUXMask; - - #if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__)) - if (MUXMask & (1 << 8)) - ADCSRB |= (1 << MUX5); - else - ADCSRB &= ~(1 << MUX5); - #endif - - ADCSRA |= (1 << ADSC); - } - - /** Indicates if the current ADC conversion is completed, or still in progress. - * - * \return Boolean false if the reading is still taking place, or true if the conversion is - * complete and ready to be read out with \ref ADC_GetResult(). - */ - static inline bool ADC_IsReadingComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool ADC_IsReadingComplete(void) - { - return ((ADCSRA & (1 << ADIF)) ? true : false); - } - - /** Retrieves the conversion value of the last completed ADC conversion and clears the reading - * completion flag. - * - * \return The result of the last ADC conversion as an unsigned value. - */ - static inline uint16_t ADC_GetResult(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t ADC_GetResult(void) - { - ADCSRA |= (1 << ADIF); - return ADC; - } - - /** Performs a complete single reading from channel, including a polling spin-loop to wait for the - * conversion to complete, and the returning of the converted value. - * - * \note For free running mode, the automated conversions should be initialized with a single call - * to \ref ADC_StartReading() to select the channel and begin the automated conversions, and - * the results read directly from the \ref ADC_GetResult() instead to reduce overhead. - * - * \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask. - * - * \return Converted ADC result for the given ADC channel. - */ - static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) ATTR_WARN_UNUSED_RESULT; - static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) - { - ADC_StartReading(MUXMask); - - while (!(ADC_IsReadingComplete())); - - return ADC_GetResult(); - } - - /** Initializes the ADC, ready for conversions. This must be called before any other ADC operations. - * The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and - * prescaler masks. - * - * \param[in] Mode Mask of ADC prescale and mode settings. - */ - static inline void ADC_Init(const uint8_t Mode) ATTR_ALWAYS_INLINE; - static inline void ADC_Init(const uint8_t Mode) - { - ADCSRA = ((1 << ADEN) | Mode); - } - - /** Turns off the ADC. If this is called, any further ADC operations will require a call to - * \ref ADC_Init() before the ADC can be used again. - */ - static inline void ADC_Disable(void) ATTR_ALWAYS_INLINE; - static inline void ADC_Disable(void) - { - ADCSRA = 0; - } - - /** Indicates if the ADC is currently enabled. - * - * \return Boolean \c true if the ADC subsystem is currently enabled, \c false otherwise. - */ - static inline bool ADC_GetStatus(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool ADC_GetStatus(void) - { - return ((ADCSRA & (1 << ADEN)) ? true : false); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h deleted file mode 100644 index dde3ec5a7c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief SPI Peripheral Driver (AVR8) - * - * On-chip SPI driver for the 8-bit AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI driver - * dispatch header located in LUFA/Drivers/Peripheral/SPI.h. - */ - -/** \ingroup Group_SPI - * \defgroup Group_SPI_AVR8 SPI Peripheral Driver (AVR8) - * - * \section Sec_ModDescription Module Description - * Driver for the hardware SPI port available on most 8-bit AVR microcontroller models. This - * module provides an easy to use driver for the setup and transfer of data over the - * AVR's SPI port. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI driver - * dispatch header located in LUFA/Drivers/Peripheral/SPI.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the SPI driver before first use - * SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | - * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); - * - * // Send several bytes, ignoring the returned data - * SPI_SendByte(0x01); - * SPI_SendByte(0x02); - * SPI_SendByte(0x03); - * - * // Receive several bytes, sending a dummy 0x00 byte each time - * uint8_t Byte1 = SPI_ReceiveByte(); - * uint8_t Byte2 = SPI_ReceiveByte(); - * uint8_t Byte3 = SPI_ReceiveByte(); - * - * // Send a byte, and store the received byte from the same transaction - * uint8_t ResponseByte = SPI_TransferByte(0xDC); - * \endcode - * - * @{ - */ - -#ifndef __SPI_AVR8_H__ -#define __SPI_AVR8_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SPI_H) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/SPI.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define SPI_USE_DOUBLESPEED (1 << SPE) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name SPI Prescaler Configuration Masks */ - //@{ - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 2. */ - #define SPI_SPEED_FCPU_DIV_2 SPI_USE_DOUBLESPEED - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 4. */ - #define SPI_SPEED_FCPU_DIV_4 0 - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 8. */ - #define SPI_SPEED_FCPU_DIV_8 (SPI_USE_DOUBLESPEED | (1 << SPR0)) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 16. */ - #define SPI_SPEED_FCPU_DIV_16 (1 << SPR0) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 32. */ - #define SPI_SPEED_FCPU_DIV_32 (SPI_USE_DOUBLESPEED | (1 << SPR1)) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 64. */ - #define SPI_SPEED_FCPU_DIV_64 (SPI_USE_DOUBLESPEED | (1 << SPR1) | (1 << SPR0)) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 128. */ - #define SPI_SPEED_FCPU_DIV_128 ((1 << SPR1) | (1 << SPR0)) - //@} - - /** \name SPI SCK Polarity Configuration Masks */ - //@{ - /** SPI clock polarity mask for \ref SPI_Init(). Indicates that the SCK should lead on the rising edge. */ - #define SPI_SCK_LEAD_RISING (0 << CPOL) - - /** SPI clock polarity mask for \ref SPI_Init(). Indicates that the SCK should lead on the falling edge. */ - #define SPI_SCK_LEAD_FALLING (1 << CPOL) - //@} - - /** \name SPI Sample Edge Configuration Masks */ - //@{ - /** SPI data sample mode mask for \ref SPI_Init(). Indicates that the data should sampled on the leading edge. */ - #define SPI_SAMPLE_LEADING (0 << CPHA) - - /** SPI data sample mode mask for \ref SPI_Init(). Indicates that the data should be sampled on the trailing edge. */ - #define SPI_SAMPLE_TRAILING (1 << CPHA) - //@} - - /** \name SPI Data Ordering Configuration Masks */ - //@{ - /** SPI data order mask for \ref SPI_Init(). Indicates that data should be shifted out MSB first. */ - #define SPI_ORDER_MSB_FIRST (0 << DORD) - - /** SPI data order mask for \ref SPI_Init(). Indicates that data should be shifted out LSB first. */ - #define SPI_ORDER_LSB_FIRST (1 << DORD) - //@} - - /** \name SPI Mode Configuration Masks */ - //@{ - /** SPI mode mask for \ref SPI_Init(). Indicates that the SPI interface should be initialized into slave mode. */ - #define SPI_MODE_SLAVE (0 << MSTR) - - /** SPI mode mask for \ref SPI_Init(). Indicates that the SPI interface should be initialized into master mode. */ - #define SPI_MODE_MASTER (1 << MSTR) - //@} - - /* Inline Functions: */ - /** Initializes the SPI subsystem, ready for transfers. Must be called before calling any other - * SPI routines. - * - * \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*, - * \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks. - */ - static inline void SPI_Init(const uint8_t SPIOptions) - { - /* Prevent high rise times on PB.0 (/SS) from forcing a change to SPI slave mode */ - DDRB |= (1 << 0); - PORTB |= (1 << 0); - - DDRB |= ((1 << 1) | (1 << 2)); - DDRB &= ~(1 << 3); - PORTB |= (1 << 3); - - if (SPIOptions & SPI_USE_DOUBLESPEED) - SPSR |= (1 << SPI2X); - else - SPSR &= ~(1 << SPI2X); - - /* Switch /SS to input mode after configuration to allow for forced mode changes */ - DDRB &= ~(1 << 0); - - SPCR = ((1 << SPE) | SPIOptions); - } - - /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */ - static inline void SPI_Disable(void) - { - DDRB &= ~((1 << 1) | (1 << 2)); - PORTB &= ~((1 << 0) | (1 << 3)); - - SPCR = 0; - SPSR = 0; - } - - /** Retrieves the currently selected SPI mode, once the SPI interface has been configured. - * - * \return \ref SPI_MODE_MASTER if the interface is currently in SPI Master mode, \ref SPI_MODE_SLAVE otherwise - */ - static inline uint8_t SPI_GetCurrentMode(void) ATTR_ALWAYS_INLINE; - static inline uint8_t SPI_GetCurrentMode(void) - { - return (SPCR & SPI_MODE_MASTER); - } - - /** Sends and receives a byte through the SPI interface, blocking until the transfer is complete. - * - * \param[in] Byte Byte to send through the SPI interface. - * - * \return Response byte from the attached SPI device. - */ - static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t SPI_TransferByte(const uint8_t Byte) - { - SPDR = Byte; - while (!(SPSR & (1 << SPIF))); - return SPDR; - } - - /** Sends a byte through the SPI interface, blocking until the transfer is complete. The response - * byte sent to from the attached SPI device is ignored. - * - * \param[in] Byte Byte to send through the SPI interface. - */ - static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void SPI_SendByte(const uint8_t Byte) - { - SPDR = Byte; - while (!(SPSR & (1 << SPIF))); - } - - /** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response - * byte from the attached SPI device is returned. - * - * \return The response byte from the attached SPI device. - */ - static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t SPI_ReceiveByte(void) - { - SPDR = 0x00; - while (!(SPSR & (1 << SPIF))); - return SPDR; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h deleted file mode 100644 index 9a122f501e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master SPI Mode Serial USART Peripheral Driver (XMEGA) - * - * On-chip Master SPI mode USART driver for the XMEGA AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI Master - * Mode USART driver dispatch header located in LUFA/Drivers/Peripheral/Serial.h. - */ - -/** \ingroup Group_SerialSPI - * \defgroup Group_SerialSPI_AVR8 Master SPI Mode Serial USART Peripheral Driver (AVR8) - * - * \section Sec_ModDescription Module Description - * On-chip serial USART driver for the 8-bit AVR8 microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI Master - * driver dispatch header located in LUFA/Drivers/Peripheral/SerialSPI.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud - * SerialSPI_Init((USART_SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_ORDER_MSB_FIRST), 1000000); - * - * // Send several bytes, ignoring the returned data - * SerialSPI_SendByte(0x01); - * SerialSPI_SendByte(0x02); - * SerialSPI_SendByte(0x03); - * - * // Receive several bytes, sending a dummy 0x00 byte each time - * uint8_t Byte1 = SerialSPI_ReceiveByte(); - * uint8_t Byte2 = SerialSPI_ReceiveByte(); - * uint8_t Byte3 = SerialSPI_ReceiveByte(); - * - * // Send a byte, and store the received byte from the same transaction - * uint8_t ResponseByte = SerialSPI_TransferByte(0xDC); - * \endcode - * - * @{ - */ - -#ifndef __SERIAL_SPI_AVR8_H__ -#define __SERIAL_SPI_AVR8_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SERIAL_SPI_H) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/Serial.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - #define SERIAL_SPI_UBBRVAL(Baud) ((Baud < (F_CPU / 2)) ? ((F_CPU / (2 * Baud)) - 1) : 0) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name SPI SCK Polarity Configuration Masks */ - //@{ - /** SPI clock polarity mask for \ref SPI_Init(). Indicates that the SCK should lead on the rising edge. */ - #define USART_SPI_SCK_LEAD_RISING (0 << UCPOL) - - /** SPI clock polarity mask for \ref SPI_Init(). Indicates that the SCK should lead on the falling edge. */ - #define USART_SPI_SCK_LEAD_FALLING (1 << UCPOL) - //@} - - /** \name SPI Sample Edge Configuration Masks */ - //@{ - /** SPI data sample mode mask for \ref SerialSPI_Init(). Indicates that the data should sampled on the leading edge. */ - #define USART_SPI_SAMPLE_LEADING (0 << UPCHA) - - /** SPI data sample mode mask for \ref SerialSPI_Init(). Indicates that the data should be sampled on the trailing edge. */ - #define USART_SPI_SAMPLE_TRAILING (1 << UPCHA) - //@} - - /** \name SPI Data Ordering Configuration Masks */ - //@{ - /** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out MSB first. */ - #define USART_SPI_ORDER_MSB_FIRST (0 << UDORD) - - /** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out LSB first. */ - #define USART_SPI_ORDER_LSB_FIRST (1 << UDORD) - //@} - - /* Inline Functions: */ - /** Initialize the USART module in Master SPI mode. - * - * \param[in] SPIOptions USART SPI Options, a mask consisting of one of each of the \c USART_SPI_SCK_*, - * \c USART_SPI_SAMPLE_* and \c USART_SPI_ORDER_* masks. - * \param[in] BaudRate SPI baud rate, in bits per second. - */ - static inline void SerialSPI_Init(const uint8_t SPIOptions, - const uint32_t BaudRate) - { - UBRR1 = SERIAL_SPI_UBBRVAL(BaudRate); - - UCSR1C = ((1 << UMSEL11) | (1 << UMSEL10) | SPIOptions); - UCSR1B = ((1 << TXEN1) | (1 << RXEN1)); - - DDRD |= (1 << 3); - PORTD |= (1 << 2); - } - - /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */ - static inline void SerialSPI_Disable(void) - { - UCSR1B = 0; - UCSR1A = 0; - UCSR1C = 0; - - UBRR1 = 0; - - DDRD &= ~(1 << 3); - PORTD &= ~(1 << 2); - } - - /** Sends and receives a byte through the USART SPI interface, blocking until the transfer is complete. - * - * \param[in] DataByte Byte to send through the USART SPI interface. - * - * \return Response byte from the attached SPI device. - */ - static inline uint8_t SerialSPI_TransferByte(const uint8_t DataByte) - { - UDR1 = DataByte; - while (!(UCSR1A & (1 << TXC1))); - UCSR1A = (1 << TXC1); - return UDR1; - } - - /** Sends a byte through the USART SPI interface, blocking until the transfer is complete. The response - * byte sent to from the attached SPI device is ignored. - * - * \param[in] DataByte Byte to send through the USART SPI interface. - */ - static inline void SerialSPI_SendByte(const uint8_t DataByte) - { - SerialSPI_TransferByte(DataByte); - } - - /** Sends a dummy byte through the USART SPI interface, blocking until the transfer is complete. The response - * byte from the attached SPI device is returned. - * - * \return The response byte from the attached SPI device. - */ - static inline uint8_t SerialSPI_ReceiveByte(void) - { - return SerialSPI_TransferByte(0); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c deleted file mode 100644 index a1f64b022e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_SERIAL_C -#include "../Serial.h" - -FILE USARTSerialStream; - -int Serial_putchar(char DataByte, - FILE *Stream) -{ - (void)Stream; - - Serial_SendByte(DataByte); - return 0; -} - -int Serial_getchar(FILE *Stream) -{ - (void)Stream; - - if (!(Serial_IsCharReceived())) - return _FDEV_EOF; - - return Serial_ReceiveByte(); -} - -int Serial_getchar_Blocking(FILE *Stream) -{ - (void)Stream; - - while (!(Serial_IsCharReceived())); - return Serial_ReceiveByte(); -} - -void Serial_SendString_P(const char* FlashStringPtr) -{ - uint8_t CurrByte; - - while ((CurrByte = pgm_read_byte(FlashStringPtr)) != 0x00) - { - Serial_SendByte(CurrByte); - FlashStringPtr++; - } -} - -void Serial_SendString(const char* StringPtr) -{ - uint8_t CurrByte; - - while ((CurrByte = *StringPtr) != 0x00) - { - Serial_SendByte(CurrByte); - StringPtr++; - } -} - -void Serial_SendData(const uint8_t* Buffer, - uint16_t Length) -{ - while (Length--) - Serial_SendByte(*(Buffer++)); -} - -void Serial_CreateStream(FILE* Stream) -{ - if (!(Stream)) - { - Stream = &USARTSerialStream; - stdin = Stream; - stdout = Stream; - } - - *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW); -} - -void Serial_CreateBlockingStream(FILE* Stream) -{ - if (!(Stream)) - { - Stream = &USARTSerialStream; - stdin = Stream; - stdout = Stream; - } - - *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar_Blocking, _FDEV_SETUP_RW); -} - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h deleted file mode 100644 index 8416082f59..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Serial USART Peripheral Driver (AVR8) - * - * On-chip serial USART driver for the 8-bit AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the USART driver - * dispatch header located in LUFA/Drivers/Peripheral/Serial.h. - */ - -/** \ingroup Group_Serial - * \defgroup Group_Serial_AVR8 Serial USART Peripheral Driver (AVR8) - * - * \section Sec_ModDescription Module Description - * On-chip serial USART driver for the 8-bit AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the USART driver - * dispatch header located in LUFA/Drivers/Peripheral/Serial.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the serial USART driver before first use, with 9600 baud (and no double-speed mode) - * Serial_Init(9600, false); - * - * // Send a string through the USART - * Serial_TxString("Test String\r\n"); - * - * // Receive a byte through the USART - * uint8_t DataByte = Serial_RxByte(); - * \endcode - * - * @{ - */ - -#ifndef __SERIAL_AVR8_H__ -#define __SERIAL_AVR8_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "../../Misc/TerminalCodes.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SERIAL_H) && !defined(__INCLUDE_FROM_SERIAL_C) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/Serial.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* External Variables: */ - extern FILE USARTSerialStream; - - /* Function Prototypes: */ - int Serial_putchar(char DataByte, - FILE *Stream); - int Serial_getchar(FILE *Stream); - int Serial_getchar_Blocking(FILE *Stream); - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Macro for calculating the baud value from a given baud rate when the \c U2X (double speed) bit is - * not set. - * - * \param[in] Baud Target serial UART baud rate. - * - * \return Closest UBRR register value for the given UART frequency. - */ - #define SERIAL_UBBRVAL(Baud) ((((F_CPU / 16) + (Baud / 2)) / (Baud)) - 1) - - /** Macro for calculating the baud value from a given baud rate when the \c U2X (double speed) bit is - * set. - * - * \param[in] Baud Target serial UART baud rate. - * - * \return Closest UBRR register value for the given UART frequency. - */ - #define SERIAL_2X_UBBRVAL(Baud) ((((F_CPU / 8) + (Baud / 2)) / (Baud)) - 1) - - /* Function Prototypes: */ - /** Transmits a given string located in program space (FLASH) through the USART. - * - * \param[in] FlashStringPtr Pointer to a string located in program space. - */ - void Serial_SendString_P(const char* FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1); - - /** Transmits a given string located in SRAM memory through the USART. - * - * \param[in] StringPtr Pointer to a string located in SRAM space. - */ - void Serial_SendString(const char* StringPtr) ATTR_NON_NULL_PTR_ARG(1); - - /** Transmits a given buffer located in SRAM memory through the USART. - * - * \param[in] Buffer Pointer to a buffer containing the data to send. - * \param[in] Length Length of the data to send, in bytes. - */ - void Serial_SendData(const uint8_t* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Creates a standard character stream from the USART so that it can be used with all the regular functions - * in the avr-libc \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created - * stream is bidirectional and can be used for both input and output functions. - * - * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single - * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own - * line buffering. - * - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed, if \c NULL, \c stdout - * and \c stdin will be configured to use the USART. - * - * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. - */ - void Serial_CreateStream(FILE* Stream); - - /** Identical to \ref Serial_CreateStream(), except that reads are blocking until the calling stream function terminates - * the transfer. - * - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed, if \c NULL, \c stdout - * and \c stdin will be configured to use the USART. - * - * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. - */ - void Serial_CreateBlockingStream(FILE* Stream); - - /* Inline Functions: */ - /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to - * standard 8-bit, no parity, 1 stop bit settings suitable for most applications. - * - * \param[in] BaudRate Serial baud rate, in bits per second. - * \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate. - */ - static inline void Serial_Init(const uint32_t BaudRate, - const bool DoubleSpeed) - { - UBRR1 = (DoubleSpeed ? SERIAL_2X_UBBRVAL(BaudRate) : SERIAL_UBBRVAL(BaudRate)); - - UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10)); - UCSR1A = (DoubleSpeed ? (1 << U2X1) : 0); - UCSR1B = ((1 << TXEN1) | (1 << RXEN1)); - - DDRD |= (1 << 3); - PORTD |= (1 << 2); - } - - /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */ - static inline void Serial_Disable(void) - { - UCSR1B = 0; - UCSR1A = 0; - UCSR1C = 0; - - UBRR1 = 0; - - DDRD &= ~(1 << 3); - PORTD &= ~(1 << 2); - } - - /** Indicates whether a character has been received through the USART. - * - * \return Boolean \c true if a character has been received, \c false otherwise. - */ - static inline bool Serial_IsCharReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Serial_IsCharReceived(void) - { - return ((UCSR1A & (1 << RXC1)) ? true : false); - } - - /** Transmits a given byte through the USART. - * - * \param[in] DataByte Byte to transmit through the USART. - */ - static inline void Serial_SendByte(const char DataByte) ATTR_ALWAYS_INLINE; - static inline void Serial_SendByte(const char DataByte) - { - while (!(UCSR1A & (1 << UDRE1))); - UDR1 = DataByte; - } - - /** Receives the next byte from the USART. - * - * \return Next byte received from the USART, or a negative value if no byte has been received. - */ - static inline int16_t Serial_ReceiveByte(void) ATTR_ALWAYS_INLINE; - static inline int16_t Serial_ReceiveByte(void) - { - if (!(Serial_IsCharReceived())) - return -1; - - return UDR1; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c deleted file mode 100644 index 3cc3f0b6d3..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) && defined(TWCR) - -#define __INCLUDE_FROM_TWI_C -#include "../TWI.h" - -uint8_t TWI_StartTransmission(const uint8_t SlaveAddress, - const uint8_t TimeoutMS) -{ - for (;;) - { - bool BusCaptured = false; - uint16_t TimeoutRemaining; - - TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN)); - - TimeoutRemaining = (TimeoutMS * 100); - while (TimeoutRemaining-- && !(BusCaptured)) - { - if (TWCR & (1 << TWINT)) - { - switch (TWSR & TW_STATUS_MASK) - { - case TW_START: - case TW_REP_START: - BusCaptured = true; - break; - case TW_MT_ARB_LOST: - TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN)); - continue; - default: - TWCR = (1 << TWEN); - return TWI_ERROR_BusFault; - } - } - - _delay_us(10); - } - - if (!(TimeoutRemaining)) - { - TWCR = (1 << TWEN); - return TWI_ERROR_BusCaptureTimeout; - } - - TWDR = SlaveAddress; - TWCR = ((1 << TWINT) | (1 << TWEN)); - - TimeoutRemaining = (TimeoutMS * 100); - while (TimeoutRemaining--) - { - if (TWCR & (1 << TWINT)) - break; - - _delay_us(10); - } - - if (!(TimeoutRemaining)) - return TWI_ERROR_SlaveResponseTimeout; - - switch (TWSR & TW_STATUS_MASK) - { - case TW_MT_SLA_ACK: - case TW_MR_SLA_ACK: - return TWI_ERROR_NoError; - default: - TWCR = ((1 << TWINT) | (1 << TWSTO) | (1 << TWEN)); - return TWI_ERROR_SlaveNotReady; - } - } -} - -bool TWI_SendByte(const uint8_t Byte) -{ - TWDR = Byte; - TWCR = ((1 << TWINT) | (1 << TWEN)); - while (!(TWCR & (1 << TWINT))); - - return ((TWSR & TW_STATUS_MASK) == TW_MT_DATA_ACK); -} - -bool TWI_ReceiveByte(uint8_t* const Byte, - const bool LastByte) -{ - uint8_t TWCRMask; - - if (LastByte) - TWCRMask = ((1 << TWINT) | (1 << TWEN)); - else - TWCRMask = ((1 << TWINT) | (1 << TWEN) | (1 << TWEA)); - - TWCR = TWCRMask; - while (!(TWCR & (1 << TWINT))); - *Byte = TWDR; - - uint8_t Status = (TWSR & TW_STATUS_MASK); - - return ((LastByte) ? (Status == TW_MR_DATA_NACK) : (Status == TW_MR_DATA_ACK)); -} - -uint8_t TWI_ReadPacket(const uint8_t SlaveAddress, - const uint8_t TimeoutMS, - const uint8_t* InternalAddress, - uint8_t InternalAddressLen, - uint8_t* Buffer, - uint8_t Length) -{ - uint8_t ErrorCode; - - if ((ErrorCode = TWI_StartTransmission((SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE, - TimeoutMS)) == TWI_ERROR_NoError) - { - while (InternalAddressLen--) - { - if (!(TWI_SendByte(*(InternalAddress++)))) - { - ErrorCode = TWI_ERROR_SlaveNAK; - break; - } - } - - if ((ErrorCode = TWI_StartTransmission((SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_READ, - TimeoutMS)) == TWI_ERROR_NoError) - { - while (Length--) - { - if (!(TWI_ReceiveByte(Buffer++, (Length == 0)))) - { - ErrorCode = TWI_ERROR_SlaveNAK; - break; - } - } - - TWI_StopTransmission(); - } - } - - return ErrorCode; -} - -uint8_t TWI_WritePacket(const uint8_t SlaveAddress, - const uint8_t TimeoutMS, - const uint8_t* InternalAddress, - uint8_t InternalAddressLen, - const uint8_t* Buffer, - uint8_t Length) -{ - uint8_t ErrorCode; - - if ((ErrorCode = TWI_StartTransmission((SlaveAddress & TWI_DEVICE_ADDRESS_MASK) | TWI_ADDRESS_WRITE, - TimeoutMS)) == TWI_ERROR_NoError) - { - while (InternalAddressLen--) - { - if (!(TWI_SendByte(*(InternalAddress++)))) - { - ErrorCode = TWI_ERROR_SlaveNAK; - break; - } - } - - while (Length--) - { - if (!(TWI_SendByte(*(Buffer++)))) - { - ErrorCode = TWI_ERROR_SlaveNAK; - break; - } - } - - TWI_StopTransmission(); - } - - return ErrorCode; -} - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h deleted file mode 100644 index 92c7389a69..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief TWI Peripheral Driver (AVR8) - * - * On-chip TWI driver for the 8-bit AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the TWI driver - * dispatch header located in LUFA/Drivers/Peripheral/TWI.h. - */ - -/** \ingroup Group_TWI - * \defgroup Group_TWI_AVR8 TWI Peripheral Driver (AVR8) - * - * \section Sec_ModDescription Module Description - * Master mode TWI driver for the 8-bit AVR microcontrollers which contain a hardware TWI module. - * - * \note This file should not be included directly. It is automatically included as needed by the TWI driver - * dispatch header located in LUFA/Drivers/Peripheral/TWI.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * Low Level API Example: - * \code - * // Initialize the TWI driver before first use at 200KHz - * TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 200000)); - * - * // Start a write session to device at device address 0xA0, internal address 0xDC with a 10ms timeout - * if (TWI_StartTransmission(0xA0 | TWI_ADDRESS_WRITE, 10) == TWI_ERROR_NoError) - * { - * TWI_SendByte(0xDC); - * - * TWI_SendByte(0x01); - * TWI_SendByte(0x02); - * TWI_SendByte(0x03); - * - * // Must stop transmission afterwards to release the bus - * TWI_StopTransmission(); - * } - * - * // Start a read session to device at address 0xA0, internal address 0xDC with a 10ms timeout - * if (TWI_StartTransmission(0xA0 | TWI_ADDRESS_WRITE, 10) == TWI_ERROR_NoError) - * { - * TWI_SendByte(0xDC); - * TWI_StopTransmission(); - * - * if (TWI_StartTransmission(0xA0 | TWI_ADDRESS_READ, 10) == TWI_ERROR_NoError) - * { - * uint8_t Byte1, Byte2, Byte3; - * - * // Read three bytes, acknowledge after the third byte is received - * TWI_ReceiveByte(&Byte1, false); - * TWI_ReceiveByte(&Byte2, false); - * TWI_ReceiveByte(&Byte3, true); - * - * // Must stop transmission afterwards to release the bus - * TWI_StopTransmission(); - * } - * } - * \endcode - * - * High Level API Example: - * \code - * // Initialize the TWI driver before first use at 200KHz - * TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 200000)); - * - * // Start a write session to device at device address 0xA0, internal address 0xDC with a 10ms timeout - * uint8_t InternalWriteAddress = 0xDC; - * uint8_t WritePacket[3] = {0x01, 0x02, 0x03}; - * - * TWI_WritePacket(0xA0, 10, &InternalWriteAddress, sizeof(InternalWriteAddress), - * &WritePacket, sizeof(WritePacket); - * - * // Start a read session to device at address 0xA0, internal address 0xDC with a 10ms timeout - * uint8_t InternalReadAddress = 0xDC; - * uint8_t ReadPacket[3]; - * - * TWI_ReadPacket(0xA0, 10, &InternalReadAddress, sizeof(InternalReadAddress), - * &ReadPacket, sizeof(ReadPacket); - * \endcode - * - * @{ - */ - -#ifndef __TWI_AVR8_H__ -#define __TWI_AVR8_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - - #include - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_TWI_H) && !defined(__INCLUDE_FROM_TWI_C) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/TWI.h instead. - #endif - - #if !(defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \ - defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \ - defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \ - defined(__AVR_ATmega32U6__)) - #error The TWI peripheral driver is not currently available for your selected microcontroller model. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** TWI slave device address mask for a read session. Mask with a slave device base address to obtain - * the correct TWI bus address for the slave device when reading data from it. - */ - #define TWI_ADDRESS_READ 0x01 - - /** TWI slave device address mask for a write session. Mask with a slave device base address to obtain - * the correct TWI bus address for the slave device when writing data to it. - */ - #define TWI_ADDRESS_WRITE 0x00 - - /** Mask to retrieve the base address for a TWI device, which can then be ORed with \ref TWI_ADDRESS_READ - * or \ref TWI_ADDRESS_WRITE to obtain the device's read and write address respectively. - */ - #define TWI_DEVICE_ADDRESS_MASK 0xFE - - /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 1. */ - #define TWI_BIT_PRESCALE_1 ((0 << TWPS1) | (0 << TWPS0)) - - /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 4. */ - #define TWI_BIT_PRESCALE_4 ((0 << TWPS1) | (1 << TWPS0)) - - /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 16. */ - #define TWI_BIT_PRESCALE_16 ((1 << TWPS1) | (0 << TWPS0)) - - /** Bit length prescaler for \ref TWI_Init(). This mask multiplies the TWI bit length prescaler by 64. */ - #define TWI_BIT_PRESCALE_64 ((1 << TWPS1) | (1 << TWPS0)) - - /** Calculates the length of each bit on the TWI bus for a given target frequency. This may be used with - * the \ref TWI_Init() function to convert a bus frequency to a number of clocks for the \c BitLength - * parameter. - * - * \param[in] Prescale Prescaler set on the TWI bus. - * \param[in] Frequency Desired TWI bus frequency in Hz. - * - * \return Bit length in clocks for the given TWI bus frequency at the given prescaler value. - */ - #define TWI_BITLENGTH_FROM_FREQ(Prescale, Frequency) ((((F_CPU / (Prescale)) / (Frequency)) - 16) / 2) - - /* Enums: */ - /** Enum for the possible return codes of the TWI transfer start routine and other dependant TWI functions. */ - enum TWI_ErrorCodes_t - { - TWI_ERROR_NoError = 0, /**< Indicates that the command completed successfully. */ - TWI_ERROR_BusFault = 1, /**< A TWI bus fault occurred while attempting to capture the bus. */ - TWI_ERROR_BusCaptureTimeout = 2, /**< A timeout occurred whilst waiting for the bus to be ready. */ - TWI_ERROR_SlaveResponseTimeout = 3, /**< No ACK received at the nominated slave address within the timeout period. */ - TWI_ERROR_SlaveNotReady = 4, /**< Slave NAKed the TWI bus START condition. */ - TWI_ERROR_SlaveNAK = 5, /**< Slave NAKed whilst attempting to send data to the device. */ - }; - - /* Inline Functions: */ - /** Initializes the TWI hardware into master mode, ready for data transmission and reception. This must be - * before any other TWI operations. - * - * The generated SCL frequency will be according to the formula
F_CPU / (16 + 2 * BitLength + 4 ^ Prescale)
. - * - * \attention The value of the \c BitLength parameter should not be set below 10 or invalid bus conditions may - * occur, as indicated in the AVR8 microcontroller datasheet. - * - * \param[in] Prescale Prescaler to use when determining the bus frequency, a \c TWI_BIT_PRESCALE_* value. - * \param[in] BitLength Length of the bits sent on the bus. - */ - static inline void TWI_Init(const uint8_t Prescale, const uint8_t BitLength) ATTR_ALWAYS_INLINE; - static inline void TWI_Init(const uint8_t Prescale, const uint8_t BitLength) - { - TWCR |= (1 << TWEN); - TWSR = Prescale; - TWBR = BitLength; - } - - /** Turns off the TWI driver hardware. If this is called, any further TWI operations will require a call to - * \ref TWI_Init() before the TWI can be used again. - */ - static inline void TWI_Disable(void) ATTR_ALWAYS_INLINE; - static inline void TWI_Disable(void) - { - TWCR &= ~(1 << TWEN); - } - - /** Sends a TWI STOP onto the TWI bus, terminating communication with the currently addressed device. */ - static inline void TWI_StopTransmission(void) ATTR_ALWAYS_INLINE; - static inline void TWI_StopTransmission(void) - { - TWCR = ((1 << TWINT) | (1 << TWSTO) | (1 << TWEN)); - } - - /* Function Prototypes: */ - /** Begins a master mode TWI bus communication with the given slave device address. - * - * \param[in] SlaveAddress Address of the slave TWI device to communicate with. - * \param[in] TimeoutMS Timeout period within which the slave must respond, in milliseconds. - * - * \return A value from the \ref TWI_ErrorCodes_t enum. - */ - uint8_t TWI_StartTransmission(const uint8_t SlaveAddress, - const uint8_t TimeoutMS); - - /** Sends a byte to the currently addressed device on the TWI bus. - * - * \param[in] Byte Byte to send to the currently addressed device - * - * \return Boolean \c true if the recipient ACKed the byte, \c false otherwise - */ - bool TWI_SendByte(const uint8_t Byte); - - /** Receives a byte from the currently addressed device on the TWI bus. - * - * \param[in] Byte Location where the read byte is to be stored. - * \param[in] LastByte Indicates if the byte should be ACKed if false, NAKed if true. - * - * \return Boolean \c true if the byte reception successfully completed, \c false otherwise. - */ - bool TWI_ReceiveByte(uint8_t* const Byte, - const bool LastByte) ATTR_NON_NULL_PTR_ARG(1); - - /** High level function to perform a complete packet transfer over the TWI bus to the specified - * device. - * - * \param[in] SlaveAddress Base address of the TWI slave device to communicate with. - * \param[in] TimeoutMS Timeout for bus capture and slave START ACK, in milliseconds. - * \param[in] InternalAddress Pointer to a location where the internal slave read start address is stored. - * \param[in] InternalAddressLen Size of the internal device address, in bytes. - * \param[in] Buffer Pointer to a buffer where the read packet data is to be stored. - * \param[in] Length Size of the packet to read, in bytes. - * - * \return A value from the \ref TWI_ErrorCodes_t enum. - */ - uint8_t TWI_ReadPacket(const uint8_t SlaveAddress, - const uint8_t TimeoutMS, - const uint8_t* InternalAddress, - uint8_t InternalAddressLen, - uint8_t* Buffer, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(3); - - /** High level function to perform a complete packet transfer over the TWI bus from the specified - * device. - * - * \param[in] SlaveAddress Base address of the TWI slave device to communicate with - * \param[in] TimeoutMS Timeout for bus capture and slave START ACK, in milliseconds - * \param[in] InternalAddress Pointer to a location where the internal slave write start address is stored - * \param[in] InternalAddressLen Size of the internal device address, in bytes - * \param[in] Buffer Pointer to a buffer where the packet data to send is stored - * \param[in] Length Size of the packet to send, in bytes - * - * \return A value from the \ref TWI_ErrorCodes_t enum. - */ - uint8_t TWI_WritePacket(const uint8_t SlaveAddress, - const uint8_t TimeoutMS, - const uint8_t* InternalAddress, - uint8_t InternalAddressLen, - const uint8_t* Buffer, - uint8_t Length) ATTR_NON_NULL_PTR_ARG(3); - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h deleted file mode 100644 index 1fab22b68f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Hardware Serial Peripheral Interface driver. - * - * This file is the master dispatch header file for the device-specific SPI driver, for microcontrollers - * containing a hardware SPI. - * - * User code should include this file, which will in turn include the correct SPI driver header file for the - * currently selected architecture and microcontroller model. - */ - -/** \ingroup Group_PeripheralDrivers - * \defgroup Group_SPI SPI Driver - LUFA/Drivers/Peripheral/SPI.h - * \brief Hardware Serial Peripheral Interface driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Hardware SPI driver. This module provides an easy to use driver for the setup and transfer of data over - * the selected architecture and microcontroller model's SPI port. - * - * \note The exact API for this driver may vary depending on the target used - see - * individual target module documentation for the API specific to your target processor. - */ - -#ifndef __SPI_H__ -#define __SPI_H__ - - /* Macros: */ - #define __INCLUDE_FROM_SPI_H - - /* Includes: */ - #include "../../Common/Common.h" - - /* Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/SPI_AVR8.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/SPI_XMEGA.h" - #else - #error The SPI peripheral driver is not currently available for your selected architecture. - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h deleted file mode 100644 index 0db13ba472..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Hardware Serial USART driver. - * - * This file is the master dispatch header file for the device-specific USART driver, for microcontrollers - * containing a hardware USART. - * - * User code should include this file, which will in turn include the correct ADC driver header file for the - * currently selected architecture and microcontroller model. - */ - -/** \ingroup Group_PeripheralDrivers - * \defgroup Group_Serial Serial USART Driver - LUFA/Drivers/Peripheral/Serial.h - * \brief Hardware Serial USART driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/Peripheral/ARCH/Serial_ARCH.c (Makefile source module name: LUFA_SRC_SERIAL) - * - * \section Sec_ModDescription Module Description - * Hardware serial USART driver. This module provides an easy to use driver for the setup and transfer - * of data over the selected architecture and microcontroller model's USART port. - * - * \note The exact API for this driver may vary depending on the target used - see - * individual target module documentation for the API specific to your target processor. - */ - -#ifndef __SERIAL_H__ -#define __SERIAL_H__ - - /* Macros: */ - #define __INCLUDE_FROM_SERIAL_H - - /* Includes: */ - #include "../../Common/Common.h" - - /* Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/Serial_AVR8.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/Serial_XMEGA.h" - #else - #error The Serial peripheral driver is not currently available for your selected architecture. - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h deleted file mode 100644 index f5eede842b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Hardware SPI Master Mode Serial USART driver. - * - * This file is the master dispatch header file for the device-specific SPI Master Mode USART driver, for - * microcontrollers containing a hardware USART capable of operating in a Master SPI mode. - * - * User code should include this file, which will in turn include the correct ADC driver header file for the - * currently selected architecture and microcontroller model. - */ - -/** \ingroup Group_PeripheralDrivers - * \defgroup Group_SerialSPI Master SPI Mode Serial USART Driver - LUFA/Drivers/Peripheral/SerialSPI.h - * \brief Hardware SPI Master Mode Serial USART driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Hardware SPI Master Mode serial USART driver. This module provides an easy to use driver for the setup and transfer - * of data over the selected architecture and microcontroller model's USART port, using a SPI framing format. - * - * \note The exact API for this driver may vary depending on the target used - see - * individual target module documentation for the API specific to your target processor. - */ - -#ifndef __SERIAL_SPI_H__ -#define __SERIAL_SPI_H__ - - /* Macros: */ - #define __INCLUDE_FROM_SERIAL_SPI_H - - /* Includes: */ - #include "../../Common/Common.h" - - /* Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/SerialSPI_AVR8.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/SerialSPI_XMEGA.h" - #else - #error The Serial SPI Master Mode peripheral driver is not currently available for your selected architecture. - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h deleted file mode 100644 index 34012fda65..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Hardware Two Wire Interface (I2C) driver. - * - * This file is the master dispatch header file for the device-specific SPI driver, for microcontrollers - * containing a hardware TWI. - * - * User code should include this file, which will in turn include the correct TWI driver header file for the - * currently selected architecture and microcontroller model. - */ - -/** \ingroup Group_PeripheralDrivers - * \defgroup Group_TWI TWI Driver - LUFA/Drivers/Peripheral/TWI.h - * \brief Hardware Two Wire Interface (I2C) driver. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/Peripheral/ARCH/TWI_ARCH.c (Makefile source module name: LUFA_SRC_TWI) - * - * \section Sec_ModDescription Module Description - * Hardware TWI driver. This module provides an easy to use driver for the setup and transfer of data over - * the selected architecture and microcontroller model's TWI bus port. - * - * \note The exact API for this driver may vary depending on the target used - see - * individual target module documentation for the API specific to your target processor. - */ - -#ifndef __TWI_H__ -#define __TWI_H__ - - /* Macros: */ - #define __INCLUDE_FROM_TWI_H - - /* Includes: */ - #include "../../Common/Common.h" - - /* Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/TWI_AVR8.h" - #else - #error The TWI peripheral driver is not currently available for your selected architecture. - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h deleted file mode 100644 index 25fb73d16f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h +++ /dev/null @@ -1,248 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief SPI Peripheral Driver (XMEGA) - * - * On-chip SPI driver for the XMEGA microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI driver - * dispatch header located in LUFA/Drivers/Peripheral/SPI.h. - */ - -/** \ingroup Group_SPI - * \defgroup Group_SPI_XMEGA SPI Peripheral Driver (XMEGA) - * - * \section Sec_ModDescription Module Description - * Driver for the hardware SPI port(s) available on XMEGA AVR microcontroller models. This - * module provides an easy to use driver for the setup and transfer of data over the AVR's - * SPI ports. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI driver - * dispatch header located in LUFA/Drivers/Peripheral/SPI.h. - * - * \code - * // Initialize the SPI driver before first use - * SPI_Init(&SPIC, - * SPI_SPEED_FCPU_DIV_2 | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_FALLING | - * SPI_SAMPLE_TRAILING | SPI_MODE_MASTER); - * - * // Send several bytes, ignoring the returned data - * SPI_SendByte(&SPIC, 0x01); - * SPI_SendByte(&SPIC, 0x02); - * SPI_SendByte(&SPIC, 0x03); - * - * // Receive several bytes, sending a dummy 0x00 byte each time - * uint8_t Byte1 = SPI_ReceiveByte(&SPIC); - * uint8_t Byte2 = SPI_ReceiveByte(&SPIC); - * uint8_t Byte3 = SPI_ReceiveByte(&SPIC); - * - * // Send a byte, and store the received byte from the same transaction - * uint8_t ResponseByte = SPI_TransferByte(&SPIC, 0xDC); - * \endcode - * - * @{ - */ - -#ifndef __SPI_XMEGA_H__ -#define __SPI_XMEGA_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SPI_H) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/SPI.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define SPI_USE_DOUBLESPEED SPI_CLK2X_bm - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name SPI Prescaler Configuration Masks */ - //@{ - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 2. */ - #define SPI_SPEED_FCPU_DIV_2 SPI_USE_DOUBLESPEED - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 4. */ - #define SPI_SPEED_FCPU_DIV_4 0 - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 8. */ - #define SPI_SPEED_FCPU_DIV_8 (SPI_USE_DOUBLESPEED | (1 << SPI_PRESCALER_gp)) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 16. */ - #define SPI_SPEED_FCPU_DIV_16 (1 << SPI_PRESCALER_gp) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 32. */ - #define SPI_SPEED_FCPU_DIV_32 (SPI_USE_DOUBLESPEED | (2 << SPI_PRESCALER_gp)) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 64. */ - #define SPI_SPEED_FCPU_DIV_64 (2 << SPI_PRESCALER_gp) - - /** SPI prescaler mask for \ref SPI_Init(). Divides the system clock by a factor of 128. */ - #define SPI_SPEED_FCPU_DIV_128 (3 << SPI_PRESCALER_gp) - //@} - - /** \name SPI SCK Polarity Configuration Masks */ - //@{ - /** SPI clock polarity mask for \ref SPI_Init(). Indicates that the SCK should lead on the rising edge. */ - #define SPI_SCK_LEAD_RISING 0 - - /** SPI clock polarity mask for \ref SPI_Init(). Indicates that the SCK should lead on the falling edge. */ - #define SPI_SCK_LEAD_FALLING SPI_MODE1_bm - //@} - - /** \name SPI Sample Edge Configuration Masks */ - //@{ - /** SPI data sample mode mask for \ref SPI_Init(). Indicates that the data should sampled on the leading edge. */ - #define SPI_SAMPLE_LEADING 0 - - /** SPI data sample mode mask for \ref SPI_Init(). Indicates that the data should be sampled on the trailing edge. */ - #define SPI_SAMPLE_TRAILING SPI_MODE0_bm - //@} - - /** \name SPI Data Ordering Configuration Masks */ - //@{ - /** SPI data order mask for \ref SPI_Init(). Indicates that data should be shifted out MSB first. */ - #define SPI_ORDER_MSB_FIRST 0 - - /** SPI data order mask for \ref SPI_Init(). Indicates that data should be shifted out LSB first. */ - #define SPI_ORDER_LSB_FIRST SPI_DORD_bm - //@} - - /** \name SPI Mode Configuration Masks */ - //@{ - /** SPI mode mask for \ref SPI_Init(). Indicates that the SPI interface should be initialized into slave mode. */ - #define SPI_MODE_SLAVE 0 - - /** SPI mode mask for \ref SPI_Init(). Indicates that the SPI interface should be initialized into master mode. */ - #define SPI_MODE_MASTER SPI_MASTER_bm - //@} - - /* Inline Functions: */ - /** Initializes the SPI subsystem, ready for transfers. Must be called before calling any other - * SPI routines. - * - * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. - * \param[in] SPIOptions SPI Options, a mask consisting of one of each of the \c SPI_SPEED_*, - * \c SPI_SCK_*, \c SPI_SAMPLE_*, \c SPI_ORDER_* and \c SPI_MODE_* masks. - */ - static inline void SPI_Init(SPI_t* const SPI, - const uint8_t SPIOptions) - { - SPI->CTRL = (SPIOptions | SPI_ENABLE_bm); - } - - /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. - * - * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. - */ - static inline void SPI_Disable(SPI_t* const SPI) - { - SPI->CTRL &= ~SPI_ENABLE_bm; - } - - /** Retrieves the currently selected SPI mode, once the SPI interface has been configured. - * - * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. - * - * \return \ref SPI_MODE_MASTER if the interface is currently in SPI Master mode, \ref SPI_MODE_SLAVE otherwise - */ - static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI) ATTR_ALWAYS_INLINE; - static inline uint8_t SPI_GetCurrentMode(SPI_t* const SPI) - { - return (SPI->CTRL & SPI_MASTER_bm); - } - - /** Sends and receives a byte through the SPI interface, blocking until the transfer is complete. - * - * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. - * \param[in] Byte Byte to send through the SPI interface. - * - * \return Response byte from the attached SPI device. - */ - static inline uint8_t SPI_TransferByte(SPI_t* const SPI, - const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline uint8_t SPI_TransferByte(SPI_t* const SPI, - const uint8_t Byte) - { - SPI->DATA = Byte; - while (!(SPI->STATUS & SPI_IF_bm)); - return SPI->DATA; - } - - /** Sends a byte through the SPI interface, blocking until the transfer is complete. The response - * byte sent to from the attached SPI device is ignored. - * - * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. - * \param[in] Byte Byte to send through the SPI interface. - */ - static inline void SPI_SendByte(SPI_t* const SPI, - const uint8_t Byte) ATTR_ALWAYS_INLINE; - static inline void SPI_SendByte(SPI_t* const SPI, - const uint8_t Byte) - { - SPI->DATA = Byte; - while (!(SPI->STATUS & SPI_IF_bm)); - } - - /** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response - * byte from the attached SPI device is returned. - * - * \param[in,out] SPI Pointer to the base of the SPI peripheral within the device. - * - * \return The response byte from the attached SPI device. - */ - static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t SPI_ReceiveByte(SPI_t* const SPI) - { - SPI->DATA = 0; - while (!(SPI->STATUS & SPI_IF_bm)); - return SPI->DATA; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h deleted file mode 100644 index 6d0ea11153..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master SPI Mode Serial USART Peripheral Driver (XMEGA) - * - * On-chip Master SPI mode USART driver for the XMEGA AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the SPI Master - * Mode USART driver dispatch header located in LUFA/Drivers/Peripheral/Serial.h. - */ - -/** \ingroup Group_SerialSPI - * \defgroup Group_SerialSPI_XMEGA Master SPI Mode Serial USART Peripheral Driver (XMEGA) - * - * \section Sec_ModDescription Module Description - * On-chip serial USART driver for the XMEGA AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the ADC driver - * dispatch header located in LUFA/Drivers/Peripheral/SerialSPI.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the Master SPI mode USART driver before first use, with 1Mbit baud - * SerialSPI_Init(&USARTD0, (USART_SPI_SCK_LEAD_RISING | USART_SPI_SAMPLE_LEADING | USART_SPI_ORDER_MSB_FIRST), 1000000); - * - * // Send several bytes, ignoring the returned data - * SerialSPI_SendByte(&USARTD0, 0x01); - * SerialSPI_SendByte(&USARTD0, 0x02); - * SerialSPI_SendByte(&USARTD0, 0x03); - * - * // Receive several bytes, sending a dummy 0x00 byte each time - * uint8_t Byte1 = SerialSPI_ReceiveByte(&USARTD); - * uint8_t Byte2 = SerialSPI_ReceiveByte(&USARTD); - * uint8_t Byte3 = SerialSPI_ReceiveByte(&USARTD); - * - * // Send a byte, and store the received byte from the same transaction - * uint8_t ResponseByte = SerialSPI_TransferByte(&USARTD0, 0xDC); - * \endcode - * - * @{ - */ - -#ifndef __SERIAL_SPI_XMEGA_H__ -#define __SERIAL_SPI_XMEGA_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SERIAL_SPI_H) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/Serial.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - #define SERIAL_SPI_UBBRVAL(Baud) ((Baud < (F_CPU / 2)) ? ((F_CPU / (2 * Baud)) - 1) : 0) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name SPI SCK Polarity Configuration Masks */ - //@{ - /** SPI clock polarity mask for \ref SerialSPI_Init(). Indicates that the SCK should lead on the rising edge. */ - #define USART_SPI_SCK_LEAD_RISING 0 - //@} - - /** \name SPI Sample Edge Configuration Masks */ - //@{ - /** SPI data sample mode mask for \ref SerialSPI_Init(). Indicates that the data should sampled on the leading edge. */ - #define USART_SPI_SAMPLE_LEADING 0 - - /** SPI data sample mode mask for \ref SerialSPI_Init(). Indicates that the data should be sampled on the trailing edge. */ - #define USART_SPI_SAMPLE_TRAILING USART_UPCHA_bm - //@} - - /** \name SPI Data Ordering Configuration Masks */ - //@{ - /** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out MSB first. */ - #define USART_SPI_ORDER_MSB_FIRST 0 - - /** SPI data order mask for \ref SerialSPI_Init(). Indicates that data should be shifted out LSB first. */ - #define USART_SPI_ORDER_LSB_FIRST USART_UDORD_bm - //@} - - /* Inline Functions: */ - /** Initialize the USART module in Master SPI mode. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] SPIOptions USART SPI Options, a mask consisting of one of each of the \c USART_SPI_SCK_*, - * \c USART_SPI_SAMPLE_* and \c USART_SPI_ORDER_* masks. - * \param[in] BaudRate SPI baud rate, in bits per second. - */ - static inline void SerialSPI_Init(USART_t* const USART, - const uint8_t SPIOptions, - const uint32_t BaudRate) - { - uint16_t BaudValue = SERIAL_SPI_UBBRVAL(BaudRate); - - USART->BAUDCTRLB = (BaudValue >> 8); - USART->BAUDCTRLA = (BaudValue & 0xFF); - - USART->CTRLC = (USART_CMODE_MSPI_gc | SPIOptions); - USART->CTRLB = (USART_RXEN_bm | USART_TXEN_bm); - } - - /** Turns off the USART driver, disabling and returning used hardware to their default configuration. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - */ - static inline void SerialSPI_Disable(USART_t* const USART) - { - USART->CTRLA = 0; - USART->CTRLB = 0; - USART->CTRLC = 0; - } - - /** Sends and receives a byte through the USART SPI interface, blocking until the transfer is complete. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] DataByte Byte to send through the USART SPI interface. - * - * \return Response byte from the attached SPI device. - */ - static inline uint8_t SerialSPI_TransferByte(USART_t* const USART, - const uint8_t DataByte) - { - USART->DATA = DataByte; - while (!(USART->STATUS & USART_TXCIF_bm)); - USART->STATUS = USART_TXCIF_bm; - return USART->DATA; - } - - /** Sends a byte through the USART SPI interface, blocking until the transfer is complete. The response - * byte sent to from the attached SPI device is ignored. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] DataByte Byte to send through the USART SPI interface. - */ - static inline void SerialSPI_SendByte(USART_t* const USART, - const uint8_t DataByte) - { - SerialSPI_TransferByte(USART, DataByte); - } - - /** Sends a dummy byte through the USART SPI interface, blocking until the transfer is complete. The response - * byte from the attached SPI device is returned. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * - * \return The response byte from the attached SPI device. - */ - static inline uint8_t SerialSPI_ReceiveByte(USART_t* const USART) - { - return SerialSPI_TransferByte(USART, 0); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c deleted file mode 100644 index 51a4d049e5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_SERIAL_C -#include "../Serial.h" - -FILE USARTSerialStream; - -int Serial_putchar(char DataByte, - FILE *Stream) -{ - USART_t* USART = fdev_get_udata(Stream); - - Serial_SendByte(USART, DataByte); - return 0; -} - -int Serial_getchar(FILE *Stream) -{ - USART_t* USART = fdev_get_udata(Stream); - - if (!(Serial_IsCharReceived(USART))) - return _FDEV_EOF; - - return Serial_ReceiveByte(USART); -} - -int Serial_getchar_Blocking(FILE *Stream) -{ - USART_t* USART = fdev_get_udata(Stream); - - while (!(Serial_IsCharReceived(USART))); - return Serial_ReceiveByte(USART); -} - -void Serial_SendString_P(USART_t* const USART, - const char* FlashStringPtr) -{ - uint8_t CurrByte; - - while ((CurrByte = pgm_read_byte(FlashStringPtr)) != 0x00) - { - Serial_SendByte(USART, CurrByte); - FlashStringPtr++; - } -} - -void Serial_SendString(USART_t* const USART, - const char* StringPtr) -{ - uint8_t CurrByte; - - while ((CurrByte = *StringPtr) != 0x00) - { - Serial_SendByte(USART, CurrByte); - StringPtr++; - } -} - -void Serial_SendData(USART_t* const USART, - const uint8_t* Buffer, - uint16_t Length) -{ - while (Length--) - Serial_SendByte(USART, *(Buffer++)); -} - -void Serial_CreateStream(FILE* Stream) -{ - if (!(Stream)) - { - Stream = &USARTSerialStream; - stdin = Stream; - stdout = Stream; - } - - *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar, _FDEV_SETUP_RW); -} - -void Serial_CreateBlockingStream(FILE* Stream) -{ - if (!(Stream)) - { - Stream = &USARTSerialStream; - stdin = Stream; - stdout = Stream; - } - - *Stream = (FILE)FDEV_SETUP_STREAM(Serial_putchar, Serial_getchar_Blocking, _FDEV_SETUP_RW); -} - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h deleted file mode 100644 index 35b60d1502..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Serial USART Peripheral Driver (XMEGA) - * - * On-chip serial USART driver for the XMEGA AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the USART driver - * dispatch header located in LUFA/Drivers/Peripheral/Serial.h. - */ - -/** \ingroup Group_Serial - * \defgroup Group_Serial_XMEGA Serial USART Peripheral Driver (XMEGA) - * - * \section Sec_ModDescription Module Description - * On-chip serial USART driver for the XMEGA AVR microcontrollers. - * - * \note This file should not be included directly. It is automatically included as needed by the USART driver - * dispatch header located in LUFA/Drivers/Peripheral/Serial.h. - * - * \section Sec_ExampleUsage Example Usage - * The following snippet is an example of how this module may be used within a typical - * application. - * - * \code - * // Initialize the serial USART driver before first use, with 9600 baud (and no double-speed mode) - * Serial_Init(&USARTD0, 9600, false); - * - * // Send a string through the USART - * Serial_TxString(&USARTD0, "Test String\r\n"); - * - * // Receive a byte through the USART - * uint8_t DataByte = Serial_RxByte(&USARTD0); - * \endcode - * - * @{ - */ - -#ifndef __SERIAL_XMEGA_H__ -#define __SERIAL_XMEGA_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "../../Misc/TerminalCodes.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SERIAL_H) && !defined(__INCLUDE_FROM_SERIAL_C) - #error Do not include this file directly. Include LUFA/Drivers/Peripheral/Serial.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* External Variables: */ - extern FILE USARTSerialStream; - - /* Function Prototypes: */ - int Serial_putchar(char DataByte, - FILE *Stream); - int Serial_getchar(FILE *Stream); - int Serial_getchar_Blocking(FILE *Stream); - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Macro for calculating the baud value from a given baud rate when the \c U2X (double speed) bit is - * not set. - * - * \param[in] Baud Target serial UART baud rate. - * - * \return Closest UBRR register value for the given UART frequency. - */ - #define SERIAL_UBBRVAL(Baud) ((((F_CPU / 16) + (Baud / 2)) / (Baud)) - 1) - - /** Macro for calculating the baud value from a given baud rate when the \c U2X (double speed) bit is - * set. - * - * \param[in] Baud Target serial UART baud rate. - * - * \return Closest UBRR register value for the given UART frequency. - */ - #define SERIAL_2X_UBBRVAL(Baud) ((((F_CPU / 8) + (Baud / 2)) / (Baud)) - 1) - - /* Function Prototypes: */ - /** Transmits a given string located in program space (FLASH) through the USART. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] FlashStringPtr Pointer to a string located in program space. - */ - void Serial_SendString_P(USART_t* const USART, - const char* FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1); - - /** Transmits a given string located in SRAM memory through the USART. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] StringPtr Pointer to a string located in SRAM space. - */ - void Serial_SendString(USART_t* const USART, - const char* StringPtr) ATTR_NON_NULL_PTR_ARG(1); - - /** Transmits a given buffer located in SRAM memory through the USART. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] Buffer Pointer to a buffer containing the data to send. - * \param[in] Length Length of the data to send, in bytes. - */ - void Serial_SendData(USART_t* const USART, - const uint8_t* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Creates a standard character stream from the USART so that it can be used with all the regular functions - * in the avr-libc \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created - * stream is bidirectional and can be used for both input and output functions. - * - * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single - * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own - * line buffering. - * - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed, if \c NULL, \c stdout - * and \c stdin will be configured to use the USART. - * - * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. - */ - void Serial_CreateStream(FILE* Stream); - - /** Identical to \ref Serial_CreateStream(), except that reads are blocking until the calling stream function terminates - * the transfer. - * - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed, if \c NULL, \c stdout - * and \c stdin will be configured to use the USART. - * - * \pre The USART must first be configured via a call to \ref Serial_Init() before the stream is used. - */ - void Serial_CreateBlockingStream(FILE* Stream); - - /* Inline Functions: */ - /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to - * standard 8-bit, no parity, 1 stop bit settings suitable for most applications. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] BaudRate Serial baud rate, in bits per second. - * \param[in] DoubleSpeed Enables double speed mode when set, halving the sample time to double the baud rate. - */ - static inline void Serial_Init(USART_t* const USART, - const uint32_t BaudRate, - const bool DoubleSpeed) - { - uint16_t BaudValue = (DoubleSpeed ? SERIAL_2X_UBBRVAL(BaudRate) : SERIAL_UBBRVAL(BaudRate)); - - USART->BAUDCTRLB = (BaudValue >> 8); - USART->BAUDCTRLA = (BaudValue & 0xFF); - - USART->CTRLC = (USART_CMODE_ASYNCHRONOUS_gc | USART_PMODE_DISABLED_gc | USART_CHSIZE_8BIT_gc); - USART->CTRLB = (USART_RXEN_bm | USART_TXEN_bm | (DoubleSpeed ? USART_CLK2X_bm : 0)); - } - - /** Turns off the USART driver, disabling and returning used hardware to their default configuration. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - */ - static inline void Serial_Disable(USART_t* const USART) - { - USART->CTRLA = 0; - USART->CTRLB = 0; - USART->CTRLC = 0; - } - - /** Indicates whether a character has been received through the USART. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * - * \return Boolean \c true if a character has been received, \c false otherwise. - */ - static inline bool Serial_IsCharReceived(USART_t* const USART) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Serial_IsCharReceived(USART_t* const USART) - { - return ((USART->STATUS & USART_RXCIF_bm) ? true : false); - } - - /** Transmits a given byte through the USART. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * \param[in] DataByte Byte to transmit through the USART. - */ - static inline void Serial_SendByte(USART_t* const USART, - const char DataByte) ATTR_ALWAYS_INLINE; - static inline void Serial_SendByte(USART_t* const USART, - const char DataByte) - { - while (!(USART->STATUS & USART_DREIF_bm)); - USART->DATA = DataByte; - } - - /** Receives the next byte from the USART. - * - * \param[in,out] USART Pointer to the base of the USART peripheral within the device. - * - * \return Next byte received from the USART, or a negative value if no byte has been received. - */ - static inline int16_t Serial_ReceiveByte(USART_t* const USART) ATTR_ALWAYS_INLINE; - static inline int16_t Serial_ReceiveByte(USART_t* const USART) - { - if (!(Serial_IsCharReceived(USART))) - return -1; - - USART->STATUS = USART_RXCIF_bm; - return USART->DATA; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h deleted file mode 100644 index 2f2fa5bc77..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB Android Open Accessory Class driver. - * - * Master include file for the library USB Android Open Accessory Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassAOA Android Open Accessory Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Android Open Accessory Class Driver module. This module contains an internal implementation of the USB Android Open Accessory - * Class, for Host USB mode. User applications can use this class driver instead of implementing the Android Open Accessory Class - * manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Host using the USB Android Open Accessory Class. - * - * @{ - */ - -#ifndef _AOA_CLASS_H_ -#define _AOA_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_AOA_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_HOST) - #include "Host/AndroidAccessoryClassHost.h" - #endif - -#endif - -/** @} */ - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h deleted file mode 100644 index 91aa22f3bb..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB Audio 1.0 Class driver. - * - * Master include file for the library USB Audio 1.0 Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassAudio Audio 1.0 Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/AudioClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/AudioClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Audio 1.0 Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for both - * Device and Host USB modes. User applications can use this class driver instead of implementing the Audio 1.0 class - * manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Hosts or Devices using the USB Audio 1.0 Class. - * - * @{ - */ - -#ifndef _AUDIO_CLASS_H_ -#define _AUDIO_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_AUDIO_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "Device/AudioClassDevice.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "Host/AudioClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h deleted file mode 100644 index 6bfd384887..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB CDC-ACM Class driver. - * - * Master include file for the library USB CDC Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassCDC CDC-ACM (Virtual Serial) Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/CDCClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/CDCClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * CDC Class Driver module. This module contains an internal implementation of the USB CDC-ACM class Virtual Serial - * Ports, for both Device and Host USB modes. User applications can use this class driver instead of implementing the - * CDC class manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Hosts or Devices using the USB CDC Class. - * - * @{ - */ - -#ifndef _CDC_CLASS_H_ -#define _CDC_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_CDC_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "Device/CDCClassDevice.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "Host/CDCClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h deleted file mode 100644 index db97f4888f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB Android Open Accessory Class driver. - * - * Common definitions and declarations for the library USB Android Open Accessory Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAOA - * \defgroup Group_USBClassAOACommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * Android Open Accessory Class. - * - * @{ - */ - -#ifndef _AOA_CLASS_COMMON_H_ -#define _AOA_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AOA_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory mode. */ - #define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00 - - /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory and Android Debug mode. */ - #define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01 - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the - * Android Open Accessory class. - */ - enum AOA_Descriptor_ClassSubclassProtocol_t - { - AOA_CSCP_AOADataClass = 0xFF, /**< Descriptor Class value indicating that the device or interface - * belongs to the AOA data class. - */ - AOA_CSCP_AOADataSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device or interface - * belongs to AOA data subclass. - */ - AOA_CSCP_AOADataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the AOA data class protocol. - */ - }; - - /** Enum for the Android Open Accessory class specific control requests that can be issued by the USB bus host. */ - enum AOA_ClassRequests_t - { - AOA_REQ_GetAccessoryProtocol = 0x33, /**< Android Open Accessory control request to retrieve the device's supported Accessory Protocol version. */ - AOA_REQ_SendString = 0x34, /**< Android Open Accessory control request to set an accessory property string in the device. */ - AOA_REQ_StartAccessoryMode = 0x35, /**< Android Open Accessory control request to switch the device into Accessory mode. */ - }; - - /** Enum for the possible Android Open Accessory property string indexes. */ - enum AOA_Strings_t - { - AOA_STRING_Manufacturer = 0, /**< Index of the Manufacturer property string. */ - AOA_STRING_Model = 1, /**< Index of the Model Name property string. */ - AOA_STRING_Description = 2, /**< Index of the Description property string. */ - AOA_STRING_Version = 3, /**< Index of the Version Number property string. */ - AOA_STRING_URI = 4, /**< Index of the URI Information property string. */ - AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */ - - #if !defined(__DOXYGEN__) - AOA_STRING_TOTAL_STRINGS - #endif - }; - - /** Enum for the possible Android Open Accessory protocol versions. */ - enum AOA_Protocols_t - { - AOA_PROTOCOL_AccessoryV1 = 0x0001, /**< Android Open Accessory version 1. */ - }; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h deleted file mode 100644 index f33fef68aa..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h +++ /dev/null @@ -1,774 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB Audio 1.0 Class driver. - * - * Common definitions and declarations for the library USB Audio 1.0 Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAudio - * \defgroup Group_USBClassAudioCommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * Audio 1.0 Class. - * - * @{ - */ - -#ifndef _AUDIO_CLASS_COMMON_H_ -#define _AUDIO_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AUDIO_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** \name Audio Channel Masks */ - //@{ - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_LEFT_FRONT (1 << 0) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_RIGHT_FRONT (1 << 1) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_CENTER_FRONT (1 << 2) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_LOW_FREQ_ENHANCE (1 << 3) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_LEFT_SURROUND (1 << 4) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_RIGHT_SURROUND (1 << 5) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_LEFT_OF_CENTER (1 << 6) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_RIGHT_OF_CENTER (1 << 7) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_SURROUND (1 << 8) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_SIDE_LEFT (1 << 9) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_SIDE_RIGHT (1 << 10) - - /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_CHANNEL_TOP (1 << 11) - //@} - - /** \name Audio Feature Masks */ - //@{ - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_MUTE (1 << 0) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_VOLUME (1 << 1) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_BASS (1 << 2) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_MID (1 << 3) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_TREBLE (1 << 4) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_GRAPHIC_EQUALIZER (1 << 5) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_AUTOMATIC_GAIN (1 << 6) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_DELAY (1 << 7) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_BASS_BOOST (1 << 8) - - /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ - #define AUDIO_FEATURE_BASS_LOUDNESS (1 << 9) - //@} - - /** \name Audio Terminal Types */ - //@{ - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_UNDEFINED 0x0100 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_STREAMING 0x0101 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_VENDOR 0x01FF - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_UNDEFINED 0x0200 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_MIC 0x0201 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_PERSONAL_MIC 0x0203 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_MIC_ARRAY 0x0205 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_IN_OUT_UNDEFINED 0x0300 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_SPEAKER 0x0301 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_HEADPHONES 0x0302 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_DESKTOP 0x0304 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_ROOM 0x0305 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_COMMUNICATION 0x0306 - - /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */ - #define AUDIO_TERMINAL_OUT_LOWFREQ 0x0307 - //@} - - /** Convenience macro to fill a 24-bit \ref USB_Audio_SampleFreq_t structure with the given sample rate as a 24-bit number. - * - * \param[in] freq Required audio sampling frequency in HZ - */ - #define AUDIO_SAMPLE_FREQ(freq) {.Byte1 = ((uint32_t)freq & 0xFF), .Byte2 = (((uint32_t)freq >> 8) & 0xFF), .Byte3 = (((uint32_t)freq >> 16) & 0xFF)} - - /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint - * accepts only filled endpoint packets of audio samples. - */ - #define AUDIO_EP_FULL_PACKETS_ONLY (1 << 7) - - /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint - * will accept partially filled endpoint packets of audio samples. - */ - #define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7) - - /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint - * allows for sampling frequency adjustments to be made via control requests directed at the endpoint. - */ - #define AUDIO_EP_SAMPLE_FREQ_CONTROL (1 << 0) - - /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint - * allows for pitch adjustments to be made via control requests directed at the endpoint. - */ - #define AUDIO_EP_PITCH_CONTROL (1 << 1) - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Audio - * device class. - */ - enum Audio_Descriptor_ClassSubclassProtocol_t - { - AUDIO_CSCP_AudioClass = 0x01, /**< Descriptor Class value indicating that the device or - * interface belongs to the USB Audio 1.0 class. - */ - AUDIO_CSCP_ControlSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or - * interface belongs to the Audio Control subclass. - */ - AUDIO_CSCP_ControlProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or - * interface belongs to the Audio Control protocol. - */ - AUDIO_CSCP_AudioStreamingSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or - * interface belongs to the MIDI Streaming subclass. - */ - AUDIO_CSCP_MIDIStreamingSubclass = 0x03, /**< Descriptor Subclass value indicating that the device or - * interface belongs to the Audio streaming subclass. - */ - AUDIO_CSCP_StreamingProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or - * interface belongs to the Streaming Audio protocol. - */ - }; - - /** Audio class specific interface description subtypes, for the Audio Control interface. */ - enum Audio_CSInterface_AC_SubTypes_t - { - AUDIO_DSUBTYPE_CSInterface_Header = 0x01, /**< Audio class specific control interface header. */ - AUDIO_DSUBTYPE_CSInterface_InputTerminal = 0x02, /**< Audio class specific control interface Input Terminal. */ - AUDIO_DSUBTYPE_CSInterface_OutputTerminal = 0x03, /**< Audio class specific control interface Output Terminal. */ - AUDIO_DSUBTYPE_CSInterface_Mixer = 0x04, /**< Audio class specific control interface Mixer Unit. */ - AUDIO_DSUBTYPE_CSInterface_Selector = 0x05, /**< Audio class specific control interface Selector Unit. */ - AUDIO_DSUBTYPE_CSInterface_Feature = 0x06, /**< Audio class specific control interface Feature Unit. */ - AUDIO_DSUBTYPE_CSInterface_Processing = 0x07, /**< Audio class specific control interface Processing Unit. */ - AUDIO_DSUBTYPE_CSInterface_Extension = 0x08, /**< Audio class specific control interface Extension Unit. */ - }; - - /** Audio class specific interface description subtypes, for the Audio Streaming interface. */ - enum Audio_CSInterface_AS_SubTypes_t - { - AUDIO_DSUBTYPE_CSInterface_General = 0x01, /**< Audio class specific streaming interface general descriptor. */ - AUDIO_DSUBTYPE_CSInterface_FormatType = 0x02, /**< Audio class specific streaming interface format type descriptor. */ - AUDIO_DSUBTYPE_CSInterface_FormatSpecific = 0x03, /**< Audio class specific streaming interface format information descriptor. */ - }; - - /** Audio class specific endpoint description subtypes, for the Audio Streaming interface. */ - enum Audio_CSEndpoint_SubTypes_t - { - AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */ - }; - - /** Enum for the Audio class specific control requests that can be issued by the USB bus host. */ - enum Audio_ClassRequests_t - { - AUDIO_REQ_SetCurrent = 0x01, /**< Audio class-specific request to set the current value of a parameter within the device. */ - AUDIO_REQ_SetMinimum = 0x02, /**< Audio class-specific request to set the minimum value of a parameter within the device. */ - AUDIO_REQ_SetMaximum = 0x03, /**< Audio class-specific request to set the maximum value of a parameter within the device. */ - AUDIO_REQ_SetResolution = 0x04, /**< Audio class-specific request to set the resolution value of a parameter within the device. */ - AUDIO_REQ_SetMemory = 0x05, /**< Audio class-specific request to set the memory value of a parameter within the device. */ - AUDIO_REQ_GetCurrent = 0x81, /**< Audio class-specific request to get the current value of a parameter within the device. */ - AUDIO_REQ_GetMinimum = 0x82, /**< Audio class-specific request to get the minimum value of a parameter within the device. */ - AUDIO_REQ_GetMaximum = 0x83, /**< Audio class-specific request to get the maximum value of a parameter within the device. */ - AUDIO_REQ_GetResolution = 0x84, /**< Audio class-specific request to get the resolution value of a parameter within the device. */ - AUDIO_REQ_GetMemory = 0x85, /**< Audio class-specific request to get the memory value of a parameter within the device. */ - AUDIO_REQ_GetStatus = 0xFF, /**< Audio class-specific request to get the device status. */ - }; - - /** Enum for Audio class specific Endpoint control modifiers which can be set and retrieved by a USB host, if the corresponding - * endpoint control is indicated to be supported in the Endpoint's Audio-class specific endpoint descriptor. - */ - enum Audio_EndpointControls_t - { - AUDIO_EPCONTROL_SamplingFreq = 0x01, /**< Sampling frequency adjustment of the endpoint. */ - AUDIO_EPCONTROL_Pitch = 0x02, /**< Pitch adjustment of the endpoint. */ - }; - - /* Type Defines: */ - /** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device - * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example, - * a USB endpoint). See the USB Audio specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_InputTerminal_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal. - */ - - uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ - uint16_t TerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */ - uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals - * such as the speaker and microphone of a phone handset. - */ - uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ - uint16_t ChannelConfig; /**< \c CHANNEL_* masks indicating what channel layout is supported by this terminal. */ - - uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device. */ - uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_Audio_Descriptor_InputTerminal_t; - - /** \brief Audio class-specific Input Terminal Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device - * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example, - * a USB endpoint). See the USB Audio specification for more details. - * - * \see \ref USB_Audio_Descriptor_InputTerminal_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal. - */ - uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ - uint16_t wTerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */ - uint8_t bAssocTerminal; /**< ID of associated output terminal, for physically grouped terminals - * such as the speaker and microphone of a phone handset. - */ - uint8_t bNrChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ - uint16_t wChannelConfig; /**< \c CHANNEL_* masks indicating what channel layout is supported by this terminal. */ - - uint8_t iChannelNames; /**< Index of a string descriptor describing this channel within the device. */ - uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_Audio_StdDescriptor_InputTerminal_t; - - /** \brief Audio class-specific Output Terminal Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device - * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example, - * a USB endpoint). See the USB Audio specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_OutputTerminal_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal. - */ - - uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ - uint16_t TerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */ - uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals - * such as the speaker and microphone of a phone handset. - */ - uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from. */ - - uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_Audio_Descriptor_OutputTerminal_t; - - /** \brief Audio class-specific Output Terminal Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device - * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example, - * a USB endpoint). See the USB Audio specification for more details. - * - * \see \ref USB_Audio_Descriptor_OutputTerminal_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSInterface_AC_SubTypes_t enum. - */ - uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ - uint16_t wTerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */ - uint8_t bAssocTerminal; /**< ID of associated input terminal, for physically grouped terminals - * such as the speaker and microphone of a phone handset. - */ - uint8_t bSourceID; /**< ID value of the unit this terminal's audio is sourced from. */ - - uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_Audio_StdDescriptor_OutputTerminal_t; - - /** \brief Audio class-specific Interface Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to - * supply extra information about the audio device's layout to the host. See the USB Audio specification for more - * details. - * - * \see \ref USB_Audio_StdDescriptor_Interface_AC_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. - */ - - uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */ - uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ - - uint8_t InCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */ - uint8_t InterfaceNumber; /**< Interface number of the associated Audio Streaming interface. */ - } ATTR_PACKED USB_Audio_Descriptor_Interface_AC_t; - - /** \brief Audio class-specific Interface Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific interface descriptor. This follows a regular interface descriptor to - * supply extra information about the audio device's layout to the host. See the USB Audio specification for more - * details. - * - * \see \ref USB_Audio_Descriptor_Interface_AC_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype;/**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. - */ - - uint16_t bcdADC; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */ - uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ - - uint8_t bInCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */ - uint8_t bInterfaceNumbers; /**< Interface number of the associated Audio Streaming interface. */ - } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AC_t; - - /** \brief Audio class-specific Feature Unit Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features - * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio - * specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_FeatureUnit_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_Feature. - */ - - uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device. */ - uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit. */ - - uint8_t ControlSize; /**< Size of each element in the \c ChannelControls array. */ - uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */ - - uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_Audio_Descriptor_FeatureUnit_t; - - /** \brief Audio class-specific Feature Unit Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features - * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio - * specification for more details. - * - * \see \ref USB_Audio_Descriptor_FeatureUnit_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_Feature. - */ - - uint8_t bUnitID; /**< ID value of this feature unit - must be a unique value within the device. */ - uint8_t bSourceID; /**< Source ID value of the audio source input into this feature unit. */ - - uint8_t bControlSize; /**< Size of each element in the \c ChannelControls array. */ - uint8_t bmaControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */ - - uint8_t iFeature; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_Audio_StdDescriptor_FeatureUnit_t; - - /** \brief Audio class-specific Streaming Audio Interface Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific streaming interface descriptor. This indicates to the host - * how audio streams within the device are formatted. See the USB Audio specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_Interface_AS_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. - */ - - uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing. */ - - uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */ - uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification. */ - } ATTR_PACKED USB_Audio_Descriptor_Interface_AS_t; - - /** \brief Audio class-specific Streaming Audio Interface Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific streaming interface descriptor. This indicates to the host - * how audio streams within the device are formatted. See the USB Audio specification for more details. - * - * \see \ref USB_Audio_Descriptor_Interface_AS_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. - */ - - uint8_t bTerminalLink; /**< ID value of the output terminal this descriptor is describing. */ - - uint8_t bDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */ - uint16_t wFormatTag; /**< Format of the audio stream, see Audio Device Formats specification. */ - } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AS_t; - - /** \brief Audio class-specific Format Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details - * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used - * in the device's audio streams. See the USB Audio specification for more details. - * - * \attention This descriptor must be followed by one or more \ref USB_Audio_SampleFreq_t elements containing - * the continuous or discrete sample frequencies. - * - * \see \ref USB_Audio_StdDescriptor_Format_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType. - */ - - uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification. */ - uint8_t Channels; /**< Total number of discrete channels in the stream. */ - - uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */ - uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream. */ - - uint8_t TotalDiscreteSampleRates; /**< Total number of discrete sample frequencies supported by the device. When - * zero, this must be followed by the lower and upper continuous sampling - * frequencies supported by the device; otherwise, this must be followed - * by the given number of discrete sampling frequencies supported. - */ - } ATTR_PACKED USB_Audio_Descriptor_Format_t; - - /** \brief 24-Bit Audio Frequency Structure. - * - * Type define for a 24bit audio sample frequency structure. As GCC does not contain a built in 24-bit datatype, - * this this structure is used to build up the value instead. Fill this structure with the \ref AUDIO_SAMPLE_FREQ() macro. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t Byte1; /**< Lowest 8 bits of the 24-bit value. */ - uint8_t Byte2; /**< Middle 8 bits of the 24-bit value. */ - uint8_t Byte3; /**< Upper 8 bits of the 24-bit value. */ - } ATTR_PACKED USB_Audio_SampleFreq_t; - - /** \brief Audio class-specific Format Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details - * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used - * in the device's audio streams. See the USB Audio specification for more details. - * - * \attention This descriptor must be followed by one or more 24-bit integer elements containing the continuous - * or discrete sample frequencies. - * - * \see \ref USB_Audio_Descriptor_Format_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors, - * must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType. - */ - - uint8_t bDescriptorSubtype;/**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. - */ - - uint8_t bFormatType; /**< Format of the audio stream, see Audio Device Formats specification. */ - uint8_t bNrChannels; /**< Total number of discrete channels in the stream. */ - - uint8_t bSubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */ - uint8_t bBitResolution; /**< Bits of resolution of each channel's samples in the stream. */ - - uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. When - * zero, this must be followed by the lower and upper continuous sampling - * frequencies supported by the device; otherwise, this must be followed - * by the given number of discrete sampling frequencies supported. - */ - } ATTR_PACKED USB_Audio_StdDescriptor_Format_t; - - /** \brief Audio class-specific Streaming Endpoint Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint - * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_StreamEndpoint_Std_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint. */ - - uint8_t Refresh; /**< Always set to zero for Audio class devices. */ - uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */ - } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Std_t; - - /** \brief Audio class-specific Streaming Endpoint Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint - * descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details. - * - * \see \ref USB_Audio_Descriptor_StreamEndpoint_Std_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a - * value given by the specific class. - */ - uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current - * configuration, including direction mask. - */ - uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (\c EP_TYPE_*) - * and attributes (\c ENDPOINT_ATTR_*) masks. - */ - uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size - * that the endpoint can receive at a time. - */ - uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or - * ISOCHRONOUS type. - */ - - uint8_t bRefresh; /**< Always set to zero for Audio class devices. */ - uint8_t bSynchAddress; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */ - } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Std_t; - - /** \brief Audio class-specific Extended Endpoint Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific extended endpoint descriptor. This contains extra information - * on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio - * class-specific extended endpoint descriptor. See the USB Audio specification for more details. - * - * \see \ref USB_Audio_StdDescriptor_StreamEndpoint_Spc_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSEndpoint_SubTypes_t enum. - */ - - uint8_t Attributes; /**< Audio class-specific endpoint attributes, such as \ref AUDIO_EP_FULL_PACKETS_ONLY. */ - - uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */ - uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */ - } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Spc_t; - - /** \brief Audio class-specific Extended Endpoint Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific extended endpoint descriptor. This contains extra information - * on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio - * class-specific extended endpoint descriptor. See the USB Audio specification for more details. - * - * \see \ref USB_Audio_Descriptor_StreamEndpoint_Spc_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, - * a value from the \ref Audio_CSEndpoint_SubTypes_t enum. - */ - - uint8_t bmAttributes; /**< Audio class-specific endpoint attributes, such as \ref AUDIO_EP_FULL_PACKETS_ONLY. */ - - uint8_t bLockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */ - uint16_t wLockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */ - } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Spc_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h deleted file mode 100644 index f14a766cde..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h +++ /dev/null @@ -1,386 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB CDC Class driver. - * - * Common definitions and declarations for the library USB CDC Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassCDC - * \defgroup Group_USBClassCDCCommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * CDC Class. - * - * @{ - */ - -#ifndef _CDC_CLASS_COMMON_H_ -#define _CDC_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_CDC_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** \name Virtual Control Line Masks */ - //@{ - /** Mask for the DTR handshake line for use with the \ref CDC_REQ_SetControlLineState class-specific request - * from the host, to indicate that the DTR line state should be high. - */ - #define CDC_CONTROL_LINE_OUT_DTR (1 << 0) - - /** Mask for the RTS handshake line for use with the \ref CDC_REQ_SetControlLineState class-specific request - * from the host, to indicate that the RTS line state should be high. - */ - #define CDC_CONTROL_LINE_OUT_RTS (1 << 1) - - /** Mask for the DCD handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification - * from the device to the host, to indicate that the DCD line state is currently high. - */ - #define CDC_CONTROL_LINE_IN_DCD (1 << 0) - - /** Mask for the DSR handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification - * from the device to the host, to indicate that the DSR line state is currently high. - */ - #define CDC_CONTROL_LINE_IN_DSR (1 << 1) - - /** Mask for the BREAK handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification - * from the device to the host, to indicate that the BREAK line state is currently high. - */ - #define CDC_CONTROL_LINE_IN_BREAK (1 << 2) - - /** Mask for the RING handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification - * from the device to the host, to indicate that the RING line state is currently high. - */ - #define CDC_CONTROL_LINE_IN_RING (1 << 3) - - /** Mask for use with the \ref CDC_NOTIF_SerialState class-specific notification from the device to the host, - * to indicate that a framing error has occurred on the virtual serial port. - */ - #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4) - - /** Mask for use with the \ref CDC_NOTIF_SerialState class-specific notification from the device to the host, - * to indicate that a parity error has occurred on the virtual serial port. - */ - #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5) - - /** Mask for use with the \ref CDC_NOTIF_SerialState class-specific notification from the device to the host, - * to indicate that a data overrun error has occurred on the virtual serial port. - */ - #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6) - //@} - - /** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a - * uniform structure but variable sized data payloads, thus cannot be represented accurately by - * a single typedef struct. A macro is used instead so that functional descriptors can be created - * easily by specifying the size of the payload. This allows \c sizeof() to work correctly. - * - * \param[in] DataSize Size in bytes of the CDC functional descriptor's data payload. - */ - #define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \ - struct \ - { \ - USB_Descriptor_Header_t Header; \ - uint8_t SubType; \ - uint8_t Data[DataSize]; \ - } - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the CDC - * device class. - */ - enum CDC_Descriptor_ClassSubclassProtocol_t - { - CDC_CSCP_CDCClass = 0x02, /**< Descriptor Class value indicating that the device or interface - * belongs to the CDC class. - */ - CDC_CSCP_NoSpecificSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface - * belongs to no specific subclass of the CDC class. - */ - CDC_CSCP_ACMSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or interface - * belongs to the Abstract Control Model CDC subclass. - */ - CDC_CSCP_ATCommandProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the AT Command protocol of the CDC class. - */ - CDC_CSCP_NoSpecificProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface - * belongs to no specific protocol of the CDC class. - */ - CDC_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Protocol value indicating that the device or interface - * belongs to a vendor-specific protocol of the CDC class. - */ - CDC_CSCP_CDCDataClass = 0x0A, /**< Descriptor Class value indicating that the device or interface - * belongs to the CDC Data class. - */ - CDC_CSCP_NoDataSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface - * belongs to no specific subclass of the CDC data class. - */ - CDC_CSCP_NoDataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface - * belongs to no specific protocol of the CDC data class. - */ - }; - - /** Enum for the CDC class specific control requests that can be issued by the USB bus host. */ - enum CDC_ClassRequests_t - { - CDC_REQ_SendEncapsulatedCommand = 0x00, /**< CDC class-specific request to send an encapsulated command to the device. */ - CDC_REQ_GetEncapsulatedResponse = 0x01, /**< CDC class-specific request to retrieve an encapsulated command response from the device. */ - CDC_REQ_SetLineEncoding = 0x20, /**< CDC class-specific request to set the current virtual serial port configuration settings. */ - CDC_REQ_GetLineEncoding = 0x21, /**< CDC class-specific request to get the current virtual serial port configuration settings. */ - CDC_REQ_SetControlLineState = 0x22, /**< CDC class-specific request to set the current virtual serial port handshake line states. */ - CDC_REQ_SendBreak = 0x23, /**< CDC class-specific request to send a break to the receiver via the carrier channel. */ - }; - - /** Enum for the CDC class specific notification requests that can be issued by a CDC device to a host. */ - enum CDC_ClassNotifications_t - { - CDC_NOTIF_SerialState = 0x20, /**< Notification type constant for a change in the virtual serial port - * handshake line states, for use with a \ref USB_Request_Header_t - * notification structure when sent to the host via the CDC notification - * endpoint. - */ - }; - - /** Enum for the CDC class specific interface descriptor subtypes. */ - enum CDC_DescriptorSubtypes_t - { - CDC_DSUBTYPE_CSInterface_Header = 0x00, /**< CDC class-specific Header functional descriptor. */ - CDC_DSUBTYPE_CSInterface_CallManagement = 0x01, /**< CDC class-specific Call Management functional descriptor. */ - CDC_DSUBTYPE_CSInterface_ACM = 0x02, /**< CDC class-specific Abstract Control Model functional descriptor. */ - CDC_DSUBTYPE_CSInterface_DirectLine = 0x03, /**< CDC class-specific Direct Line functional descriptor. */ - CDC_DSUBTYPE_CSInterface_TelephoneRinger = 0x04, /**< CDC class-specific Telephone Ringer functional descriptor. */ - CDC_DSUBTYPE_CSInterface_TelephoneCall = 0x05, /**< CDC class-specific Telephone Call functional descriptor. */ - CDC_DSUBTYPE_CSInterface_Union = 0x06, /**< CDC class-specific Union functional descriptor. */ - CDC_DSUBTYPE_CSInterface_CountrySelection = 0x07, /**< CDC class-specific Country Selection functional descriptor. */ - CDC_DSUBTYPE_CSInterface_TelephoneOpModes = 0x08, /**< CDC class-specific Telephone Operation Modes functional descriptor. */ - CDC_DSUBTYPE_CSInterface_USBTerminal = 0x09, /**< CDC class-specific USB Terminal functional descriptor. */ - CDC_DSUBTYPE_CSInterface_NetworkChannel = 0x0A, /**< CDC class-specific Network Channel functional descriptor. */ - CDC_DSUBTYPE_CSInterface_ProtocolUnit = 0x0B, /**< CDC class-specific Protocol Unit functional descriptor. */ - CDC_DSUBTYPE_CSInterface_ExtensionUnit = 0x0C, /**< CDC class-specific Extension Unit functional descriptor. */ - CDC_DSUBTYPE_CSInterface_MultiChannel = 0x0D, /**< CDC class-specific Multi-Channel Management functional descriptor. */ - CDC_DSUBTYPE_CSInterface_CAPI = 0x0E, /**< CDC class-specific Common ISDN API functional descriptor. */ - CDC_DSUBTYPE_CSInterface_Ethernet = 0x0F, /**< CDC class-specific Ethernet functional descriptor. */ - CDC_DSUBTYPE_CSInterface_ATM = 0x10, /**< CDC class-specific Asynchronous Transfer Mode functional descriptor. */ - }; - - /** Enum for the possible line encoding formats of a virtual serial port. */ - enum CDC_LineEncodingFormats_t - { - CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit. */ - CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits. */ - CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits. */ - }; - - /** Enum for the possible line encoding parity settings of a virtual serial port. */ - enum CDC_LineEncodingParity_t - { - CDC_PARITY_None = 0, /**< No parity bit mode on each frame. */ - CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame. */ - CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame. */ - CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame. */ - CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame. */ - }; - - /* Type Defines: */ - /** \brief CDC class-specific Functional Header Descriptor (LUFA naming conventions). - * - * Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device - * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. - * See the CDC class specification for more details. - * - * \see \ref USB_CDC_StdDescriptor_FunctionalHeader_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors, - * must be \ref CDC_DSUBTYPE_CSInterface_Header. - */ - uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device, - * encoded in BCD format. - */ - } ATTR_PACKED USB_CDC_Descriptor_FunctionalHeader_t; - - /** \brief CDC class-specific Functional Header Descriptor (USB-IF naming conventions). - * - * Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device - * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. - * See the CDC class specification for more details. - * - * \see \ref USB_CDC_Descriptor_FunctionalHeader_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint8_t bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, - * must be \ref CDC_DSUBTYPE_CSInterface_Header. - */ - uint16_t bcdCDC; /**< Version number of the CDC specification implemented by the device, encoded in BCD format. */ - } ATTR_PACKED USB_CDC_StdDescriptor_FunctionalHeader_t; - - /** \brief CDC class-specific Functional ACM Descriptor (LUFA naming conventions). - * - * Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface - * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. - * - * \see \ref USB_CDC_StdDescriptor_FunctionalACM_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors, - * must be \ref CDC_DSUBTYPE_CSInterface_ACM. - */ - uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. For most devices, - * this should be set to a fixed value of 0x06 - for other capabilities, refer - * to the CDC ACM specification. - */ - } ATTR_PACKED USB_CDC_Descriptor_FunctionalACM_t; - - /** \brief CDC class-specific Functional ACM Descriptor (USB-IF naming conventions). - * - * Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface - * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. - * - * \see \ref USB_CDC_Descriptor_FunctionalACM_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint8_t bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, - * must be \ref CDC_DSUBTYPE_CSInterface_ACM. - */ - uint8_t bmCapabilities; /**< Capabilities of the ACM interface, given as a bit mask. For most devices, - * this should be set to a fixed value of 0x06 - for other capabilities, refer - * to the CDC ACM specification. - */ - } ATTR_PACKED USB_CDC_StdDescriptor_FunctionalACM_t; - - /** \brief CDC class-specific Functional Union Descriptor (LUFA naming conventions). - * - * Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific - * CDC control and data interfaces are related. See the CDC class specification for more details. - * - * \see \ref USB_CDC_StdDescriptor_FunctionalUnion_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors, - * must be \ref CDC_DSUBTYPE_CSInterface_Union. - */ - uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */ - uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */ - } ATTR_PACKED USB_CDC_Descriptor_FunctionalUnion_t; - - /** \brief CDC class-specific Functional Union Descriptor (USB-IF naming conventions). - * - * Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific - * CDC control and data interfaces are related. See the CDC class specification for more details. - * - * \see \ref USB_CDC_Descriptor_FunctionalUnion_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint8_t bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, - * must be \ref CDC_DSUBTYPE_CSInterface_Union. - */ - uint8_t bMasterInterface; /**< Interface number of the CDC Control interface. */ - uint8_t bSlaveInterface0; /**< Interface number of the CDC Data interface. */ - } ATTR_PACKED USB_CDC_StdDescriptor_FunctionalUnion_t; - - /** \brief CDC Virtual Serial Port Line Encoding Settings Structure. - * - * Type define for a CDC Line Encoding structure, used to hold the various encoding parameters for a virtual - * serial port. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */ - uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the - * \ref CDC_LineEncodingFormats_t enum. - */ - uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the - * \ref CDC_LineEncodingParity_t enum. - */ - uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */ - } ATTR_PACKED CDC_LineEncoding_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h deleted file mode 100644 index bc5cb46520..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h +++ /dev/null @@ -1,655 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB HID Class driver. - * - * Common definitions and declarations for the library USB HID Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassHID - * \defgroup Group_USBClassHIDCommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * HID Class. - * - * @{ - */ - -#ifndef _HID_CLASS_COMMON_H_ -#define _HID_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - #include "HIDParser.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_HID_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** \name Keyboard Standard Report Modifier Masks */ - //@{ - /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_LEFTCTRL (1 << 0) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_LEFTSHIFT (1 << 1) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_LEFTALT (1 << 2) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_LEFTGUI (1 << 3) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_RIGHTCTRL (1 << 4) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_RIGHTSHIFT (1 << 5) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_RIGHTALT (1 << 6) - - /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */ - #define HID_KEYBOARD_MODIFIER_RIGHTGUI (1 << 7) - //@} - - /** \name Keyboard Standard Report LED Masks */ - //@{ - /** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */ - #define HID_KEYBOARD_LED_NUMLOCK (1 << 0) - - /** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */ - #define HID_KEYBOARD_LED_CAPSLOCK (1 << 1) - - /** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */ - #define HID_KEYBOARD_LED_SCROLLLOCK (1 << 2) - - /** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */ - #define HID_KEYBOARD_LED_KATANA (1 << 3) - //@} - - /** \name Keyboard Standard Report Key Scan-codes */ - //@{ - #define HID_KEYBOARD_SC_ERROR_ROLLOVER 0x01 - #define HID_KEYBOARD_SC_POST_FAIL 0x02 - #define HID_KEYBOARD_SC_ERROR_UNDEFINED 0x03 - #define HID_KEYBOARD_SC_A 0x04 - #define HID_KEYBOARD_SC_B 0x05 - #define HID_KEYBOARD_SC_C 0x06 - #define HID_KEYBOARD_SC_D 0x07 - #define HID_KEYBOARD_SC_E 0x08 - #define HID_KEYBOARD_SC_F 0x09 - #define HID_KEYBOARD_SC_G 0x0A - #define HID_KEYBOARD_SC_H 0x0B - #define HID_KEYBOARD_SC_I 0x0C - #define HID_KEYBOARD_SC_J 0x0D - #define HID_KEYBOARD_SC_K 0x0E - #define HID_KEYBOARD_SC_L 0x0F - #define HID_KEYBOARD_SC_M 0x10 - #define HID_KEYBOARD_SC_N 0x11 - #define HID_KEYBOARD_SC_O 0x12 - #define HID_KEYBOARD_SC_P 0x13 - #define HID_KEYBOARD_SC_Q 0x14 - #define HID_KEYBOARD_SC_R 0x15 - #define HID_KEYBOARD_SC_S 0x16 - #define HID_KEYBOARD_SC_T 0x17 - #define HID_KEYBOARD_SC_U 0x18 - #define HID_KEYBOARD_SC_V 0x19 - #define HID_KEYBOARD_SC_W 0x1A - #define HID_KEYBOARD_SC_X 0x1B - #define HID_KEYBOARD_SC_Y 0x1C - #define HID_KEYBOARD_SC_Z 0x1D - #define HID_KEYBOARD_SC_1_AND_EXCLAMATION 0x1E - #define HID_KEYBOARD_SC_2_AND_AT 0x1F - #define HID_KEYBOARD_SC_3_AND_HASHMARK 0x20 - #define HID_KEYBOARD_SC_4_AND_DOLLAR 0x21 - #define HID_KEYBOARD_SC_5_AND_PERCENTAGE 0x22 - #define HID_KEYBOARD_SC_6_AND_CARET 0x23 - #define HID_KEYBOARD_SC_7_AND_AND_AMPERSAND 0x24 - #define HID_KEYBOARD_SC_8_AND_ASTERISK 0x25 - #define HID_KEYBOARD_SC_9_AND_OPENING_PARENTHESIS 0x26 - #define HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS 0x27 - #define HID_KEYBOARD_SC_ENTER 0x28 - #define HID_KEYBOARD_SC_ESCAPE 0x29 - #define HID_KEYBOARD_SC_BACKSPACE 0x2A - #define HID_KEYBOARD_SC_TAB 0x2B - #define HID_KEYBOARD_SC_SPACE 0x2C - #define HID_KEYBOARD_SC_MINUS_AND_UNDERSCORE 0x2D - #define HID_KEYBOARD_SC_EQUAL_AND_PLUS 0x2E - #define HID_KEYBOARD_SC_OPENING_BRACKET_AND_OPENING_BRACE 0x2F - #define HID_KEYBOARD_SC_CLOSING_BRACKET_AND_CLOSING_BRACE 0x30 - #define HID_KEYBOARD_SC_BACKSLASH_AND_PIPE 0x31 - #define HID_KEYBOARD_SC_NON_US_HASHMARK_AND_TILDE 0x32 - #define HID_KEYBOARD_SC_SEMICOLON_AND_COLON 0x33 - #define HID_KEYBOARD_SC_APOSTROPHE_AND_QUOTE 0x34 - #define HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE 0x35 - #define HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN 0x36 - #define HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN 0x37 - #define HID_KEYBOARD_SC_SLASH_AND_QUESTION_MARK 0x38 - #define HID_KEYBOARD_SC_CAPS_LOCK 0x39 - #define HID_KEYBOARD_SC_F1 0x3A - #define HID_KEYBOARD_SC_F2 0x3B - #define HID_KEYBOARD_SC_F3 0x3C - #define HID_KEYBOARD_SC_F4 0x3D - #define HID_KEYBOARD_SC_F5 0x3E - #define HID_KEYBOARD_SC_F6 0x3F - #define HID_KEYBOARD_SC_F7 0x40 - #define HID_KEYBOARD_SC_F8 0x41 - #define HID_KEYBOARD_SC_F9 0x42 - #define HID_KEYBOARD_SC_F10 0x43 - #define HID_KEYBOARD_SC_F11 0x44 - #define HID_KEYBOARD_SC_F12 0x45 - #define HID_KEYBOARD_SC_PRINT_SCREEN 0x46 - #define HID_KEYBOARD_SC_SCROLL_LOCK 0x47 - #define HID_KEYBOARD_SC_PAUSE 0x48 - #define HID_KEYBOARD_SC_INSERT 0x49 - #define HID_KEYBOARD_SC_HOME 0x4A - #define HID_KEYBOARD_SC_PAGE_UP 0x4B - #define HID_KEYBOARD_SC_DELETE 0x4C - #define HID_KEYBOARD_SC_END 0x4D - #define HID_KEYBOARD_SC_PAGE_DOWN 0x4E - #define HID_KEYBOARD_SC_RIGHT_ARROW 0x4F - #define HID_KEYBOARD_SC_LEFT_ARROW 0x50 - #define HID_KEYBOARD_SC_DOWN_ARROW 0x51 - #define HID_KEYBOARD_SC_UP_ARROW 0x52 - #define HID_KEYBOARD_SC_NUM_LOCK 0x53 - #define HID_KEYBOARD_SC_KEYPAD_SLASH 0x54 - #define HID_KEYBOARD_SC_KEYPAD_ASTERISK 0x55 - #define HID_KEYBOARD_SC_KEYPAD_MINUS 0x56 - #define HID_KEYBOARD_SC_KEYPAD_PLUS 0x57 - #define HID_KEYBOARD_SC_KEYPAD_ENTER 0x58 - #define HID_KEYBOARD_SC_KEYPAD_1_AND_END 0x59 - #define HID_KEYBOARD_SC_KEYPAD_2_AND_DOWN_ARROW 0x5A - #define HID_KEYBOARD_SC_KEYPAD_3_AND_PAGE_DOWN 0x5B - #define HID_KEYBOARD_SC_KEYPAD_4_AND_LEFT_ARROW 0x5C - #define HID_KEYBOARD_SC_KEYPAD_5 0x5D - #define HID_KEYBOARD_SC_KEYPAD_6_AND_RIGHT_ARROW 0x5E - #define HID_KEYBOARD_SC_KEYPAD_7_AND_HOME 0x5F - #define HID_KEYBOARD_SC_KEYPAD_8_AND_UP_ARROW 0x60 - #define HID_KEYBOARD_SC_KEYPAD_9_AND_PAGE_UP 0x61 - #define HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT 0x62 - #define HID_KEYBOARD_SC_KEYPAD_DOT_AND_DELETE 0x63 - #define HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE 0x64 - #define HID_KEYBOARD_SC_POWER 0x66 - #define HID_KEYBOARD_SC_EQUAL_SIGN 0x67 - #define HID_KEYBOARD_SC_F13 0x68 - #define HID_KEYBOARD_SC_F14 0x69 - #define HID_KEYBOARD_SC_F15 0x6A - #define HID_KEYBOARD_SC_F16 0x6B - #define HID_KEYBOARD_SC_F17 0x6C - #define HID_KEYBOARD_SC_F18 0x6D - #define HID_KEYBOARD_SC_F19 0x6E - #define HID_KEYBOARD_SC_F20 0x6F - #define HID_KEYBOARD_SC_F21 0x70 - #define HID_KEYBOARD_SC_F22 0x71 - #define HID_KEYBOARD_SC_F23 0x72 - #define HID_KEYBOARD_SC_F24 0x73 - #define HID_KEYBOARD_SC_EXECUTE 0x74 - #define HID_KEYBOARD_SC_HELP 0x75 - #define HID_KEYBOARD_SC_MANU 0x76 - #define HID_KEYBOARD_SC_SELECT 0x77 - #define HID_KEYBOARD_SC_STOP 0x78 - #define HID_KEYBOARD_SC_AGAIN 0x79 - #define HID_KEYBOARD_SC_UNDO 0x7A - #define HID_KEYBOARD_SC_CUT 0x7B - #define HID_KEYBOARD_SC_COPY 0x7C - #define HID_KEYBOARD_SC_PASTE 0x7D - #define HID_KEYBOARD_SC_FIND 0x7E - #define HID_KEYBOARD_SC_MUTE 0x7F - #define HID_KEYBOARD_SC_VOLUME_UP 0x80 - #define HID_KEYBOARD_SC_VOLUME_DOWN 0x81 - #define HID_KEYBOARD_SC_LOCKING_CAPS_LOCK 0x82 - #define HID_KEYBOARD_SC_LOCKING_NUM_LOCK 0x83 - #define HID_KEYBOARD_SC_LOCKING_SCROLL_LOCK 0x84 - #define HID_KEYBOARD_SC_KEYPAD_COMMA 0x85 - #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN 0x86 - #define HID_KEYBOARD_SC_INTERNATIONAL1 0x87 - #define HID_KEYBOARD_SC_INTERNATIONAL2 0x88 - #define HID_KEYBOARD_SC_INTERNATIONAL3 0x89 - #define HID_KEYBOARD_SC_INTERNATIONAL4 0x8A - #define HID_KEYBOARD_SC_INTERNATIONAL5 0x8B - #define HID_KEYBOARD_SC_INTERNATIONAL6 0x8C - #define HID_KEYBOARD_SC_INTERNATIONAL7 0x8D - #define HID_KEYBOARD_SC_INTERNATIONAL8 0x8E - #define HID_KEYBOARD_SC_INTERNATIONAL9 0x8F - #define HID_KEYBOARD_SC_LANG1 0x90 - #define HID_KEYBOARD_SC_LANG2 0x91 - #define HID_KEYBOARD_SC_LANG3 0x92 - #define HID_KEYBOARD_SC_LANG4 0x93 - #define HID_KEYBOARD_SC_LANG5 0x94 - #define HID_KEYBOARD_SC_LANG6 0x95 - #define HID_KEYBOARD_SC_LANG7 0x96 - #define HID_KEYBOARD_SC_LANG8 0x97 - #define HID_KEYBOARD_SC_LANG9 0x98 - #define HID_KEYBOARD_SC_ALTERNATE_ERASE 0x99 - #define HID_KEYBOARD_SC_SISREQ 0x9A - #define HID_KEYBOARD_SC_CANCEL 0x9B - #define HID_KEYBOARD_SC_CLEAR 0x9C - #define HID_KEYBOARD_SC_PRIOR 0x9D - #define HID_KEYBOARD_SC_RETURN 0x9E - #define HID_KEYBOARD_SC_SEPARATOR 0x9F - #define HID_KEYBOARD_SC_OUT 0xA0 - #define HID_KEYBOARD_SC_OPER 0xA1 - #define HID_KEYBOARD_SC_CLEAR_AND_AGAIN 0xA2 - #define HID_KEYBOARD_SC_CRSEL_ANDPROPS 0xA3 - #define HID_KEYBOARD_SC_EXSEL 0xA4 - #define HID_KEYBOARD_SC_KEYPAD_00 0xB0 - #define HID_KEYBOARD_SC_KEYPAD_000 0xB1 - #define HID_KEYBOARD_SC_THOUSANDS_SEPARATOR 0xB2 - #define HID_KEYBOARD_SC_DECIMAL_SEPARATOR 0xB3 - #define HID_KEYBOARD_SC_CURRENCY_UNIT 0xB4 - #define HID_KEYBOARD_SC_CURRENCY_SUB_UNIT 0xB5 - #define HID_KEYBOARD_SC_KEYPAD_OPENING_PARENTHESIS 0xB6 - #define HID_KEYBOARD_SC_KEYPAD_CLOSING_PARENTHESIS 0xB7 - #define HID_KEYBOARD_SC_KEYPAD_OPENING_BRACE 0xB8 - #define HID_KEYBOARD_SC_KEYPAD_CLOSING_BRACE 0xB9 - #define HID_KEYBOARD_SC_KEYPAD_TAB 0xBA - #define HID_KEYBOARD_SC_KEYPAD_BACKSPACE 0xBB - #define HID_KEYBOARD_SC_KEYPAD_A 0xBC - #define HID_KEYBOARD_SC_KEYPAD_B 0xBD - #define HID_KEYBOARD_SC_KEYPAD_C 0xBE - #define HID_KEYBOARD_SC_KEYPAD_D 0xBF - #define HID_KEYBOARD_SC_KEYPAD_E 0xC0 - #define HID_KEYBOARD_SC_KEYPAD_F 0xC1 - #define HID_KEYBOARD_SC_KEYPAD_XOR 0xC2 - #define HID_KEYBOARD_SC_KEYPAD_CARET 0xC3 - #define HID_KEYBOARD_SC_KEYPAD_PERCENTAGE 0xC4 - #define HID_KEYBOARD_SC_KEYPAD_LESS_THAN_SIGN 0xC5 - #define HID_KEYBOARD_SC_KEYPAD_GREATER_THAN_SIGN 0xC6 - #define HID_KEYBOARD_SC_KEYPAD_AMP 0xC7 - #define HID_KEYBOARD_SC_KEYPAD_AMP_AMP 0xC8 - #define HID_KEYBOARD_SC_KEYPAD_PIPE 0xC9 - #define HID_KEYBOARD_SC_KEYPAD_PIPE_PIPE 0xCA - #define HID_KEYBOARD_SC_KEYPAD_COLON 0xCB - #define HID_KEYBOARD_SC_KEYPAD_HASHMARK 0xCC - #define HID_KEYBOARD_SC_KEYPAD_SPACE 0xCD - #define HID_KEYBOARD_SC_KEYPAD_AT 0xCE - #define HID_KEYBOARD_SC_KEYPAD_EXCLAMATION_SIGN 0xCF - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_STORE 0xD0 - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_RECALL 0xD1 - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_CLEAR 0xD2 - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_ADD 0xD3 - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_SUBTRACT 0xD4 - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_MULTIPLY 0xD5 - #define HID_KEYBOARD_SC_KEYPAD_MEMORY_DIVIDE 0xD6 - #define HID_KEYBOARD_SC_KEYPAD_PLUS_AND_MINUS 0xD7 - #define HID_KEYBOARD_SC_KEYPAD_CLEAR 0xD8 - #define HID_KEYBOARD_SC_KEYPAD_CLEAR_ENTRY 0xD9 - #define HID_KEYBOARD_SC_KEYPAD_BINARY 0xDA - #define HID_KEYBOARD_SC_KEYPAD_OCTAL 0xDB - #define HID_KEYBOARD_SC_KEYPAD_DECIMAL 0xDC - #define HID_KEYBOARD_SC_KEYPAD_HEXADECIMAL 0xDD - #define HID_KEYBOARD_SC_LEFT_CONTROL 0xE0 - #define HID_KEYBOARD_SC_LEFT_SHIFT 0xE1 - #define HID_KEYBOARD_SC_LEFT_ALT 0xE2 - #define HID_KEYBOARD_SC_LEFT_GUI 0xE3 - #define HID_KEYBOARD_SC_RIGHT_CONTROL 0xE4 - #define HID_KEYBOARD_SC_RIGHT_SHIFT 0xE5 - #define HID_KEYBOARD_SC_RIGHT_ALT 0xE6 - #define HID_KEYBOARD_SC_RIGHT_GUI 0xE7 - //@} - - /** \name Common HID Device Report Descriptors */ - //@{ - /** \hideinitializer - * A list of HID report item array elements that describe a typical HID USB Joystick. The resulting report - * descriptor is structured according to the following layout: - * - * \code - * struct - * { - * intA_t X; // Signed X axis value - * intA_t Y; // Signed Y axis value - * intA_t Z; // Signed Z axis value - * uintB_t Buttons; // Pressed buttons bitmask - * } Joystick_Report; - * \endcode - * - * Where \c uintA_t is a type large enough to hold the ranges of the signed \c MinAxisVal and \c MaxAxisVal values, - * and \c intB_t is a type large enough to hold one bit per button. - * - * \param[in] MinAxisVal Minimum logical axis value (16-bit). - * \param[in] MaxAxisVal Maximum logical axis value (16-bit). - * \param[in] MinPhysicalVal Minimum physical axis value, for movement resolution calculations (16-bit). - * \param[in] MaxPhysicalVal Maximum physical axis value, for movement resolution calculations (16-bit). - * \param[in] Buttons Total number of buttons in the device (8-bit). - */ - #define HID_DESCRIPTOR_JOYSTICK(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons) \ - HID_RI_USAGE_PAGE(8, 0x01), \ - HID_RI_USAGE(8, 0x04), \ - HID_RI_COLLECTION(8, 0x01), \ - HID_RI_USAGE(8, 0x01), \ - HID_RI_COLLECTION(8, 0x00), \ - HID_RI_USAGE(8, 0x30), \ - HID_RI_USAGE(8, 0x31), \ - HID_RI_USAGE(8, 0x32), \ - HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \ - HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \ - HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \ - HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \ - HID_RI_REPORT_COUNT(8, 3), \ - HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ - HID_RI_END_COLLECTION(0), \ - HID_RI_USAGE_PAGE(8, 0x09), \ - HID_RI_USAGE_MINIMUM(8, 0x01), \ - HID_RI_USAGE_MAXIMUM(8, Buttons), \ - HID_RI_LOGICAL_MINIMUM(8, 0x00), \ - HID_RI_LOGICAL_MAXIMUM(8, 0x01), \ - HID_RI_REPORT_SIZE(8, 0x01), \ - HID_RI_REPORT_COUNT(8, Buttons), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ - HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \ - HID_RI_REPORT_COUNT(8, 0x01), \ - HID_RI_INPUT(8, HID_IOF_CONSTANT), \ - HID_RI_END_COLLECTION(0) - - /** \hideinitializer - * A list of HID report item array elements that describe a typical HID USB keyboard. The resulting report descriptor - * is compatible with \ref USB_KeyboardReport_Data_t when \c MaxKeys is equal to 6. For other values, the report will - * be structured according to the following layout: - * - * \code - * struct - * { - * uint8_t Modifier; // Keyboard modifier byte indicating pressed modifier keys (\c HID_KEYBOARD_MODIFER_* masks) - * uint8_t Reserved; // Reserved for OEM use, always set to 0. - * uint8_t KeyCode[MaxKeys]; // Length determined by the number of keys that can be reported - * } Keyboard_Report; - * \endcode - * - * \param[in] MaxKeys Number of simultaneous keys that can be reported at the one time (8-bit). - */ - #define HID_DESCRIPTOR_KEYBOARD(MaxKeys) \ - HID_RI_USAGE_PAGE(8, 0x01), \ - HID_RI_USAGE(8, 0x06), \ - HID_RI_COLLECTION(8, 0x01), \ - HID_RI_USAGE_PAGE(8, 0x07), \ - HID_RI_USAGE_MINIMUM(8, 0xE0), \ - HID_RI_USAGE_MAXIMUM(8, 0xE7), \ - HID_RI_LOGICAL_MINIMUM(8, 0x00), \ - HID_RI_LOGICAL_MAXIMUM(8, 0x01), \ - HID_RI_REPORT_SIZE(8, 0x01), \ - HID_RI_REPORT_COUNT(8, 0x08), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ - HID_RI_REPORT_COUNT(8, 0x01), \ - HID_RI_REPORT_SIZE(8, 0x08), \ - HID_RI_INPUT(8, HID_IOF_CONSTANT), \ - HID_RI_USAGE_PAGE(8, 0x08), \ - HID_RI_USAGE_MINIMUM(8, 0x01), \ - HID_RI_USAGE_MAXIMUM(8, 0x05), \ - HID_RI_REPORT_COUNT(8, 0x05), \ - HID_RI_REPORT_SIZE(8, 0x01), \ - HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \ - HID_RI_REPORT_COUNT(8, 0x01), \ - HID_RI_REPORT_SIZE(8, 0x03), \ - HID_RI_OUTPUT(8, HID_IOF_CONSTANT), \ - HID_RI_LOGICAL_MINIMUM(8, 0x00), \ - HID_RI_LOGICAL_MAXIMUM(8, 0x65), \ - HID_RI_USAGE_PAGE(8, 0x07), \ - HID_RI_USAGE_MINIMUM(8, 0x00), \ - HID_RI_USAGE_MAXIMUM(8, 0x65), \ - HID_RI_REPORT_COUNT(8, MaxKeys), \ - HID_RI_REPORT_SIZE(8, 0x08), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), \ - HID_RI_END_COLLECTION(0) - - /** \hideinitializer - * A list of HID report item array elements that describe a typical HID USB mouse. The resulting report descriptor - * is compatible with \ref USB_MouseReport_Data_t if the \c MinAxisVal and \c MaxAxisVal values fit within a \c int8_t range - * and the number of Buttons is less than 8. For other values, the report is structured according to the following layout: - * - * \code - * struct - * { - * uintA_t Buttons; // Pressed buttons bitmask - * intB_t X; // X axis value - * intB_t Y; // Y axis value - * } Mouse_Report; - * \endcode - * - * Where \c intA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the - * ranges of the signed \c MinAxisVal and \c MaxAxisVal values. - * - * \param[in] MinAxisVal Minimum X/Y logical axis value (16-bit). - * \param[in] MaxAxisVal Maximum X/Y logical axis value (16-bit). - * \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations (16-bit). - * \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations (16-bit). - * \param[in] Buttons Total number of buttons in the device (8-bit). - * \param[in] AbsoluteCoords Boolean \c true to use absolute X/Y coordinates (e.g. touchscreen). - */ - #define HID_DESCRIPTOR_MOUSE(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons, AbsoluteCoords) \ - HID_RI_USAGE_PAGE(8, 0x01), \ - HID_RI_USAGE(8, 0x02), \ - HID_RI_COLLECTION(8, 0x01), \ - HID_RI_USAGE(8, 0x01), \ - HID_RI_COLLECTION(8, 0x00), \ - HID_RI_USAGE_PAGE(8, 0x09), \ - HID_RI_USAGE_MINIMUM(8, 0x01), \ - HID_RI_USAGE_MAXIMUM(8, Buttons), \ - HID_RI_LOGICAL_MINIMUM(8, 0x00), \ - HID_RI_LOGICAL_MAXIMUM(8, 0x01), \ - HID_RI_REPORT_COUNT(8, Buttons), \ - HID_RI_REPORT_SIZE(8, 0x01), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ - HID_RI_REPORT_COUNT(8, 0x01), \ - HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \ - HID_RI_INPUT(8, HID_IOF_CONSTANT), \ - HID_RI_USAGE_PAGE(8, 0x01), \ - HID_RI_USAGE(8, 0x30), \ - HID_RI_USAGE(8, 0x31), \ - HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \ - HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \ - HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \ - HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \ - HID_RI_REPORT_COUNT(8, 0x02), \ - HID_RI_REPORT_SIZE(8, ((((MinAxisVal >= -0xFF) && (MaxAxisVal <= 0xFF)) ? 8 : 16))), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | (AbsoluteCoords ? HID_IOF_ABSOLUTE : HID_IOF_RELATIVE)), \ - HID_RI_END_COLLECTION(0), \ - HID_RI_END_COLLECTION(0) - - /** \hideinitializer - * A list of HID report item array elements that describe a typical Vendor Defined byte array HID report descriptor, - * used for transporting arbitrary data between the USB host and device via HID reports. The resulting report should be - * a \c uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions. - * - * \param[in] VendorPageNum Vendor Defined HID Usage Page index, ranging from 0x00 to 0xFF. - * \param[in] CollectionUsage Vendor Usage for the encompassing report IN and OUT collection, ranging from 0x00 to 0xFF. - * \param[in] DataINUsage Vendor Usage for the IN report data, ranging from 0x00 to 0xFF. - * \param[in] DataOUTUsage Vendor Usage for the OUT report data, ranging from 0x00 to 0xFF. - * \param[in] NumBytes Length of the data IN and OUT reports. - */ - #define HID_DESCRIPTOR_VENDOR(VendorPageNum, CollectionUsage, DataINUsage, DataOUTUsage, NumBytes) \ - HID_RI_USAGE_PAGE(16, (0xFF00 | VendorPageNum)), \ - HID_RI_USAGE(8, CollectionUsage), \ - HID_RI_COLLECTION(8, 0x01), \ - HID_RI_USAGE(8, DataINUsage), \ - HID_RI_LOGICAL_MINIMUM(8, 0x00), \ - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), \ - HID_RI_REPORT_SIZE(8, 0x08), \ - HID_RI_REPORT_COUNT(8, NumBytes), \ - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ - HID_RI_USAGE(8, DataOUTUsage), \ - HID_RI_LOGICAL_MINIMUM(8, 0x00), \ - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), \ - HID_RI_REPORT_SIZE(8, 0x08), \ - HID_RI_REPORT_COUNT(8, NumBytes), \ - HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \ - HID_RI_END_COLLECTION(0) - //@} - - /* Type Defines: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the HID - * device class. - */ - enum HID_Descriptor_ClassSubclassProtocol_t - { - HID_CSCP_HIDClass = 0x03, /**< Descriptor Class value indicating that the device or interface - * belongs to the HID class. - */ - HID_CSCP_NonBootSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface - * does not implement a HID boot protocol. - */ - HID_CSCP_BootSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface - * implements a HID boot protocol. - */ - HID_CSCP_NonBootProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface - * does not belong to a HID boot protocol. - */ - HID_CSCP_KeyboardBootProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the Keyboard HID boot protocol. - */ - HID_CSCP_MouseBootProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the Mouse HID boot protocol. - */ - }; - - /** Enum for the HID class specific control requests that can be issued by the USB bus host. */ - enum HID_ClassRequests_t - { - HID_REQ_GetReport = 0x01, /**< HID class-specific Request to get the current HID report from the device. */ - HID_REQ_GetIdle = 0x02, /**< HID class-specific Request to get the current device idle count. */ - HID_REQ_GetProtocol = 0x03, /**< HID class-specific Request to get the current HID report protocol mode. */ - HID_REQ_SetReport = 0x09, /**< HID class-specific Request to set the current HID report to the device. */ - HID_REQ_SetIdle = 0x0A, /**< HID class-specific Request to set the device's idle count. */ - HID_REQ_SetProtocol = 0x0B, /**< HID class-specific Request to set the current HID report protocol mode. */ - }; - - /** Enum for the HID class specific descriptor types. */ - enum HID_DescriptorTypes_t - { - HID_DTYPE_HID = 0x21, /**< Descriptor header type value, to indicate a HID class HID descriptor. */ - HID_DTYPE_Report = 0x22, /**< Descriptor header type value, to indicate a HID class HID report descriptor. */ - }; - - /** Enum for the different types of HID reports. */ - enum HID_ReportItemTypes_t - { - HID_REPORT_ITEM_In = 0, /**< Indicates that the item is an IN report type. */ - HID_REPORT_ITEM_Out = 1, /**< Indicates that the item is an OUT report type. */ - HID_REPORT_ITEM_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ - }; - - /** \brief HID class-specific HID Descriptor (LUFA naming conventions). - * - * Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID - * specification for details on the structure elements. - * - * \see \ref USB_HID_StdDescriptor_HID_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - - uint16_t HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to. */ - uint8_t CountryCode; /**< Country code of the localized device, or zero if universal. */ - - uint8_t TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */ - - uint8_t HIDReportType; /**< Type of HID report, set to \ref HID_DTYPE_Report. */ - uint16_t HIDReportLength; /**< Length of the associated HID report descriptor, in bytes. */ - } ATTR_PACKED USB_HID_Descriptor_HID_t; - - /** \brief HID class-specific HID Descriptor (USB-IF naming conventions). - * - * Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID - * specification for details on the structure elements. - * - * \see \ref USB_HID_Descriptor_HID_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */ - uint8_t bCountryCode; /**< Country code of the localized device, or zero if universal. */ - - uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */ - - uint8_t bDescriptorType2; /**< Type of HID report, set to \ref HID_DTYPE_Report. */ - uint16_t wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */ - } ATTR_PACKED USB_HID_StdDescriptor_HID_t; - - /** \brief Standard HID Boot Protocol Mouse Report. - * - * Type define for a standard Boot Protocol Mouse report - */ - typedef struct - { - uint8_t Button; /**< Button mask for currently pressed buttons in the mouse. */ - int8_t X; /**< Current delta X movement of the mouse. */ - int8_t Y; /**< Current delta Y movement on the mouse. */ - } ATTR_PACKED USB_MouseReport_Data_t; - - /** \brief Standard HID Boot Protocol Keyboard Report. - * - * Type define for a standard Boot Protocol Keyboard report - */ - typedef struct - { - uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of - * \c HID_KEYBOARD_MODIFER_* masks). - */ - uint8_t Reserved; /**< Reserved for OEM use, always set to 0. */ - uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys. */ - } ATTR_PACKED USB_KeyboardReport_Data_t; - - /** Type define for the data type used to store HID report descriptor elements. */ - typedef uint8_t USB_Descriptor_HIDReport_Datatype_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c deleted file mode 100644 index f57d97b568..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c +++ /dev/null @@ -1,363 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#define __INCLUDE_FROM_HID_DRIVER -#include "HIDParser.h" - -uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, - uint16_t ReportSize, - HID_ReportInfo_t* const ParserData) -{ - HID_StateTable_t StateTable[HID_STATETABLE_STACK_DEPTH]; - HID_StateTable_t* CurrStateTable = &StateTable[0]; - HID_CollectionPath_t* CurrCollectionPath = NULL; - HID_ReportSizeInfo_t* CurrReportIDInfo = &ParserData->ReportIDSizes[0]; - uint16_t UsageList[HID_USAGE_STACK_DEPTH]; - uint8_t UsageListSize = 0; - HID_MinMax_t UsageMinMax = {0, 0}; - - memset(ParserData, 0x00, sizeof(HID_ReportInfo_t)); - memset(CurrStateTable, 0x00, sizeof(HID_StateTable_t)); - memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t)); - - ParserData->TotalDeviceReports = 1; - - while (ReportSize) - { - uint8_t HIDReportItem = *ReportData; - uint32_t ReportItemData = 0; - - ReportData++; - ReportSize--; - - switch (HIDReportItem & HID_RI_DATA_SIZE_MASK) - { - case HID_RI_DATA_BITS_32: - ReportItemData = (((uint32_t)ReportData[3] << 24) | ((uint32_t)ReportData[2] << 16) | - ((uint16_t)ReportData[1] << 8) | ReportData[0]); - ReportSize -= 4; - ReportData += 4; - break; - case HID_RI_DATA_BITS_16: - ReportItemData = (((uint16_t)ReportData[1] << 8) | (ReportData[0])); - ReportSize -= 2; - ReportData += 2; - break; - case HID_RI_DATA_BITS_8: - ReportItemData = ReportData[0]; - ReportSize -= 1; - ReportData += 1; - break; - } - - switch (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK)) - { - case HID_RI_PUSH(0): - if (CurrStateTable == &StateTable[HID_STATETABLE_STACK_DEPTH - 1]) - return HID_PARSE_HIDStackOverflow; - - memcpy((CurrStateTable + 1), - CurrStateTable, - sizeof(HID_ReportItem_t)); - - CurrStateTable++; - break; - case HID_RI_POP(0): - if (CurrStateTable == &StateTable[0]) - return HID_PARSE_HIDStackUnderflow; - - CurrStateTable--; - break; - case HID_RI_USAGE_PAGE(0): - if ((HIDReportItem & HID_RI_DATA_SIZE_MASK) == HID_RI_DATA_BITS_32) - CurrStateTable->Attributes.Usage.Page = (ReportItemData >> 16); - - CurrStateTable->Attributes.Usage.Page = ReportItemData; - break; - case HID_RI_LOGICAL_MINIMUM(0): - CurrStateTable->Attributes.Logical.Minimum = ReportItemData; - break; - case HID_RI_LOGICAL_MAXIMUM(0): - CurrStateTable->Attributes.Logical.Maximum = ReportItemData; - break; - case HID_RI_PHYSICAL_MINIMUM(0): - CurrStateTable->Attributes.Physical.Minimum = ReportItemData; - break; - case HID_RI_PHYSICAL_MAXIMUM(0): - CurrStateTable->Attributes.Physical.Maximum = ReportItemData; - break; - case HID_RI_UNIT_EXPONENT(0): - CurrStateTable->Attributes.Unit.Exponent = ReportItemData; - break; - case HID_RI_UNIT(0): - CurrStateTable->Attributes.Unit.Type = ReportItemData; - break; - case HID_RI_REPORT_SIZE(0): - CurrStateTable->Attributes.BitSize = ReportItemData; - break; - case HID_RI_REPORT_COUNT(0): - CurrStateTable->ReportCount = ReportItemData; - break; - case HID_RI_REPORT_ID(0): - CurrStateTable->ReportID = ReportItemData; - - if (ParserData->UsingReportIDs) - { - CurrReportIDInfo = NULL; - - for (uint8_t i = 0; i < ParserData->TotalDeviceReports; i++) - { - if (ParserData->ReportIDSizes[i].ReportID == CurrStateTable->ReportID) - { - CurrReportIDInfo = &ParserData->ReportIDSizes[i]; - break; - } - } - - if (CurrReportIDInfo == NULL) - { - if (ParserData->TotalDeviceReports == HID_MAX_REPORT_IDS) - return HID_PARSE_InsufficientReportIDItems; - - CurrReportIDInfo = &ParserData->ReportIDSizes[ParserData->TotalDeviceReports++]; - memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t)); - } - } - - ParserData->UsingReportIDs = true; - - CurrReportIDInfo->ReportID = CurrStateTable->ReportID; - break; - case HID_RI_USAGE(0): - if (UsageListSize == HID_USAGE_STACK_DEPTH) - return HID_PARSE_UsageListOverflow; - - UsageList[UsageListSize++] = ReportItemData; - break; - case HID_RI_USAGE_MINIMUM(0): - UsageMinMax.Minimum = ReportItemData; - break; - case HID_RI_USAGE_MAXIMUM(0): - UsageMinMax.Maximum = ReportItemData; - break; - case HID_RI_COLLECTION(0): - if (CurrCollectionPath == NULL) - { - CurrCollectionPath = &ParserData->CollectionPaths[0]; - } - else - { - HID_CollectionPath_t* ParentCollectionPath = CurrCollectionPath; - - CurrCollectionPath = &ParserData->CollectionPaths[1]; - - while (CurrCollectionPath->Parent != NULL) - { - if (CurrCollectionPath == &ParserData->CollectionPaths[HID_MAX_COLLECTIONS - 1]) - return HID_PARSE_InsufficientCollectionPaths; - - CurrCollectionPath++; - } - - CurrCollectionPath->Parent = ParentCollectionPath; - } - - CurrCollectionPath->Type = ReportItemData; - CurrCollectionPath->Usage.Page = CurrStateTable->Attributes.Usage.Page; - - if (UsageListSize) - { - CurrCollectionPath->Usage.Usage = UsageList[0]; - - for (uint8_t i = 0; i < UsageListSize; i++) - UsageList[i] = UsageList[i + 1]; - - UsageListSize--; - } - else if (UsageMinMax.Minimum <= UsageMinMax.Maximum) - { - CurrCollectionPath->Usage.Usage = UsageMinMax.Minimum++; - } - - break; - case HID_RI_END_COLLECTION(0): - if (CurrCollectionPath == NULL) - return HID_PARSE_UnexpectedEndCollection; - - CurrCollectionPath = CurrCollectionPath->Parent; - break; - case HID_RI_INPUT(0): - case HID_RI_OUTPUT(0): - case HID_RI_FEATURE(0): - for (uint8_t ReportItemNum = 0; ReportItemNum < CurrStateTable->ReportCount; ReportItemNum++) - { - HID_ReportItem_t NewReportItem; - - memcpy(&NewReportItem.Attributes, - &CurrStateTable->Attributes, - sizeof(HID_ReportItem_Attributes_t)); - - NewReportItem.ItemFlags = ReportItemData; - NewReportItem.CollectionPath = CurrCollectionPath; - NewReportItem.ReportID = CurrStateTable->ReportID; - - if (UsageListSize) - { - NewReportItem.Attributes.Usage.Usage = UsageList[0]; - - for (uint8_t i = 0; i < UsageListSize; i++) - UsageList[i] = UsageList[i + 1]; - - UsageListSize--; - } - else if (UsageMinMax.Minimum <= UsageMinMax.Maximum) - { - NewReportItem.Attributes.Usage.Usage = UsageMinMax.Minimum++; - } - - uint8_t ItemTypeTag = (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK)); - - if (ItemTypeTag == HID_RI_INPUT(0)) - NewReportItem.ItemType = HID_REPORT_ITEM_In; - else if (ItemTypeTag == HID_RI_OUTPUT(0)) - NewReportItem.ItemType = HID_REPORT_ITEM_Out; - else - NewReportItem.ItemType = HID_REPORT_ITEM_Feature; - - NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType]; - - CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType] += CurrStateTable->Attributes.BitSize; - - ParserData->LargestReportSizeBits = MAX(ParserData->LargestReportSizeBits, CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType]); - - if (ParserData->TotalReportItems == HID_MAX_REPORTITEMS) - return HID_PARSE_InsufficientReportItems; - - memcpy(&ParserData->ReportItems[ParserData->TotalReportItems], - &NewReportItem, sizeof(HID_ReportItem_t)); - - if (!(ReportItemData & HID_IOF_CONSTANT) && CALLBACK_HIDParser_FilterHIDReportItem(&NewReportItem)) - ParserData->TotalReportItems++; - } - - break; - } - - if ((HIDReportItem & HID_RI_TYPE_MASK) == HID_RI_TYPE_MAIN) - { - UsageMinMax.Minimum = 0; - UsageMinMax.Maximum = 0; - UsageListSize = 0; - } - } - - if (!(ParserData->TotalReportItems)) - return HID_PARSE_NoUnfilteredReportItems; - - return HID_PARSE_Successful; -} - -bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, - HID_ReportItem_t* const ReportItem) -{ - if (ReportItem == NULL) - return false; - - uint16_t DataBitsRem = ReportItem->Attributes.BitSize; - uint16_t CurrentBit = ReportItem->BitOffset; - uint32_t BitMask = (1 << 0); - - if (ReportItem->ReportID) - { - if (ReportItem->ReportID != ReportData[0]) - return false; - - ReportData++; - } - - ReportItem->PreviousValue = ReportItem->Value; - ReportItem->Value = 0; - - while (DataBitsRem--) - { - if (ReportData[CurrentBit / 8] & (1 << (CurrentBit % 8))) - ReportItem->Value |= BitMask; - - CurrentBit++; - BitMask <<= 1; - } - - return true; -} - -void USB_SetHIDReportItemInfo(uint8_t* ReportData, - HID_ReportItem_t* const ReportItem) -{ - if (ReportItem == NULL) - return; - - uint16_t DataBitsRem = ReportItem->Attributes.BitSize; - uint16_t CurrentBit = ReportItem->BitOffset; - uint32_t BitMask = (1 << 0); - - if (ReportItem->ReportID) - { - ReportData[0] = ReportItem->ReportID; - ReportData++; - } - - ReportItem->PreviousValue = ReportItem->Value; - - while (DataBitsRem--) - { - if (ReportItem->Value & (1 << (CurrentBit % 8))) - ReportData[CurrentBit / 8] |= BitMask; - - CurrentBit++; - BitMask <<= 1; - } -} - -uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, - const uint8_t ReportID, - const uint8_t ReportType) -{ - for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++) - { - uint16_t ReportSizeBits = ParserData->ReportIDSizes[i].ReportSizeBits[ReportType]; - - if (ParserData->ReportIDSizes[i].ReportID == ReportID) - return (ReportSizeBits / 8) + ((ReportSizeBits % 8) ? 1 : 0); - } - - return 0; -} - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h deleted file mode 100644 index dd14bea435..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h +++ /dev/null @@ -1,364 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Human Interface Device (HID) Class report descriptor parser. - * - * This file allows for the easy parsing of complex HID report descriptors, which describes the data that - * a HID device transmits to the host. It also provides an easy API for extracting and processing the data - * elements inside a HID report sent from an attached HID device. - */ - -/** \ingroup Group_USB - * \defgroup Group_HIDParser HID Report Parser - * \brief USB Human Interface Device (HID) Class report descriptor parser. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/HIDParser.c (Makefile source module name: LUFA_SRC_USB) - * - * \section Sec_ModDescription Module Description - * Human Interface Device (HID) class report descriptor parser. This module implements a parser than is - * capable of processing a complete HID report descriptor, and outputting a flat structure containing the - * contents of the report in an a more friendly format. The parsed data may then be further processed and used - * within an application to process sent and received HID reports to and from an attached HID device. - * - * A HID report descriptor consists of a set of HID report items, which describe the function and layout - * of data exchanged between a HID device and a host, including both the physical encoding of each item - * (such as a button, key press or joystick axis) in the sent and received data packets - known as "reports" - - * as well as other information about each item such as the usages, data range, physical location and other - * characteristics. In this way a HID device can retain a high degree of flexibility in its capabilities, as it - * is not forced to comply with a given report layout or feature-set. - * - * This module also contains routines for the processing of data in an actual HID report, using the parsed report - * descriptor data as a guide for the encoding. - * - * @{ - */ - -#ifndef __HIDPARSER_H__ -#define __HIDPARSER_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - #include "HIDReportData.h" - #include "HIDClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Macros: */ - #if !defined(HID_STATETABLE_STACK_DEPTH) || defined(__DOXYGEN__) - /** Constant indicating the maximum stack depth of the state table. A larger state table - * allows for more PUSH/POP report items to be nested, but consumes more memory. By default - * this is set to 2 levels (allowing non-nested PUSH items) but this can be overridden by - * defining \c HID_STATETABLE_STACK_DEPTH to another value in the user project makefile, passing the - * define to the compiler using the -D compiler switch. - */ - #define HID_STATETABLE_STACK_DEPTH 2 - #endif - - #if !defined(HID_USAGE_STACK_DEPTH) || defined(__DOXYGEN__) - /** Constant indicating the maximum stack depth of the usage table. A larger usage table - * allows for more USAGE items to be indicated sequentially for REPORT COUNT entries of more than - * one, but requires more stack space. By default this is set to 8 levels (allowing for a report - * item with a count of 8) but this can be overridden by defining \c HID_USAGE_STACK_DEPTH to another - * value in the user project makefile, passing the define to the compiler using the -D compiler - * switch. - */ - #define HID_USAGE_STACK_DEPTH 8 - #endif - - #if !defined(HID_MAX_COLLECTIONS) || defined(__DOXYGEN__) - /** Constant indicating the maximum number of COLLECTION items (nested or unnested) that can be - * processed in the report item descriptor. A large value allows for more COLLECTION items to be - * processed, but consumes more memory. By default this is set to 10 collections, but this can be - * overridden by defining \c HID_MAX_COLLECTIONS to another value in the user project makefile, passing - * the define to the compiler using the -D compiler switch. - */ - #define HID_MAX_COLLECTIONS 10 - #endif - - #if !defined(HID_MAX_REPORTITEMS) || defined(__DOXYGEN__) - /** Constant indicating the maximum number of report items (IN, OUT or FEATURE) that can be processed - * in the report item descriptor and stored in the user HID Report Info structure. A large value allows - * for more report items to be stored, but consumes more memory. By default this is set to 20 items, - * but this can be overridden by defining \c HID_MAX_REPORTITEMS to another value in the user project - * makefile, and passing the define to the compiler using the -D compiler switch. - */ - #define HID_MAX_REPORTITEMS 20 - #endif - - #if !defined(HID_MAX_REPORT_IDS) || defined(__DOXYGEN__) - /** Constant indicating the maximum number of unique report IDs that can be processed in the report item - * descriptor for the report size information array in the user HID Report Info structure. A large value - * allows for more report ID report sizes to be stored, but consumes more memory. By default this is set - * to 10 items, but this can be overridden by defining \c HID_MAX_REPORT_IDS to another value in the user project - * makefile, and passing the define to the compiler using the -D compiler switch. Note that IN, OUT and FEATURE - * items sharing the same report ID consume only one size item in the array. - */ - #define HID_MAX_REPORT_IDS 10 - #endif - - /** Returns the value a given HID report item (once its value has been fetched via \ref USB_GetHIDReportItemInfo()) - * left-aligned to the given data type. This allows for signed data to be interpreted correctly, by shifting the data - * leftwards until the data's sign bit is in the correct position. - * - * \param[in] ReportItem HID Report Item whose retrieved value is to be aligned. - * \param[in] Type Data type to align the HID report item's value to. - * - * \return Left-aligned data of the given report item's pre-retrieved value for the given datatype. - */ - #define HID_ALIGN_DATA(ReportItem, Type) ((Type)(ReportItem->Value << ((8 * sizeof(Type)) - ReportItem->Attributes.BitSize))) - - /* Public Interface - May be used in end-application: */ - /* Enums: */ - /** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function. */ - enum HID_Parse_ErrorCodes_t - { - HID_PARSE_Successful = 0, /**< Successful parse of the HID report descriptor, no error. */ - HID_PARSE_HIDStackOverflow = 1, /**< More than \ref HID_STATETABLE_STACK_DEPTH nested PUSHes in the report. */ - HID_PARSE_HIDStackUnderflow = 2, /**< A POP was found when the state table stack was empty. */ - HID_PARSE_InsufficientReportItems = 3, /**< More than \ref HID_MAX_REPORTITEMS report items in the report. */ - HID_PARSE_UnexpectedEndCollection = 4, /**< An END COLLECTION item found without matching COLLECTION item. */ - HID_PARSE_InsufficientCollectionPaths = 5, /**< More than \ref HID_MAX_COLLECTIONS collections in the report. */ - HID_PARSE_UsageListOverflow = 6, /**< More than \ref HID_USAGE_STACK_DEPTH usages listed in a row. */ - HID_PARSE_InsufficientReportIDItems = 7, /**< More than \ref HID_MAX_REPORT_IDS report IDs in the device. */ - HID_PARSE_NoUnfilteredReportItems = 8, /**< All report items from the device were filtered by the filtering callback routine. */ - }; - - /* Type Defines: */ - /** \brief HID Parser Report Item Min/Max Structure. - * - * Type define for an attribute with both minimum and maximum values (e.g. Logical Min/Max). - */ - typedef struct - { - uint32_t Minimum; /**< Minimum value for the attribute. */ - uint32_t Maximum; /**< Maximum value for the attribute. */ - } HID_MinMax_t; - - /** \brief HID Parser Report Item Unit Structure. - * - * Type define for the Unit attributes of a report item. - */ - typedef struct - { - uint32_t Type; /**< Unit type (refer to HID specifications for details). */ - uint8_t Exponent; /**< Unit exponent (refer to HID specifications for details). */ - } HID_Unit_t; - - /** \brief HID Parser Report Item Usage Structure. - * - * Type define for the Usage attributes of a report item. - */ - typedef struct - { - uint16_t Page; /**< Usage page of the report item. */ - uint16_t Usage; /**< Usage of the report item. */ - } HID_Usage_t; - - /** \brief HID Parser Report Item Collection Path Structure. - * - * Type define for a COLLECTION object. Contains the collection attributes and a reference to the - * parent collection if any. - */ - typedef struct HID_CollectionPath - { - uint8_t Type; /**< Collection type (e.g. "Generic Desktop"). */ - HID_Usage_t Usage; /**< Collection usage. */ - struct HID_CollectionPath* Parent; /**< Reference to parent collection, or \c NULL if root collection. */ - } HID_CollectionPath_t; - - /** \brief HID Parser Report Item Attributes Structure. - * - * Type define for all the data attributes of a report item, except flags. - */ - typedef struct - { - uint8_t BitSize; /**< Size in bits of the report item's data. */ - - HID_Usage_t Usage; /**< Usage of the report item. */ - HID_Unit_t Unit; /**< Unit type and exponent of the report item. */ - HID_MinMax_t Logical; /**< Logical minimum and maximum of the report item. */ - HID_MinMax_t Physical; /**< Physical minimum and maximum of the report item. */ - } HID_ReportItem_Attributes_t; - - /** \brief HID Parser Report Item Details Structure. - * - * Type define for a report item (IN, OUT or FEATURE) layout attributes and other details. - */ - typedef struct - { - uint16_t BitOffset; /**< Bit offset in the IN, OUT or FEATURE report of the item. */ - uint8_t ItemType; /**< Report item type, a value in \ref HID_ReportItemTypes_t. */ - uint16_t ItemFlags; /**< Item data flags, a mask of \c HID_IOF_* constants. */ - uint8_t ReportID; /**< Report ID this item belongs to, or 0x00 if device has only one report */ - HID_CollectionPath_t* CollectionPath; /**< Collection path of the item. */ - - HID_ReportItem_Attributes_t Attributes; /**< Report item attributes. */ - - uint32_t Value; /**< Current value of the report item - use \ref HID_ALIGN_DATA() when processing - * a retrieved value so that it is aligned to a specific type. - */ - uint32_t PreviousValue; /**< Previous value of the report item. */ - } HID_ReportItem_t; - - /** \brief HID Parser Report Size Structure. - * - * Type define for a report item size information structure, to retain the size of a device's reports by ID. - */ - typedef struct - { - uint8_t ReportID; /**< Report ID of the report within the HID interface. */ - uint16_t ReportSizeBits[3]; /**< Total number of bits in each report type for the given Report ID, - * indexed by the \ref HID_ReportItemTypes_t enum. - */ - } HID_ReportSizeInfo_t; - - /** \brief HID Parser State Structure. - * - * Type define for a complete processed HID report, including all report item data and collections. - */ - typedef struct - { - uint8_t TotalReportItems; /**< Total number of report items stored in the \c ReportItems array. */ - HID_ReportItem_t ReportItems[HID_MAX_REPORTITEMS]; /**< Report items array, including all IN, OUT - * and FEATURE items. - */ - HID_CollectionPath_t CollectionPaths[HID_MAX_COLLECTIONS]; /**< All collection items, referenced - * by the report items. - */ - uint8_t TotalDeviceReports; /**< Number of reports within the HID interface */ - HID_ReportSizeInfo_t ReportIDSizes[HID_MAX_REPORT_IDS]; /**< Report sizes for each report in the interface */ - uint16_t LargestReportSizeBits; /**< Largest report that the attached device will generate, in bits */ - bool UsingReportIDs; /**< Indicates if the device has at least one REPORT ID - * element in its HID report descriptor. - */ - } HID_ReportInfo_t; - - /* Function Prototypes: */ - /** Function to process a given HID report returned from an attached device, and store it into a given - * \ref HID_ReportInfo_t structure. - * - * \param[in] ReportData Buffer containing the device's HID report table. - * \param[in] ReportSize Size in bytes of the HID report table. - * \param[out] ParserData Pointer to a \ref HID_ReportInfo_t instance for the parser output. - * - * \return A value in the \ref HID_Parse_ErrorCodes_t enum. - */ - uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, - uint16_t ReportSize, - HID_ReportInfo_t* const ParserData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Extracts the given report item's value out of the given HID report and places it into the Value - * member of the report item's \ref HID_ReportItem_t structure. - * - * When called on a report with an item that exists in that report, this copies the report item's \c Value - * to its \c PreviousValue element for easy checking to see if an item's value has changed before processing - * a report. If the given item does not exist in the report, the function does not modify the report item's - * data. - * - * \param[in] ReportData Buffer containing an IN or FEATURE report from an attached device. - * \param[in,out] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array. - * - * \returns Boolean \c true if the item to retrieve was located in the given report, \c false otherwise. - */ - bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, - HID_ReportItem_t* const ReportItem) ATTR_NON_NULL_PTR_ARG(1); - - /** Retrieves the given report item's value out of the \c Value member of the report item's - * \ref HID_ReportItem_t structure and places it into the correct position in the HID report - * buffer. The report buffer is assumed to have the appropriate bits cleared before calling - * this function (i.e., the buffer should be explicitly cleared before report values are added). - * - * When called, this copies the report item's \c Value element to its \c PreviousValue element for easy - * checking to see if an item's value has changed before sending a report. - * - * If the device has multiple HID reports, the first byte in the report is set to the report ID of the given item. - * - * \param[out] ReportData Buffer holding the current OUT or FEATURE report data. - * \param[in] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array. - */ - void USB_SetHIDReportItemInfo(uint8_t* ReportData, - HID_ReportItem_t* const ReportItem) ATTR_NON_NULL_PTR_ARG(1); - - /** Retrieves the size of a given HID report in bytes from its Report ID. - * - * \param[in] ParserData Pointer to a \ref HID_ReportInfo_t instance containing the parser output. - * \param[in] ReportID Report ID of the report whose size is to be determined. - * \param[in] ReportType Type of the report whose size is to be determined, a value from the - * \ref HID_ReportItemTypes_t enum. - * - * \return Size of the report in bytes, or \c 0 if the report does not exist. - */ - uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, - const uint8_t ReportID, - const uint8_t ReportType) ATTR_CONST ATTR_NON_NULL_PTR_ARG(1); - - /** Callback routine for the HID Report Parser. This callback must be implemented by the user code when - * the parser is used, to determine what report IN, OUT and FEATURE item's information is stored into the user - * \ref HID_ReportInfo_t structure. This can be used to filter only those items the application will be using, so that - * no RAM is wasted storing the attributes for report items which will never be referenced by the application. - * - * Report item pointers passed to this callback function may be cached by the user application for later use - * when processing report items. This provides faster report processing in the user application than would - * a search of the entire parsed report item table for each received or sent report. - * - * \param[in] CurrentItem Pointer to the current report item for user checking. - * - * \return Boolean \c true if the item should be stored into the \ref HID_ReportInfo_t structure, \c false if - * it should be ignored. - */ - bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Type Defines: */ - typedef struct - { - HID_ReportItem_Attributes_t Attributes; - uint8_t ReportCount; - uint8_t ReportID; - } HID_StateTable_t; - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h deleted file mode 100644 index 719739a5ff..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Constants for HID report item attributes. - * - * HID report item constants for report item attributes. Refer to the HID specification for - * details on each flag's meaning when applied to an IN, OUT or FEATURE item. - */ - -/** \ingroup Group_HIDParser - * \defgroup Group_HIDReportItemConst HID Report Descriptor Item Constants - * - * General HID constant definitions for HID Report Descriptor elements. - * - * @{ - */ - -#ifndef __HIDREPORTDATA_H__ -#define __HIDREPORTDATA_H__ - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define HID_RI_DATA_SIZE_MASK 0x03 - #define HID_RI_TYPE_MASK 0x0C - #define HID_RI_TAG_MASK 0xF0 - - #define HID_RI_TYPE_MAIN 0x00 - #define HID_RI_TYPE_GLOBAL 0x04 - #define HID_RI_TYPE_LOCAL 0x08 - - #define HID_RI_DATA_BITS_0 0x00 - #define HID_RI_DATA_BITS_8 0x01 - #define HID_RI_DATA_BITS_16 0x02 - #define HID_RI_DATA_BITS_32 0x03 - #define HID_RI_DATA_BITS(DataBits) HID_RI_DATA_BITS_ ## DataBits - - #define _HID_RI_ENCODE_0(Data) - #define _HID_RI_ENCODE_8(Data) , (Data & 0xFF) - #define _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_8(Data) _HID_RI_ENCODE_8(Data >> 8) - #define _HID_RI_ENCODE_32(Data) _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_16(Data >> 16) - #define _HID_RI_ENCODE(DataBits, ...) _HID_RI_ENCODE_ ## DataBits(__VA_ARGS__) - - #define _HID_RI_ENTRY(Type, Tag, DataBits, ...) (Type | Tag | HID_RI_DATA_BITS(DataBits)) _HID_RI_ENCODE(DataBits, (__VA_ARGS__)) - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name HID Input, Output and Feature Report Descriptor Item Flags */ - //@{ - #define HID_IOF_CONSTANT (1 << 0) - #define HID_IOF_DATA (0 << 0) - #define HID_IOF_VARIABLE (1 << 1) - #define HID_IOF_ARRAY (0 << 1) - #define HID_IOF_RELATIVE (1 << 2) - #define HID_IOF_ABSOLUTE (0 << 2) - #define HID_IOF_WRAP (1 << 3) - #define HID_IOF_NO_WRAP (0 << 3) - #define HID_IOF_NON_LINEAR (1 << 4) - #define HID_IOF_LINEAR (0 << 4) - #define HID_IOF_NO_PREFERRED_STATE (1 << 5) - #define HID_IOF_PREFERRED_STATE (0 << 5) - #define HID_IOF_NULLSTATE (1 << 6) - #define HID_IOF_NO_NULL_POSITION (0 << 6) - #define HID_IOF_VOLATILE (1 << 7) - #define HID_IOF_NON_VOLATILE (0 << 7) - #define HID_IOF_BUFFERED_BYTES (1 << 8) - #define HID_IOF_BITFIELD (0 << 8) - //@} - - /** \name HID Report Descriptor Item Macros */ - //@{ - #define HID_RI_INPUT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0x80, DataBits, __VA_ARGS__) - #define HID_RI_OUTPUT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0x90, DataBits, __VA_ARGS__) - #define HID_RI_COLLECTION(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xA0, DataBits, __VA_ARGS__) - #define HID_RI_FEATURE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xB0, DataBits, __VA_ARGS__) - #define HID_RI_END_COLLECTION(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xC0, DataBits, __VA_ARGS__) - #define HID_RI_USAGE_PAGE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x00, DataBits, __VA_ARGS__) - #define HID_RI_LOGICAL_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x10, DataBits, __VA_ARGS__) - #define HID_RI_LOGICAL_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x20, DataBits, __VA_ARGS__) - #define HID_RI_PHYSICAL_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x30, DataBits, __VA_ARGS__) - #define HID_RI_PHYSICAL_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x40, DataBits, __VA_ARGS__) - #define HID_RI_UNIT_EXPONENT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x50, DataBits, __VA_ARGS__) - #define HID_RI_UNIT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x60, DataBits, __VA_ARGS__) - #define HID_RI_REPORT_SIZE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x70, DataBits, __VA_ARGS__) - #define HID_RI_REPORT_ID(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x80, DataBits, __VA_ARGS__) - #define HID_RI_REPORT_COUNT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x90, DataBits, __VA_ARGS__) - #define HID_RI_PUSH(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xA0, DataBits, __VA_ARGS__) - #define HID_RI_POP(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xB0, DataBits, __VA_ARGS__) - #define HID_RI_USAGE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x00, DataBits, __VA_ARGS__) - #define HID_RI_USAGE_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x10, DataBits, __VA_ARGS__) - #define HID_RI_USAGE_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x20, DataBits, __VA_ARGS__) - //@} - -/** @} */ - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h deleted file mode 100644 index e0b77eca86..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h +++ /dev/null @@ -1,320 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB MIDI Class driver. - * - * Common definitions and declarations for the library USB MIDI Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassMIDI - * \defgroup Group_USBClassMIDICommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * MIDI Class. - * - * @{ - */ - -#ifndef _MIDI_CLASS_COMMON_H_ -#define _MIDI_CLASS_COMMON_H_ - - /* Macros: */ - #define __INCLUDE_FROM_AUDIO_DRIVER - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - #include "AudioClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_MIDI_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** \name MIDI Command Values */ - //@{ - /** MIDI command for a note on (activation) event. */ - #define MIDI_COMMAND_NOTE_ON 0x90 - - /** MIDI command for a note off (deactivation) event. */ - #define MIDI_COMMAND_NOTE_OFF 0x80 - //@} - - /** Standard key press velocity value used for all note events. */ - #define MIDI_STANDARD_VELOCITY 64 - - /** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel - * addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address. - * - * \param[in] channel MIDI channel number to address. - * - * \return Constructed MIDI channel ID. - */ - #define MIDI_CHANNEL(channel) ((channel) - 1) - - /** Constructs a MIDI event ID from a given MIDI command and a virtual MIDI cable index. This can then be - * used to create and decode \ref MIDI_EventPacket_t MIDI event packets. - * - * \param[in] virtualcable Index of the virtual MIDI cable the event relates to - * \param[in] command MIDI command to send through the virtual MIDI cable - * - * \return Constructed MIDI event ID. - */ - #define MIDI_EVENT(virtualcable, command) ((virtualcable << 4) | (command >> 4)) - - /* Enums: */ - /** Enum for the possible MIDI jack types in a MIDI device jack descriptor. */ - enum MIDI_JackTypes_t - { - MIDI_JACKTYPE_Embedded = 0x01, /**< MIDI class descriptor jack type value for an embedded (logical) MIDI input or output jack. */ - MIDI_JACKTYPE_External = 0x02, /**< MIDI class descriptor jack type value for an external (physical) MIDI input or output jack. */ - }; - - /* Type Defines: */ - /** \brief MIDI class-specific Streaming Interface Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific MIDI streaming interface descriptor. This indicates to the host - * how MIDI the specification compliance of the device and the total length of the Audio class-specific descriptors. - * See the USB Audio specification for more details. - * - * \see \ref USB_MIDI_StdDescriptor_AudioInterface_AS_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class - * specification version. - */ - uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ - } ATTR_PACKED USB_MIDI_Descriptor_AudioInterface_AS_t; - - /** \brief MIDI class-specific Streaming Interface Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific MIDI streaming interface descriptor. This indicates to the host - * how MIDI the specification compliance of the device and the total length of the Audio class-specific descriptors. - * See the USB Audio specification for more details. - * - * \see \ref USB_MIDI_Descriptor_AudioInterface_AS_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint16_t bcdMSC; /**< Binary coded decimal value, indicating the supported MIDI Class specification version. */ - uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ - } ATTR_PACKED USB_MIDI_StdDescriptor_AudioInterface_AS_t; - - /** \brief MIDI class-specific Input Jack Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific MIDI IN jack. This gives information to the host on a MIDI input, either - * a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint). - * - * \see \ref USB_MIDI_StdDescriptor_InputJack_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint8_t JackType; /**< Type of jack, one of the \c JACKTYPE_* mask values. */ - uint8_t JackID; /**< ID value of this jack - must be a unique value within the device. */ - - uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_MIDI_Descriptor_InputJack_t; - - /** \brief MIDI class-specific Input Jack Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific MIDI IN jack. This gives information to the host on a MIDI input, either - * a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint). - * - * \see \ref USB_MIDI_Descriptor_InputJack_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint8_t bJackType; /**< Type of jack, one of the \c JACKTYPE_* mask values. */ - uint8_t bJackID; /**< ID value of this jack - must be a unique value within the device. */ - - uint8_t iJack; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_MIDI_StdDescriptor_InputJack_t; - - /** \brief MIDI class-specific Output Jack Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific MIDI OUT jack. This gives information to the host on a MIDI output, either - * a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint). - * - * \see \ref USB_MIDI_StdDescriptor_OutputJack_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint8_t JackType; /**< Type of jack, one of the \c JACKTYPE_* mask values. */ - uint8_t JackID; /**< ID value of this jack - must be a unique value within the device. */ - - uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical. */ - uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack. */ - uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data. */ - - uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_MIDI_Descriptor_OutputJack_t; - - /** \brief MIDI class-specific Output Jack Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific MIDI OUT jack. This gives information to the host on a MIDI output, either - * a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint). - * - * \see \ref USB_MIDI_Descriptor_OutputJack_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint8_t bJackType; /**< Type of jack, one of the \c JACKTYPE_* mask values. */ - uint8_t bJackID; /**< ID value of this jack - must be a unique value within the device. */ - - uint8_t bNrInputPins; /**< Number of output channels within the jack, either physical or logical. */ - uint8_t baSourceID[1]; /**< ID of each output pin's source data jack. */ - uint8_t baSourcePin[1]; /**< Pin number in the input jack of each output pin's source data. */ - - uint8_t iJack; /**< Index of a string descriptor describing this descriptor within the device. */ - } ATTR_PACKED USB_MIDI_StdDescriptor_OutputJack_t; - - /** \brief Audio class-specific Jack Endpoint Descriptor (LUFA naming conventions). - * - * Type define for an Audio class-specific extended MIDI jack endpoint descriptor. This contains extra information - * on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio - * class-specific extended MIDI endpoint descriptor. See the USB Audio specification for more details. - * - * \see \ref USB_MIDI_StdDescriptor_Jack_Endpoint_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */ - uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint. */ - uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint. */ - } ATTR_PACKED USB_MIDI_Descriptor_Jack_Endpoint_t; - - /** \brief Audio class-specific Jack Endpoint Descriptor (USB-IF naming conventions). - * - * Type define for an Audio class-specific extended MIDI jack endpoint descriptor. This contains extra information - * on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio - * class-specific extended MIDI endpoint descriptor. See the USB Audio specification for more details. - * - * \see \ref USB_MIDI_Descriptor_Jack_Endpoint_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - - uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ - - uint8_t bNumEmbMIDIJack; /**< Total number of jacks inside this endpoint. */ - uint8_t bAssocJackID[1]; /**< IDs of each jack inside the endpoint. */ - } ATTR_PACKED USB_MIDI_StdDescriptor_Jack_Endpoint_t; - - /** \brief MIDI Class Driver Event Packet. - * - * Type define for a USB MIDI event packet, used to encapsulate sent and received MIDI messages from a USB MIDI interface. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t Event; /**< MIDI event type, constructed with the \ref MIDI_EVENT() macro. */ - - uint8_t Data1; /**< First byte of data in the MIDI event. */ - uint8_t Data2; /**< Second byte of data in the MIDI event. */ - uint8_t Data3; /**< Third byte of data in the MIDI event. */ - } ATTR_PACKED MIDI_EventPacket_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h deleted file mode 100644 index 38167f64e3..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB Mass Storage Class driver. - * - * Common definitions and declarations for the library USB Mass Storage Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassMS - * \defgroup Group_USBClassMSCommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * Mass Storage Class. - * - * @{ - */ - -#ifndef _MS_CLASS_COMMON_H_ -#define _MS_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_MS_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */ - #define MS_CBW_SIGNATURE 0x43425355UL - - /** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */ - #define MS_CSW_SIGNATURE 0x53425355UL - - /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */ - #define MS_COMMAND_DIR_DATA_OUT (0 << 7) - - /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */ - #define MS_COMMAND_DIR_DATA_IN (1 << 7) - - /** \name SCSI Commands*/ - //@{ - /** SCSI Command Code for an INQUIRY command. */ - #define SCSI_CMD_INQUIRY 0x12 - - /** SCSI Command Code for a REQUEST SENSE command. */ - #define SCSI_CMD_REQUEST_SENSE 0x03 - - /** SCSI Command Code for a TEST UNIT READY command. */ - #define SCSI_CMD_TEST_UNIT_READY 0x00 - - /** SCSI Command Code for a READ CAPACITY (10) command. */ - #define SCSI_CMD_READ_CAPACITY_10 0x25 - - /** SCSI Command Code for a SEND DIAGNOSTIC command. */ - #define SCSI_CMD_SEND_DIAGNOSTIC 0x1D - - /** SCSI Command Code for a PREVENT ALLOW MEDIUM REMOVAL command. */ - #define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E - - /** SCSI Command Code for a WRITE (10) command. */ - #define SCSI_CMD_WRITE_10 0x2A - - /** SCSI Command Code for a READ (10) command. */ - #define SCSI_CMD_READ_10 0x28 - - /** SCSI Command Code for a WRITE (6) command. */ - #define SCSI_CMD_WRITE_6 0x0A - - /** SCSI Command Code for a READ (6) command. */ - #define SCSI_CMD_READ_6 0x08 - - /** SCSI Command Code for a VERIFY (10) command. */ - #define SCSI_CMD_VERIFY_10 0x2F - - /** SCSI Command Code for a MODE SENSE (6) command. */ - #define SCSI_CMD_MODE_SENSE_6 0x1A - - /** SCSI Command Code for a MODE SENSE (10) command. */ - #define SCSI_CMD_MODE_SENSE_10 0x5A - //@} - - /** \name SCSI Sense Key Values */ - //@{ - /** SCSI Sense Code to indicate no error has occurred. */ - #define SCSI_SENSE_KEY_GOOD 0x00 - - /** SCSI Sense Code to indicate that the device has recovered from an error. */ - #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 - - /** SCSI Sense Code to indicate that the device is not ready for a new command. */ - #define SCSI_SENSE_KEY_NOT_READY 0x02 - - /** SCSI Sense Code to indicate an error whilst accessing the medium. */ - #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 - - /** SCSI Sense Code to indicate a hardware error has occurred. */ - #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 - - /** SCSI Sense Code to indicate that an illegal request has been issued. */ - #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 - - /** SCSI Sense Code to indicate that the unit requires attention from the host to indicate - * a reset event, medium removal or other condition. - */ - #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 - - /** SCSI Sense Code to indicate that a write attempt on a protected block has been made. */ - #define SCSI_SENSE_KEY_DATA_PROTECT 0x07 - - /** SCSI Sense Code to indicate an error while trying to write to a write-once medium. */ - #define SCSI_SENSE_KEY_BLANK_CHECK 0x08 - - /** SCSI Sense Code to indicate a vendor specific error has occurred. */ - #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09 - - /** SCSI Sense Code to indicate that an EXTENDED COPY command has aborted due to an error. */ - #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A - - /** SCSI Sense Code to indicate that the device has aborted the issued command. */ - #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B - - /** SCSI Sense Code to indicate an attempt to write past the end of a partition has been made. */ - #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D - - /** SCSI Sense Code to indicate that the source data did not match the data read from the medium. */ - #define SCSI_SENSE_KEY_MISCOMPARE 0x0E - //@} - - /** \name SCSI Additional Sense Codes */ - //@{ - /** SCSI Additional Sense Code to indicate no additional sense information is available. */ - #define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00 - - /** SCSI Additional Sense Code to indicate that the logical unit (LUN) addressed is not ready. */ - #define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04 - - /** SCSI Additional Sense Code to indicate an invalid field was encountered while processing the issued command. */ - #define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24 - - /** SCSI Additional Sense Code to indicate that a medium that was previously indicated as not ready has now - * become ready for use. - */ - #define SCSI_ASENSE_NOT_READY_TO_READY_CHANGE 0x28 - - /** SCSI Additional Sense Code to indicate that an attempt to write to a protected area was made. */ - #define SCSI_ASENSE_WRITE_PROTECTED 0x27 - - /** SCSI Additional Sense Code to indicate an error whilst formatting the device medium. */ - #define SCSI_ASENSE_FORMAT_ERROR 0x31 - - /** SCSI Additional Sense Code to indicate an invalid command was issued. */ - #define SCSI_ASENSE_INVALID_COMMAND 0x20 - - /** SCSI Additional Sense Code to indicate a write to a block out outside of the medium's range was issued. */ - #define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21 - - /** SCSI Additional Sense Code to indicate that no removable medium is inserted into the device. */ - #define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A - //@} - - /** \name SCSI Additional Sense Key Code Qualifiers */ - //@{ - /** SCSI Additional Sense Qualifier Code to indicate no additional sense qualifier information is available. */ - #define SCSI_ASENSEQ_NO_QUALIFIER 0x00 - - /** SCSI Additional Sense Qualifier Code to indicate that a medium format command failed to complete. */ - #define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01 - - /** SCSI Additional Sense Qualifier Code to indicate that an initializing command must be issued before the issued - * command can be executed. - */ - #define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02 - - /** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */ - #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07 - //@} - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Mass - * Storage device class. - */ - enum MS_Descriptor_ClassSubclassProtocol_t - { - MS_CSCP_MassStorageClass = 0x08, /**< Descriptor Class value indicating that the device or interface - * belongs to the Mass Storage class. - */ - MS_CSCP_SCSITransparentSubclass = 0x06, /**< Descriptor Subclass value indicating that the device or interface - * belongs to the SCSI Transparent Command Set subclass of the Mass - * storage class. - */ - MS_CSCP_BulkOnlyTransportProtocol = 0x50, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the Bulk Only Transport protocol of the Mass Storage class. - */ - }; - - /** Enum for the Mass Storage class specific control requests that can be issued by the USB bus host. */ - enum MS_ClassRequests_t - { - MS_REQ_GetMaxLUN = 0xFE, /**< Mass Storage class-specific request to retrieve the total number of Logical - * Units (drives) in the SCSI device. - */ - MS_REQ_MassStorageReset = 0xFF, /**< Mass Storage class-specific request to reset the Mass Storage interface, - * ready for the next command. - */ - }; - - /** Enum for the possible command status wrapper return status codes. */ - enum MS_CommandStatusCodes_t - { - MS_SCSI_COMMAND_Pass = 0, /**< Command completed with no error */ - MS_SCSI_COMMAND_Fail = 1, /**< Command failed to complete - host may check the exact error via a - * SCSI REQUEST SENSE command. - */ - MS_SCSI_COMMAND_PhaseError = 2, /**< Command failed due to being invalid in the current phase. */ - }; - - /* Type Defines: */ - /** \brief Mass Storage Class Command Block Wrapper. - * - * Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t Signature; /**< Command block signature, must be \ref MS_CBW_SIGNATURE to indicate a valid Command Block. */ - uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper. */ - uint32_t DataTransferLength; /**< Length of the optional data portion of the issued command, in bytes. */ - uint8_t Flags; /**< Command block flags, indicating command data direction. */ - uint8_t LUN; /**< Logical Unit number this command is issued to. */ - uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array. */ - uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block. */ - } ATTR_PACKED MS_CommandBlockWrapper_t; - - /** \brief Mass Storage Class Command Status Wrapper. - * - * Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t Signature; /**< Status block signature, must be \ref MS_CSW_SIGNATURE to indicate a valid Command Status. */ - uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper. */ - uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command. */ - uint8_t Status; /**< Status code of the issued command - a value from the \ref MS_CommandStatusCodes_t enum. */ - } ATTR_PACKED MS_CommandStatusWrapper_t; - - /** \brief Mass Storage Class SCSI Sense Structure - * - * Type define for a SCSI Sense structure. Structures of this type are filled out by the - * device via the \ref MS_Host_RequestSense() function, indicating the current sense data of the - * device (giving explicit error codes for the last issued command). For details of the - * structure contents, refer to the SCSI specifications. - */ - typedef struct - { - uint8_t ResponseCode; - - uint8_t SegmentNumber; - - unsigned SenseKey : 4; - unsigned Reserved : 1; - unsigned ILI : 1; - unsigned EOM : 1; - unsigned FileMark : 1; - - uint8_t Information[4]; - uint8_t AdditionalLength; - uint8_t CmdSpecificInformation[4]; - uint8_t AdditionalSenseCode; - uint8_t AdditionalSenseQualifier; - uint8_t FieldReplaceableUnitCode; - uint8_t SenseKeySpecific[3]; - } ATTR_PACKED SCSI_Request_Sense_Response_t; - - /** \brief Mass Storage Class SCSI Inquiry Structure. - * - * Type define for a SCSI Inquiry structure. Structures of this type are filled out by the - * device via the \ref MS_Host_GetInquiryData() function, retrieving the attached device's - * information. - * - * For details of the structure contents, refer to the SCSI specifications. - */ - typedef struct - { - unsigned DeviceType : 5; - unsigned PeripheralQualifier : 3; - - unsigned Reserved : 7; - unsigned Removable : 1; - - uint8_t Version; - - unsigned ResponseDataFormat : 4; - unsigned Reserved2 : 1; - unsigned NormACA : 1; - unsigned TrmTsk : 1; - unsigned AERC : 1; - - uint8_t AdditionalLength; - uint8_t Reserved3[2]; - - unsigned SoftReset : 1; - unsigned CmdQue : 1; - unsigned Reserved4 : 1; - unsigned Linked : 1; - unsigned Sync : 1; - unsigned WideBus16Bit : 1; - unsigned WideBus32Bit : 1; - unsigned RelAddr : 1; - - uint8_t VendorID[8]; - uint8_t ProductID[16]; - uint8_t RevisionID[4]; - } ATTR_PACKED SCSI_Inquiry_Response_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h deleted file mode 100644 index eea39297c8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB Printer Class driver. - * - * Common definitions and declarations for the library USB Printer Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassPrinter - * \defgroup Group_USBClassPrinterCommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * Printer Class. - * - * @{ - */ - -#ifndef _PRINTER_CLASS_COMMON_H_ -#define _PRINTER_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_PRINTER_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** \name Virtual Printer Status Line Masks */ - //@{ - /** Port status mask for a printer device, indicating that an error has *not* occurred. */ - #define PRNT_PORTSTATUS_NOTERROR (1 << 3) - - /** Port status mask for a printer device, indicating that the device is currently selected. */ - #define PRNT_PORTSTATUS_SELECT (1 << 4) - - /** Port status mask for a printer device, indicating that the device is currently out of paper. */ - #define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5) - //@} - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Printer - * device class. - */ - enum PRNT_Descriptor_ClassSubclassProtocol_t - { - PRNT_CSCP_PrinterClass = 0x07, /**< Descriptor Class value indicating that the device or interface - * belongs to the Printer class. - */ - PRNT_CSCP_PrinterSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface - * belongs to the Printer subclass. - */ - PRNT_CSCP_BidirectionalProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the Bidirectional protocol of the Printer class. - */ - }; - - /** Enum for the Printer class specific control requests that can be issued by the USB bus host. */ - enum PRNT_ClassRequests_t - { - PRNT_REQ_GetDeviceID = 0x00, /**< Printer class-specific request to retrieve the Unicode ID - * string of the device, containing the device's name, manufacturer - * and supported printer languages. - */ - PRNT_REQ_GetPortStatus = 0x01, /**< Printer class-specific request to get the current status of the - * virtual printer port, for device selection and ready states. - */ - PRNT_REQ_SoftReset = 0x02, /**< Printer class-specific request to reset the device, ready for new - * printer commands. - */ - }; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h deleted file mode 100644 index bc4112189f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h +++ /dev/null @@ -1,414 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB RNDIS Class driver. - * - * Common definitions and declarations for the library USB RNDIS Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassRNDIS - * \defgroup Group_USBClassRNDISCommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * RNDIS Class. - * - * @{ - */ - -#ifndef _RNDIS_CLASS_COMMON_H_ -#define _RNDIS_CLASS_COMMON_H_ - - /* Macros: */ - #define __INCLUDE_FROM_CDC_DRIVER - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - #include "CDCClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** Additional error code for RNDIS functions when a device returns a logical command failure. */ - #define RNDIS_ERROR_LOGICAL_CMD_FAILED 0x80 - - /** Implemented RNDIS Version Major. */ - #define REMOTE_NDIS_VERSION_MAJOR 0x01 - - /** Implemented RNDIS Version Minor. */ - #define REMOTE_NDIS_VERSION_MINOR 0x00 - - /** \name RNDIS Message Values */ - //@{ - #define REMOTE_NDIS_PACKET_MSG 0x00000001UL - #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002UL - #define REMOTE_NDIS_HALT_MSG 0x00000003UL - #define REMOTE_NDIS_QUERY_MSG 0x00000004UL - #define REMOTE_NDIS_SET_MSG 0x00000005UL - #define REMOTE_NDIS_RESET_MSG 0x00000006UL - #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007UL - #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008UL - //@} - - /** \name RNDIS Response Values */ - //@{ - #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002UL - #define REMOTE_NDIS_QUERY_CMPLT 0x80000004UL - #define REMOTE_NDIS_SET_CMPLT 0x80000005UL - #define REMOTE_NDIS_RESET_CMPLT 0x80000006UL - #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL - //@} - - /** \name RNDIS Status Values */ - //@{ - #define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL - #define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL - #define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL - #define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL - #define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL - #define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL - //@} - - /** \name RNDIS Media States */ - //@{ - #define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL - #define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL - //@} - - /** \name RNDIS Media Types */ - //@{ - #define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL - //@} - - /** \name RNDIS Connection Types */ - //@{ - #define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL - #define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL - //@} - - /** \name RNDIS Packet Types */ - //@{ - #define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL - #define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL - #define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL - #define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL - #define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL - #define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL - #define REMOTE_NDIS_PACKET_SMT 0x00000040UL - #define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL - #define REMOTE_NDIS_PACKET_GROUP 0x00001000UL - #define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL - #define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL - #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL - //@} - - /** \name RNDIS OID Values */ - //@{ - #define OID_GEN_SUPPORTED_LIST 0x00010101UL - #define OID_GEN_HARDWARE_STATUS 0x00010102UL - #define OID_GEN_MEDIA_SUPPORTED 0x00010103UL - #define OID_GEN_MEDIA_IN_USE 0x00010104UL - #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL - #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL - #define OID_GEN_LINK_SPEED 0x00010107UL - #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL - #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL - #define OID_GEN_VENDOR_ID 0x0001010CUL - #define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL - #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL - #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL - #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL - #define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL - #define OID_GEN_XMIT_OK 0x00020101UL - #define OID_GEN_RCV_OK 0x00020102UL - #define OID_GEN_XMIT_ERROR 0x00020103UL - #define OID_GEN_RCV_ERROR 0x00020104UL - #define OID_GEN_RCV_NO_BUFFER 0x00020105UL - #define OID_802_3_PERMANENT_ADDRESS 0x01010101UL - #define OID_802_3_CURRENT_ADDRESS 0x01010102UL - #define OID_802_3_MULTICAST_LIST 0x01010103UL - #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL - #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL - #define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL - #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL - //@} - - /** Maximum size in bytes of a RNDIS control message which can be sent or received. */ - #define RNDIS_MESSAGE_BUFFER_SIZE 128 - - /** Maximum size in bytes of an Ethernet frame according to the Ethernet standard. */ - #define ETHERNET_FRAME_SIZE_MAX 1500 - - /* Enums: */ - /** Enum for the RNDIS class specific control requests that can be issued by the USB bus host. */ - enum RNDIS_ClassRequests_t - { - RNDIS_REQ_SendEncapsulatedCommand = 0x00, /**< RNDIS request to issue a host-to-device NDIS command. */ - RNDIS_REQ_GetEncapsulatedResponse = 0x01, /**< RNDIS request to issue a device-to-host NDIS response. */ - }; - - /** Enum for the possible NDIS adapter states. */ - enum RNDIS_States_t - { - RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized. */ - RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers. */ - RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers. */ - }; - - /** Enum for the RNDIS class specific notification requests that can be issued by a RNDIS device to a host. */ - enum RNDIS_ClassNotifications_t - { - RNDIS_NOTIF_ResponseAvailable = 0x01, /**< Notification request value for a RNDIS Response Available notification. */ - }; - - /** Enum for the NDIS hardware states. */ - enum NDIS_Hardware_Status_t - { - NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host. */ - NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing. */ - NDIS_HardwareStatus_Reset, /**< Hardware reset. */ - NDIS_HardwareStatus_Closing, /**< Hardware currently closing. */ - NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host. */ - }; - - /* Type Defines: */ - /** \brief MAC Address Structure. - * - * Type define for a physical MAC address of a device on a network. - */ - typedef struct - { - uint8_t Octets[6]; /**< Individual bytes of a MAC address */ - } ATTR_PACKED MAC_Address_t; - - /** \brief RNDIS Common Message Header Structure. - * - * Type define for a RNDIS message header, sent before RNDIS messages. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; /**< RNDIS message type, a \c REMOTE_NDIS_*_MSG constant */ - uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */ - } ATTR_PACKED RNDIS_Message_Header_t; - - /** \brief RNDIS Message Structure. - * - * Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t DataOffset; - uint32_t DataLength; - uint32_t OOBDataOffset; - uint32_t OOBDataLength; - uint32_t NumOOBDataElements; - uint32_t PerPacketInfoOffset; - uint32_t PerPacketInfoLength; - uint32_t VcHandle; - uint32_t Reserved; - } ATTR_PACKED RNDIS_Packet_Message_t; - - /** \brief RNDIS Initialization Message Structure. - * - * Type define for a RNDIS Initialize command message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - - uint32_t MajorVersion; - uint32_t MinorVersion; - uint32_t MaxTransferSize; - } ATTR_PACKED RNDIS_Initialize_Message_t; - - /** \brief RNDIS Initialize Complete Message Structure. - * - * Type define for a RNDIS Initialize Complete response message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - uint32_t Status; - - uint32_t MajorVersion; - uint32_t MinorVersion; - uint32_t DeviceFlags; - uint32_t Medium; - uint32_t MaxPacketsPerTransfer; - uint32_t MaxTransferSize; - uint32_t PacketAlignmentFactor; - uint32_t AFListOffset; - uint32_t AFListSize; - } ATTR_PACKED RNDIS_Initialize_Complete_t; - - /** \brief RNDIS Keep Alive Message Structure. - * - * Type define for a RNDIS Keep Alive command message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - } ATTR_PACKED RNDIS_KeepAlive_Message_t; - - /** \brief RNDIS Keep Alive Complete Message Structure. - * - * Type define for a RNDIS Keep Alive Complete response message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - uint32_t Status; - } ATTR_PACKED RNDIS_KeepAlive_Complete_t; - - /** \brief RNDIS Reset Complete Message Structure. - * - * Type define for a RNDIS Reset Complete response message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t Status; - - uint32_t AddressingReset; - } ATTR_PACKED RNDIS_Reset_Complete_t; - - /** \brief RNDIS OID Property Set Message Structure. - * - * Type define for a RNDIS OID Property Set command message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - - uint32_t Oid; - uint32_t InformationBufferLength; - uint32_t InformationBufferOffset; - uint32_t DeviceVcHandle; - } ATTR_PACKED RNDIS_Set_Message_t; - - /** \brief RNDIS OID Property Set Complete Message Structure. - * - * Type define for a RNDIS OID Property Set Complete response message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - uint32_t Status; - } ATTR_PACKED RNDIS_Set_Complete_t; - - /** \brief RNDIS OID Property Query Message Structure. - * - * Type define for a RNDIS OID Property Query command message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - - uint32_t Oid; - uint32_t InformationBufferLength; - uint32_t InformationBufferOffset; - uint32_t DeviceVcHandle; - } ATTR_PACKED RNDIS_Query_Message_t; - - /** \brief RNDIS OID Property Query Complete Message Structure. - * - * Type define for a RNDIS OID Property Query Complete response message. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t MessageType; - uint32_t MessageLength; - uint32_t RequestId; - uint32_t Status; - - uint32_t InformationBufferLength; - uint32_t InformationBufferOffset; - } ATTR_PACKED RNDIS_Query_Complete_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h deleted file mode 100644 index a3388e2e76..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common definitions and declarations for the library USB Still Image Class driver. - * - * Common definitions and declarations for the library USB Still Image Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassSI - * \defgroup Group_USBClassSICommon Common Class Definitions - * - * \section Sec_ModDescription Module Description - * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB - * Still Image Class. - * - * @{ - */ - -#ifndef _SI_CLASS_COMMON_H_ -#define _SI_CLASS_COMMON_H_ - - /* Includes: */ - #include "../../Core/StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SI_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Macros: */ - /** Length in bytes of a given Unicode string's character length. - * - * \param[in] Chars Total number of Unicode characters in the string. - * - * \return Number of bytes of the given unicode string. - */ - #define UNICODE_STRING_LENGTH(Chars) ((Chars) << 1) - - /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for - * a command container. - * - * \param[in] Params Number of parameters which are to be sent in the \c Param field of the container. - */ - #define PIMA_COMMAND_SIZE(Params) ((sizeof(PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t))) - - /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for - * a data container. - * - * \param[in] DataLen Length in bytes of the data in the container. - */ - #define PIMA_DATA_SIZE(DataLen) ((sizeof(PIMA_Container_t) - 12) + (DataLen)) - - /* Enums: */ - /** Enum for the possible PIMA contains types. */ - enum PIMA_Container_Types_t - { - PIMA_CONTAINER_Undefined = 0, /**< Undefined container type. */ - PIMA_CONTAINER_CommandBlock = 1, /**< Command Block container type. */ - PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */ - PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */ - PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */ - }; - - /* Enums: */ - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the - * Still Image device class. - */ - enum SI_Descriptor_ClassSubclassProtocol_t - { - SI_CSCP_StillImageClass = 0x06, /**< Descriptor Class value indicating that the device or interface - * belongs to the Still Image class. - */ - SI_CSCP_StillImageSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface - * belongs to the Still Image subclass. - */ - SI_CSCP_BulkOnlyProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface - * belongs to the Bulk Only Transport protocol of the Still Image class. - */ - }; - - /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */ - enum PIMA_ResponseCodes_t - { - PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */ - PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the - * issued command. - */ - PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open - * session before being issued. - */ - PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */ - PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported - * by the attached device. - */ - PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's - * parameters are not supported by the device. - */ - }; - - /* Type Defines: */ - /** \brief PIMA Still Image Device Command/Response Container. - * - * Type define for a PIMA container, use to send commands and receive responses to and from an - * attached Still Image device. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint32_t DataLength; /**< Length of the container and data, in bytes. */ - uint16_t Type; /**< Container type, a value from the \ref PIMA_Container_Types_t enum. */ - uint16_t Code; /**< Command, event or response code of the container. */ - uint32_t TransactionID; /**< Unique container ID to link blocks together. */ - uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only). */ - } ATTR_PACKED PIMA_Container_t; - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c deleted file mode 100644 index 3fb350a119..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_AUDIO_DRIVER -#define __INCLUDE_FROM_AUDIO_DEVICE_C -#include "AudioClassDevice.h" - -void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) -{ - if (!(Endpoint_IsSETUPReceived())) - return; - - if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) - { - uint8_t InterfaceIndex = (USB_ControlRequest.wIndex & 0xFF); - - if ((InterfaceIndex != AudioInterfaceInfo->Config.ControlInterfaceNumber) && - (InterfaceIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber)) - { - return; - } - } - else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) - { - uint8_t EndpointAddress = (USB_ControlRequest.wIndex & 0xFF); - - if ((EndpointAddress != AudioInterfaceInfo->Config.DataINEndpoint.Address) && - (EndpointAddress != AudioInterfaceInfo->Config.DataOUTEndpoint.Address)) - { - return; - } - } - - switch (USB_ControlRequest.bRequest) - { - case REQ_SetInterface: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0); - EVENT_Audio_Device_StreamStartStop(AudioInterfaceInfo); - } - - break; - case AUDIO_REQ_GetStatus: - if ((USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) || - (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - } - - break; - case AUDIO_REQ_SetCurrent: - case AUDIO_REQ_SetMinimum: - case AUDIO_REQ_SetMaximum: - case AUDIO_REQ_SetResolution: - if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) - { - uint8_t EndpointProperty = USB_ControlRequest.bRequest; - uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; - uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); - - if (CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, - EndpointControl, NULL, NULL)) - { - uint16_t ValueLength = USB_ControlRequest.wLength; - uint8_t Value[ValueLength]; - - Endpoint_ClearSETUP(); - Endpoint_Read_Control_Stream_LE(Value, ValueLength); - Endpoint_ClearIN(); - - CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, - EndpointControl, &ValueLength, Value); - } - } - else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) - { - uint8_t Property = USB_ControlRequest.bRequest; - uint8_t Entity = (USB_ControlRequest.wIndex >> 8); - uint16_t Parameter = USB_ControlRequest.wValue; - - if (CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, - Parameter, NULL, NULL)) - { - uint16_t ValueLength = USB_ControlRequest.wLength; - uint8_t Value[ValueLength]; - - Endpoint_ClearSETUP(); - Endpoint_Read_Control_Stream_LE(Value, ValueLength); - Endpoint_ClearIN(); - - CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, - Parameter, &ValueLength, Value); - } - } - - break; - case AUDIO_REQ_GetCurrent: - case AUDIO_REQ_GetMinimum: - case AUDIO_REQ_GetMaximum: - case AUDIO_REQ_GetResolution: - if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) - { - uint8_t EndpointProperty = USB_ControlRequest.bRequest; - uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; - uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); - uint16_t ValueLength = USB_ControlRequest.wLength; - uint8_t Value[ValueLength]; - - if (CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, - EndpointControl, &ValueLength, Value)) - { - Endpoint_ClearSETUP(); - Endpoint_Write_Control_Stream_LE(Value, ValueLength); - Endpoint_ClearOUT(); - } - } - else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) - { - uint8_t Property = USB_ControlRequest.bRequest; - uint8_t Entity = (USB_ControlRequest.wIndex >> 8); - uint16_t Parameter = USB_ControlRequest.wValue; - uint16_t ValueLength = USB_ControlRequest.wLength; - uint8_t Value[ValueLength]; - - if (CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, - Parameter, &ValueLength, Value)) - { - Endpoint_ClearSETUP(); - Endpoint_Write_Control_Stream_LE(Value, ValueLength); - Endpoint_ClearOUT(); - } - } - - break; - } -} - -bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) -{ - memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State)); - - AudioInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_ISOCHRONOUS; - AudioInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_ISOCHRONOUS; - - if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataINEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataOUTEndpoint, 1))) - return false; - - return true; -} - -// cppcheck-suppress unusedFunction -void Audio_Device_Event_Stub(void) -{ - -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h deleted file mode 100644 index 09a8328086..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h +++ /dev/null @@ -1,396 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Device mode driver for the library USB Audio 1.0 Class driver. - * - * Device mode driver for the library USB Audio 1.0 Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAudio - * \defgroup Group_USBClassAudioDevice Audio 1.0 Class Device Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/AudioClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Device Mode USB Class driver framework interface, for the Audio 1.0 USB Class driver. - * - * @{ - */ - -#ifndef _AUDIO_CLASS_DEVICE_H_ -#define _AUDIO_CLASS_DEVICE_H_ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/AudioClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AUDIO_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief Audio Class Device Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made for each Audio interface - * within the user application, and passed to each of the Audio class driver functions as the - * \c AudioInterfaceInfo parameter. This stores each Audio interface's configuration and state information. - */ - typedef struct - { - struct - { - uint8_t ControlInterfaceNumber; /**< Index of the Audio Control interface within the device this - * structure controls. - */ - uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this - * structure controls. - */ - - USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ - USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool InterfaceEnabled; /**< Set and cleared by the class driver to indicate if the host has enabled the streaming endpoints - * of the Audio Streaming interface. - */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * are reset to their defaults when the interface is enumerated. - */ - } USB_ClassInfo_Audio_Device_t; - - /* Function Prototypes: */ - /** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library - * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the - * given Audio interface is selected. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. - */ - bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Processes incoming control requests from the host, that are directed to the given Audio class interface. This should be - * linked to the library \ref EVENT_USB_Device_ControlRequest() event. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - */ - void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Audio class driver callback for the setting and retrieval of streaming endpoint properties. This callback must be implemented - * in the user application to handle property manipulations on streaming audio endpoints. - * - * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for - * the given endpoint index, and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retrieved data. - * - * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value - * of the \c DataLength parameter. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t. - * \param[in] EndpointAddress Address of the streaming endpoint whose property is being referenced. - * \param[in] EndpointControl Parameter of the endpoint to get or set, a value from \ref Audio_EndpointControls_t. - * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum - * length of the retrieved data. When NULL, the function should return whether the given property - * and parameter is valid for the requested endpoint without reading or modifying the Data buffer. - * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where - * the retrieved data is to be stored for GET operations. - * - * \return Boolean \c true if the property GET/SET was successful, \c false otherwise - */ - bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const uint8_t EndpointProperty, - const uint8_t EndpointAddress, - const uint8_t EndpointControl, - uint16_t* const DataLength, - uint8_t* Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Audio class driver callback for the setting and retrieval of streaming interface properties. This callback must be implemented - * in the user application to handle property manipulations on streaming audio interfaces. - * - * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for - * the given entity and should return as fast as possible. When non-NULL, this value may be altered for GET operations - * to indicate the size of the retrieved data. - * - * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value - * of the \c DataLength parameter. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Property Property of the interface to get or set, a value from \ref Audio_ClassRequests_t. - * \param[in] EntityAddress Address of the audio entity whose property is being referenced. - * \param[in] Parameter Parameter of the entity to get or set, specific to each type of entity (see USB Audio specification). - * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum - * length of the retrieved data. When NULL, the function should return whether the given property - * and parameter is valid for the requested endpoint without reading or modifying the Data buffer. - * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where - * the retrieved data is to be stored for GET operations. - * - * \return Boolean \c true if the property GET/SET was successful, \c false otherwise - */ - bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const uint8_t Property, - const uint8_t EntityAddress, - const uint16_t Parameter, - uint16_t* const DataLength, - uint8_t* Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Audio class driver event for an Audio Stream start/stop change. This event fires each time the device receives a stream enable or - * disable control request from the host, to start and stop the audio stream. The current state of the stream can be determined by the - * State.InterfaceEnabled value inside the Audio interface structure passed as a parameter. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - */ - void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); - - /* Inline Functions: */ - /** General management task for a given Audio class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - */ - static inline void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - { - (void)AudioInterfaceInfo; - } - - /** Determines if the given audio interface is ready for a sample to be read from it, and selects the streaming - * OUT endpoint ready for reading. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Boolean \c true if the given Audio interface has a sample to be read, \c false otherwise. - */ - static inline bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - { - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled)) - return false; - - Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpoint.Address); - return Endpoint_IsOUTReceived(); - } - - /** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects - * the streaming IN endpoint ready for writing. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Boolean \c true if the given Audio interface is ready to accept the next sample, \c false otherwise. - */ - static inline bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - { - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled)) - return false; - - Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpoint.Address); - return Endpoint_IsINReady(); - } - - /** Reads the next 8-bit audio sample from the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure - * that the correct endpoint is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Signed 8-bit audio sample from the audio interface. - */ - static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - { - int8_t Sample; - - (void)AudioInterfaceInfo; - - Sample = Endpoint_Read_8(); - - if (!(Endpoint_BytesInEndpoint())) - Endpoint_ClearOUT(); - - return Sample; - } - - /** Reads the next 16-bit audio sample from the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure - * that the correct endpoint is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Signed 16-bit audio sample from the audio interface. - */ - static inline int16_t Audio_Device_ReadSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline int16_t Audio_Device_ReadSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - { - int16_t Sample; - - (void)AudioInterfaceInfo; - - Sample = (int16_t)Endpoint_Read_16_LE(); - - if (!(Endpoint_BytesInEndpoint())) - Endpoint_ClearOUT(); - - return Sample; - } - - /** Reads the next 24-bit audio sample from the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure - * that the correct endpoint is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Signed 24-bit audio sample from the audio interface. - */ - static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - { - int32_t Sample; - - (void)AudioInterfaceInfo; - - Sample = (((uint32_t)Endpoint_Read_8() << 16) | Endpoint_Read_16_LE()); - - if (!(Endpoint_BytesInEndpoint())) - Endpoint_ClearOUT(); - - return Sample; - } - - /** Writes the next 8-bit audio sample to the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to - * ensure that the correct endpoint is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Sample Signed 8-bit audio sample. - */ - static inline void Audio_Device_WriteSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const int8_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Device_WriteSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const int8_t Sample) - { - Endpoint_Write_8(Sample); - - if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size) - Endpoint_ClearIN(); - } - - /** Writes the next 16-bit audio sample to the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to - * ensure that the correct endpoint is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Sample Signed 16-bit audio sample. - */ - static inline void Audio_Device_WriteSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const int16_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Device_WriteSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const int16_t Sample) - { - Endpoint_Write_16_LE(Sample); - - if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size) - Endpoint_ClearIN(); - } - - /** Writes the next 24-bit audio sample to the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to - * ensure that the correct endpoint is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Sample Signed 24-bit audio sample. - */ - static inline void Audio_Device_WriteSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const int32_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Device_WriteSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, - const int32_t Sample) - { - Endpoint_Write_16_LE(Sample); - Endpoint_Write_8(Sample >> 16); - - if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size) - Endpoint_ClearIN(); - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_AUDIO_DEVICE_C) - void Audio_Device_Event_Stub(void) ATTR_CONST; - - void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) - ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(Audio_Device_Event_Stub); - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c deleted file mode 100644 index e77aa280be..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_CDC_DRIVER -#define __INCLUDE_FROM_CDC_DEVICE_C -#include "CDCClassDevice.h" - -void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - if (!(Endpoint_IsSETUPReceived())) - return; - - if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber) - return; - - switch (USB_ControlRequest.bRequest) - { - case CDC_REQ_GetLineEncoding: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - - while (!(Endpoint_IsINReady())); - - Endpoint_Write_32_LE(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); - Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.CharFormat); - Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.ParityType); - Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.DataBits); - - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); - } - - break; - case CDC_REQ_SetLineEncoding: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - - while (!(Endpoint_IsOUTReceived())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE(); - CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8(); - CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8(); - CDCInterfaceInfo->State.LineEncoding.DataBits = Endpoint_Read_8(); - - Endpoint_ClearOUT(); - Endpoint_ClearStatusStage(); - - EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); - } - - break; - case CDC_REQ_SetControlLineState: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue; - - EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo); - } - - break; - case CDC_REQ_SendBreak: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue); - } - - break; - } -} - -bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State)); - - CDCInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; - CDCInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; - CDCInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT; - - if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataINEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataOUTEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.NotificationEndpoint, 1))) - return false; - - return true; -} - -void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return; - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - CDC_Device_Flush(CDCInterfaceInfo); - #endif -} - -uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const char* const String) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return ENDPOINT_RWSTREAM_DeviceDisconnected; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); - return Endpoint_Write_Stream_LE(String, strlen(String), NULL); -} - -uint8_t CDC_Device_SendData(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const char* const Buffer, - const uint16_t Length) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return ENDPOINT_RWSTREAM_DeviceDisconnected; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); - return Endpoint_Write_Stream_LE(Buffer, Length, NULL); -} - -uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const uint8_t Data) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return ENDPOINT_RWSTREAM_DeviceDisconnected; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); - - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - uint8_t ErrorCode; - - if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) - return ErrorCode; - } - - Endpoint_Write_8(Data); - return ENDPOINT_READYWAIT_NoError; -} - -uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return ENDPOINT_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); - - if (!(Endpoint_BytesInEndpoint())) - return ENDPOINT_READYWAIT_NoError; - - bool BankFull = !(Endpoint_IsReadWriteAllowed()); - - Endpoint_ClearIN(); - - if (BankFull) - { - if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) - return ErrorCode; - - Endpoint_ClearIN(); - } - - return ENDPOINT_READYWAIT_NoError; -} - -uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return 0; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address); - - if (Endpoint_IsOUTReceived()) - { - if (!(Endpoint_BytesInEndpoint())) - { - Endpoint_ClearOUT(); - return 0; - } - else - { - return Endpoint_BytesInEndpoint(); - } - } - else - { - return 0; - } -} - -int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return -1; - - int16_t ReceivedByte = -1; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address); - - if (Endpoint_IsOUTReceived()) - { - if (Endpoint_BytesInEndpoint()) - ReceivedByte = Endpoint_Read_8(); - - if (!(Endpoint_BytesInEndpoint())) - Endpoint_ClearOUT(); - } - - return ReceivedByte; -} - -void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) - return; - - Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpoint.Address); - - USB_Request_Header_t Notification = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = CDC_NOTIF_SerialState, - .wValue = CPU_TO_LE16(0), - .wIndex = CPU_TO_LE16(0), - .wLength = CPU_TO_LE16(sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost)), - }; - - Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL); - Endpoint_Write_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost, - sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost), - NULL); - Endpoint_ClearIN(); -} - -#if defined(FDEV_SETUP_STREAM) -void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar, _FDEV_SETUP_RW); - fdev_set_udata(Stream, CDCInterfaceInfo); -} - -void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar_Blocking, _FDEV_SETUP_RW); - fdev_set_udata(Stream, CDCInterfaceInfo); -} - -static int CDC_Device_putchar(char c, - FILE* Stream) -{ - return CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; -} - -static int CDC_Device_getchar(FILE* Stream) -{ - int16_t ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream)); - - if (ReceivedByte < 0) - return _FDEV_EOF; - - return ReceivedByte; -} - -static int CDC_Device_getchar_Blocking(FILE* Stream) -{ - int16_t ReceivedByte; - - while ((ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))) < 0) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return _FDEV_EOF; - - CDC_Device_USBTask((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream)); - USB_USBTask(); - } - - return ReceivedByte; -} -#endif - -// cppcheck-suppress unusedFunction -void CDC_Device_Event_Stub(void) -{ - -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h deleted file mode 100644 index a4528d1ddd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Device mode driver for the library USB CDC Class driver. - * - * Device mode driver for the library USB CDC Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassCDC - * \defgroup Group_USBClassCDCDevice CDC Class Device Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/CDCClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Device Mode USB Class driver framework interface, for the CDC USB Class driver. - * - * \note There are several major drawbacks to the CDC-ACM standard USB class, however - * it is very standardized and thus usually available as a built-in driver on - * most platforms, and so is a better choice than a proprietary serial class. - * - * One major issue with CDC-ACM is that it requires two Interface descriptors, - * which will upset most hosts when part of a multi-function "Composite" USB - * device. This is because each interface will be loaded into a separate driver - * instance, causing the two interfaces be become unlinked. To prevent this, you - * should use the "Interface Association Descriptor" addendum to the USB 2.0 standard - * which is available on most OSes when creating Composite devices. - * - * Another major oversight is that there is no mechanism for the host to notify the - * device that there is a data sink on the host side ready to accept data. This - * means that the device may try to send data while the host isn't listening, causing - * lengthy blocking timeouts in the transmission routines. It is thus highly recommended - * that the virtual serial line DTR (Data Terminal Ready) signal be used where possible - * to determine if a host application is ready for data. - * - * @{ - */ - -#ifndef _CDC_CLASS_DEVICE_H_ -#define _CDC_CLASS_DEVICE_H_ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/CDCClassCommon.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_CDC_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief CDC Class Device Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made for each CDC interface - * within the user application, and passed to each of the CDC class driver functions as the - * CDCInterfaceInfo parameter. This stores each CDC interface's configuration and state information. - */ - typedef struct - { - struct - { - uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */ - - USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ - USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ - USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - struct - { - uint16_t HostToDevice; /**< Control line states from the host to device, as a set of \c CDC_CONTROL_LINE_OUT_* - * masks. This value is updated each time \ref CDC_Device_USBTask() is called. - */ - uint16_t DeviceToHost; /**< Control line states from the device to host, as a set of \c CDC_CONTROL_LINE_IN_* - * masks - to notify the host of changes to these values, call the - * \ref CDC_Device_SendControlLineStateChange() function. - */ - } ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and host. */ - - CDC_LineEncoding_t LineEncoding; /** Line encoding used in the virtual serial port, for the device's information. - * This is generally only used if the virtual serial port data is to be - * reconstructed on a physical UART. - */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * are reset to their defaults when the interface is enumerated. - */ - } USB_ClassInfo_CDC_Device_t; - - /* Function Prototypes: */ - /** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library - * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing - * the given CDC interface is selected. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * - * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. - */ - bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Processes incoming control requests from the host, that are directed to the given CDC class interface. This should be - * linked to the library \ref EVENT_USB_Device_ControlRequest() event. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - */ - void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** General management task for a given CDC class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - */ - void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** CDC class driver event for a line encoding change on a CDC interface. This event fires each time the host requests a - * line encoding change (containing the serial parity, baud and other configuration information) and may be hooked in the - * user program by declaring a handler function with the same name and parameters listed here. The new line encoding - * settings are available in the LineEncoding structure inside the CDC interface structure passed as a parameter. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - */ - void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** CDC class driver event for a control line state change on a CDC interface. This event fires each time the host requests a - * control line state change (containing the virtual serial control line states, such as DTR) and may be hooked in the - * user program by declaring a handler function with the same name and parameters listed here. The new control line states - * are available in the \c ControlLineStates.HostToDevice value inside the CDC interface structure passed as a parameter, set as - * a mask of \c CDC_CONTROL_LINE_OUT_* masks. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - */ - void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** CDC class driver event for a send break request sent to the device from the host. This is generally used to separate - * data or to indicate a special condition to the receiving device. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in] Duration Duration of the break that has been sent by the host, in milliseconds. - */ - void EVENT_CDC_Device_BreakSent(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a given data buffer to the attached USB host, if connected. If a host is not connected when the function is - * called, the string is discarded. Bytes will be queued for transmission to the host until either the endpoint bank - * becomes full, or the \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows - * for multiple bytes to be packed into a single endpoint packet, increasing data throughput. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in] Buffer Pointer to a buffer containing the data to send to the device. - * \param[in] Length Length of the data to send to the host. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t CDC_Device_SendData(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const char* const Buffer, - const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given null terminated string to the attached USB host, if connected. If a host is not connected when - * the function is called, the string is discarded. Bytes will be queued for transmission to the host until either - * the endpoint bank becomes full, or the \ref CDC_Device_Flush() function is called to flush the pending data to - * the host. This allows for multiple bytes to be packed into a single endpoint packet, increasing data throughput. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in] String Pointer to the null terminated string to send to the host. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the - * byte is discarded. Bytes will be queued for transmission to the host until either the endpoint bank becomes full, or the - * \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be - * packed into a single endpoint packet, increasing data throughput. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in] Data Byte of data to send to the host. - * - * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Determines the number of bytes received by the CDC interface from the host, waiting to be read. This indicates the number - * of bytes in the OUT endpoint bank only, and thus the number of calls to \ref CDC_Device_ReceiveByte() which are guaranteed to - * succeed immediately. If multiple bytes are to be received, they should be buffered by the user application, as the endpoint - * bank will not be released back to the USB controller until all bytes are read. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * - * \return Total number of buffered bytes received from the host. - */ - uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function - * returns a negative value. The \ref CDC_Device_BytesReceived() function may be queried in advance to determine how many - * bytes are currently buffered in the CDC interface's data receive endpoint bank, and thus how many repeated calls to this - * function which are guaranteed to succeed. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * - * \return Next received byte from the host, or a negative value if no data received. - */ - int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * - * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial - * control lines (DCD, DSR, etc.) have changed states, or to give BREAK notifications to the host. Line states persist - * until they are cleared via a second notification. This should be called each time the CDC class driver's - * \c ControlLineStates.DeviceToHost value is updated to push the new states to the USB host. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or - * the call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - */ - void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - #if defined(FDEV_SETUP_STREAM) || defined(__DOXYGEN__) - /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular - * functions in the standard library that accept a \c FILE stream as a destination (e.g. \c fprintf()). The created - * stream is bidirectional and can be used for both input and output functions. - * - * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single - * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own - * line buffering. - * - * \note The created stream can be given as \c stdout if desired to direct the standard output from all functions - * to the given CDC interface. - * \n\n - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Identical to \ref CDC_Device_CreateStream(), except that reads are blocking until the calling stream function terminates - * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_CDC_DEVICE_C) - #if defined(FDEV_SETUP_STREAM) - static int CDC_Device_putchar(char c, - FILE* Stream) ATTR_NON_NULL_PTR_ARG(2); - static int CDC_Device_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - static int CDC_Device_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - #endif - - void CDC_Device_Event_Stub(void) ATTR_CONST; - - void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) - ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Device_Event_Stub); - void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) - ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Device_Event_Stub); - void EVENT_CDC_Device_BreakSent(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, - const uint8_t Duration) ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) - ATTR_ALIAS(CDC_Device_Event_Stub); - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c deleted file mode 100644 index a56747b084..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_HID_DRIVER -#define __INCLUDE_FROM_HID_DEVICE_C -#include "HIDClassDevice.h" - -void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) -{ - if (!(Endpoint_IsSETUPReceived())) - return; - - if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber) - return; - - switch (USB_ControlRequest.bRequest) - { - case HID_REQ_GetReport: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - uint16_t ReportSize = 0; - uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); - uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; - uint8_t ReportData[HIDInterfaceInfo->Config.PrevReportINBufferSize]; - - memset(ReportData, 0, sizeof(ReportData)); - - CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize); - - if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL) - { - memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, - HIDInterfaceInfo->Config.PrevReportINBufferSize); - } - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - - Endpoint_ClearSETUP(); - Endpoint_Write_Control_Stream_LE(ReportData, ReportSize); - Endpoint_ClearOUT(); - } - - break; - case HID_REQ_SetReport: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - uint16_t ReportSize = USB_ControlRequest.wLength; - uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); - uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; - uint8_t ReportData[ReportSize]; - - Endpoint_ClearSETUP(); - Endpoint_Read_Control_Stream_LE(ReportData, ReportSize); - Endpoint_ClearIN(); - - CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, - &ReportData[ReportID ? 1 : 0], ReportSize - (ReportID ? 1 : 0)); - } - - break; - case HID_REQ_GetProtocol: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - while (!(Endpoint_IsINReady())); - Endpoint_Write_8(HIDInterfaceInfo->State.UsingReportProtocol); - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); - } - - break; - case HID_REQ_SetProtocol: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00); - } - - break; - case HID_REQ_SetIdle: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6); - } - - break; - case HID_REQ_GetIdle: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - while (!(Endpoint_IsINReady())); - Endpoint_Write_8(HIDInterfaceInfo->State.IdleCount >> 2); - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); - } - - break; - } -} - -bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) -{ - memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State)); - HIDInterfaceInfo->State.UsingReportProtocol = true; - HIDInterfaceInfo->State.IdleCount = 500; - - HIDInterfaceInfo->Config.ReportINEndpoint.Type = EP_TYPE_INTERRUPT; - - if (!(Endpoint_ConfigureEndpointTable(&HIDInterfaceInfo->Config.ReportINEndpoint, 1))) - return false; - - return true; -} - -void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber()) - return; - - Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address); - - if (Endpoint_IsReadWriteAllowed()) - { - uint8_t ReportINData[HIDInterfaceInfo->Config.PrevReportINBufferSize]; - uint8_t ReportID = 0; - uint16_t ReportINSize = 0; - - memset(ReportINData, 0, sizeof(ReportINData)); - - bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, HID_REPORT_ITEM_In, - ReportINData, &ReportINSize); - bool StatesChanged = false; - bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining)); - - if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL) - { - StatesChanged = (memcmp(ReportINData, HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINSize) != 0); - memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINData, HIDInterfaceInfo->Config.PrevReportINBufferSize); - } - - if (ReportINSize && (ForceSend || StatesChanged || IdlePeriodElapsed)) - { - HIDInterfaceInfo->State.IdleMSRemaining = HIDInterfaceInfo->State.IdleCount; - - Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address); - - if (ReportID) - Endpoint_Write_8(ReportID); - - Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NULL); - - Endpoint_ClearIN(); - } - - HIDInterfaceInfo->State.PrevFrameNum = USB_Device_GetFrameNumber(); - } -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h deleted file mode 100644 index ea21257722..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Device mode driver for the library USB HID Class driver. - * - * Device mode driver for the library USB HID Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassHID - * \defgroup Group_USBClassHIDDevice HID Class Device Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/HIDClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Device Mode USB Class driver framework interface, for the HID USB Class driver. - * - * @{ - */ - -#ifndef _HID_CLASS_DEVICE_H_ -#define _HID_CLASS_DEVICE_H_ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/HIDClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_HID_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief HID Class Device Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made for each HID interface - * within the user application, and passed to each of the HID class driver functions as the - * \c HIDInterfaceInfo parameter. This stores each HID interface's configuration and state information. - * - * \note Due to technical limitations, the HID device class driver does not utilize a separate OUT - * endpoint for host->device communications. Instead, the host->device data (if any) is sent to - * the device via the control endpoint. - */ - typedef struct - { - struct - { - uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */ - - USB_Endpoint_Table_t ReportINEndpoint; /**< Data IN HID report endpoint configuration table. */ - - void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be - * stored by the driver, for comparison purposes to detect report changes that - * must be sent immediately to the host. This should point to a buffer big enough - * to hold the largest HID input report sent from the HID interface. If this is set - * to \c NULL, it is up to the user to force transfers when needed in the - * \ref CALLBACK_HID_Device_CreateHIDReport() callback function. - * - * \note Due to the single buffer, the internal driver can only correctly compare - * subsequent reports with identical report IDs. In multiple report devices, - * this buffer should be set to \c NULL and the decision to send reports made - * by the user application instead. - */ - uint8_t PrevReportINBufferSize; /**< Size in bytes of the given input report buffer. This is used to create a - * second buffer of the same size within the driver so that subsequent reports - * can be compared. If the user app is to determine when reports are to be sent - * exclusively (i.e. \ref PrevReportINBuffer is \c NULL) this value must still be - * set to the size of the largest report the device can issue to the host. - */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode. */ - uint16_t PrevFrameNum; /**< Frame number of the previous HID report packet opportunity. */ - uint16_t IdleCount; /**< Report idle period, in milliseconds, set by the host. */ - uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this - * should be decremented by the user application if non-zero each millisecond. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * are reset to their defaults when the interface is enumerated. - */ - } USB_ClassInfo_HID_Device_t; - - /* Function Prototypes: */ - /** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library - * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration - * containing the given HID interface is selected. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. - * - * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. - */ - bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Processes incoming control requests from the host, that are directed to the given HID class interface. This should be - * linked to the library \ref EVENT_USB_Device_ControlRequest() event. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. - */ - void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** General management task for a given HID class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. - */ - void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** HID class driver callback for the user creation of a HID IN report. This callback may fire in response to either - * HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the - * user is responsible for the creation of the next HID input report to be sent to the host. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. - * \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, - * this should be set to the report ID of the generated HID input report (if any). If multiple - * reports are not sent via the given HID interface, this parameter should be ignored. - * \param[in] ReportType Type of HID report to generate, either \ref HID_REPORT_ITEM_In or \ref HID_REPORT_ITEM_Feature. - * \param[out] ReportData Pointer to a buffer where the generated HID report should be stored. - * \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent. - * - * \return Boolean \c true to force the sending of the report even if it is identical to the previous report and still within - * the idle period (useful for devices which report relative movement), \c false otherwise. - */ - bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, - uint8_t* const ReportID, - const uint8_t ReportType, - void* ReportData, - uint16_t* const ReportSize) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(4) ATTR_NON_NULL_PTR_ARG(5); - - /** HID class driver callback for the user processing of a received HID OUT report. This callback may fire in response to - * either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback - * the user is responsible for the processing of the received HID output report from the host. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. - * \param[in] ReportID Report ID of the received output report. If multiple reports are not received via the given HID - * interface, this parameter should be ignored. - * \param[in] ReportType Type of received HID report, either \ref HID_REPORT_ITEM_Out or \ref HID_REPORT_ITEM_Feature. - * \param[in] ReportData Pointer to a buffer where the received HID report is stored. - * \param[in] ReportSize Size in bytes of the received report from the host. - */ - void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, - const uint8_t ReportID, - const uint8_t ReportType, - const void* ReportData, - const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4); - - /* Inline Functions: */ - /** Indicates that a millisecond of idle time has elapsed on the given HID interface, and the interface's idle count should be - * decremented. This should be called once per millisecond so that hardware key-repeats function correctly. It is recommended - * that this be called by the \ref EVENT_USB_Device_StartOfFrame() event, once SOF events have been enabled via - * \ref USB_Device_EnableSOFEvents(). - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. - */ - static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1); - static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) - { - if (HIDInterfaceInfo->State.IdleMSRemaining) - HIDInterfaceInfo->State.IdleMSRemaining--; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c deleted file mode 100644 index 3ff339c06a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_MIDI_DRIVER -#define __INCLUDE_FROM_MIDI_DEVICE_C -#include "MIDIClassDevice.h" - -bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) -{ - memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State)); - - MIDIInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; - MIDIInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; - - if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataINEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataOUTEndpoint, 1))) - return false; - - return true; -} - -void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - MIDI_Device_Flush(MIDIInterfaceInfo); - #endif -} - -uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, - const MIDI_EventPacket_t* const Event) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return ENDPOINT_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); - - if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError) - return ErrorCode; - - if (!(Endpoint_IsReadWriteAllowed())) - Endpoint_ClearIN(); - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return ENDPOINT_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); - - if (Endpoint_BytesInEndpoint()) - { - Endpoint_ClearIN(); - - if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) - return ErrorCode; - } - - return ENDPOINT_READYWAIT_NoError; -} - -bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, - MIDI_EventPacket_t* const Event) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return false; - - Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpoint.Address); - - if (!(Endpoint_IsReadWriteAllowed())) - return false; - - Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL); - - if (!(Endpoint_IsReadWriteAllowed())) - Endpoint_ClearOUT(); - - return true; -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h deleted file mode 100644 index c5b01be5db..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Device mode driver for the library USB MIDI Class driver. - * - * Device mode driver for the library USB MIDI Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassMIDI - * \defgroup Group_USBClassMIDIDevice MIDI Class Device Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Device Mode USB Class driver framework interface, for the MIDI USB Class driver. - * - * @{ - */ - -#ifndef _MIDI_CLASS_DEVICE_H_ -#define _MIDI_CLASS_DEVICE_H_ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/MIDIClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_MIDI_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Define: */ - /** \brief MIDI Class Device Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made for each MIDI interface - * within the user application, and passed to each of the MIDI class driver functions as the - * \c MIDIInterfaceInfo parameter. This stores each MIDI interface's configuration and state information. - */ - typedef struct - { - struct - { - uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls. */ - - USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ - USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - - struct - { - uint8_t RESERVED; // No state information for this class - } State; /**< State data for the USB class interface within the device. All elements in this section - * are reset to their defaults when the interface is enumerated. - */ - } USB_ClassInfo_MIDI_Device_t; - - /* Function Prototypes: */ - /** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library - * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration - * containing the given MIDI interface is selected. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * - * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. - */ - bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** General management task for a given MIDI class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - */ - void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded. Events are queued into the - * endpoint bank until either the endpoint bank is full, or \ref MIDI_Device_Flush() is called. This allows for multiple - * MIDI events to be packed into a single endpoint packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * \param[in] Event Pointer to a populated \ref MIDI_EventPacket_t structure containing the MIDI event to send. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, - const MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - - /** Flushes the MIDI send buffer, sending any queued MIDI events to the host. This should be called to override the - * \ref MIDI_Device_SendEventPacket() function's packing behavior, to flush queued events. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * - * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Receives a MIDI event packet from the host. Events are unpacked from the endpoint, thus if the endpoint bank contains - * multiple MIDI events from the host in the one packet, multiple calls to this function will return each individual event. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed. - * - * \return Boolean \c true if a MIDI event packet was received, \c false otherwise. - */ - bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, - MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /* Inline Functions: */ - /** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be - * linked to the library \ref EVENT_USB_Device_ControlRequest() event. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - */ - static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) - { - (void)MIDIInterfaceInfo; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c deleted file mode 100644 index 735437e461..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_MS_DRIVER -#define __INCLUDE_FROM_MASSSTORAGE_DEVICE_C -#include "MassStorageClassDevice.h" - -void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) -{ - if (!(Endpoint_IsSETUPReceived())) - return; - - if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber) - return; - - switch (USB_ControlRequest.bRequest) - { - case MS_REQ_MassStorageReset: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - MSInterfaceInfo->State.IsMassStoreReset = true; - } - - break; - case MS_REQ_GetMaxLUN: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - while (!(Endpoint_IsINReady())); - Endpoint_Write_8(MSInterfaceInfo->Config.TotalLUNs - 1); - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); - } - - break; - } -} - -bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) -{ - memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State)); - - MSInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; - MSInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; - - if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataINEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataOUTEndpoint, 1))) - return false; - - return true; -} - -void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); - - if (Endpoint_IsOUTReceived()) - { - if (MS_Device_ReadInCommandBlock(MSInterfaceInfo)) - { - if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN) - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); - - bool SCSICommandResult = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo); - - MSInterfaceInfo->State.CommandStatus.Status = (SCSICommandResult) ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail; - MSInterfaceInfo->State.CommandStatus.Signature = CPU_TO_LE32(MS_CSW_SIGNATURE); - MSInterfaceInfo->State.CommandStatus.Tag = MSInterfaceInfo->State.CommandBlock.Tag; - MSInterfaceInfo->State.CommandStatus.DataTransferResidue = MSInterfaceInfo->State.CommandBlock.DataTransferLength; - - if (!(SCSICommandResult) && (le32_to_cpu(MSInterfaceInfo->State.CommandStatus.DataTransferResidue))) - Endpoint_StallTransaction(); - - MS_Device_ReturnCommandStatus(MSInterfaceInfo); - } - } - - if (MSInterfaceInfo->State.IsMassStoreReset) - { - Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); - Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); - - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); - Endpoint_ClearStall(); - Endpoint_ResetDataToggle(); - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); - Endpoint_ClearStall(); - Endpoint_ResetDataToggle(); - - MSInterfaceInfo->State.IsMassStoreReset = false; - } -} - -static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) -{ - uint16_t BytesProcessed; - - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); - - BytesProcessed = 0; - while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock, - (sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) == - ENDPOINT_RWSTREAM_IncompleteTransfer) - { - if (MSInterfaceInfo->State.IsMassStoreReset) - return false; - } - - if ((MSInterfaceInfo->State.CommandBlock.Signature != CPU_TO_LE32(MS_CBW_SIGNATURE)) || - (MSInterfaceInfo->State.CommandBlock.LUN >= MSInterfaceInfo->Config.TotalLUNs) || - (MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) || - (MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0) || - (MSInterfaceInfo->State.CommandBlock.SCSICommandLength > 16)) - { - Endpoint_StallTransaction(); - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); - Endpoint_StallTransaction(); - - return false; - } - - BytesProcessed = 0; - while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock.SCSICommandData, - MSInterfaceInfo->State.CommandBlock.SCSICommandLength, &BytesProcessed) == - ENDPOINT_RWSTREAM_IncompleteTransfer) - { - if (MSInterfaceInfo->State.IsMassStoreReset) - return false; - } - - Endpoint_ClearOUT(); - - return true; -} - -static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) -{ - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); - - while (Endpoint_IsStalled()) - { - #if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); - #endif - - if (MSInterfaceInfo->State.IsMassStoreReset) - return; - } - - Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); - - while (Endpoint_IsStalled()) - { - #if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); - #endif - - if (MSInterfaceInfo->State.IsMassStoreReset) - return; - } - - uint16_t BytesProcessed = 0; - while (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, - sizeof(MS_CommandStatusWrapper_t), &BytesProcessed) == - ENDPOINT_RWSTREAM_IncompleteTransfer) - { - if (MSInterfaceInfo->State.IsMassStoreReset) - return; - } - - Endpoint_ClearIN(); -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h deleted file mode 100644 index b9bc832e1f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Device mode driver for the library USB Mass Storage Class driver. - * - * Device mode driver for the library USB Mass Storage Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassMS - * \defgroup Group_USBClassMSDevice Mass Storage Class Device Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Device Mode USB Class driver framework interface, for the Mass Storage USB Class driver. - * - * @{ - */ - -#ifndef _MS_CLASS_DEVICE_H_ -#define _MS_CLASS_DEVICE_H_ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/MassStorageClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_MS_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief Mass Storage Class Device Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made for each Mass Storage interface - * within the user application, and passed to each of the Mass Storage class driver functions as the - * \c MSInterfaceInfo parameter. This stores each Mass Storage interface's configuration and state information. - */ - typedef struct - { - struct - { - uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device. */ - - USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ - USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ - - uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - MS_CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI - * command from the host which is to be processed. - */ - MS_CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate - * the issued command's success or failure to the host. - */ - volatile bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset - * and that all current Mass Storage operations should immediately abort. - */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * are reset to their defaults when the interface is enumerated. - */ - } USB_ClassInfo_MS_Device_t; - - /* Function Prototypes: */ - /** Configures the endpoints of a given Mass Storage interface, ready for use. This should be linked to the library - * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration - * containing the given Mass Storage interface is selected. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. - * - * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. - */ - bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Processes incoming control requests from the host, that are directed to the given Mass Storage class interface. This should be - * linked to the library \ref EVENT_USB_Device_ControlRequest() event. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. - */ - void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage configuration and state. - */ - void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Mass Storage class driver callback for the user processing of a received SCSI command. This callback will fire each time the - * host sends a SCSI command which requires processing by the user application. Inside this callback the user is responsible - * for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure - * inside the Mass Storage class state structure passed as a parameter to the callback function. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. - * - * \return Boolean \c true if the SCSI command was successfully processed, \c false otherwise. - */ - bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_MASSSTORAGE_DEVICE_C) - static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c deleted file mode 100644 index 80aa723c1a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_RNDIS_DRIVER -#define __INCLUDE_FROM_RNDIS_DEVICE_C -#include "RNDISClassDevice.h" - -static const uint32_t PROGMEM AdapterSupportedOIDList[] = - { - CPU_TO_LE32(OID_GEN_SUPPORTED_LIST), - CPU_TO_LE32(OID_GEN_PHYSICAL_MEDIUM), - CPU_TO_LE32(OID_GEN_HARDWARE_STATUS), - CPU_TO_LE32(OID_GEN_MEDIA_SUPPORTED), - CPU_TO_LE32(OID_GEN_MEDIA_IN_USE), - CPU_TO_LE32(OID_GEN_MAXIMUM_FRAME_SIZE), - CPU_TO_LE32(OID_GEN_MAXIMUM_TOTAL_SIZE), - CPU_TO_LE32(OID_GEN_LINK_SPEED), - CPU_TO_LE32(OID_GEN_TRANSMIT_BLOCK_SIZE), - CPU_TO_LE32(OID_GEN_RECEIVE_BLOCK_SIZE), - CPU_TO_LE32(OID_GEN_VENDOR_ID), - CPU_TO_LE32(OID_GEN_VENDOR_DESCRIPTION), - CPU_TO_LE32(OID_GEN_CURRENT_PACKET_FILTER), - CPU_TO_LE32(OID_GEN_MAXIMUM_TOTAL_SIZE), - CPU_TO_LE32(OID_GEN_MEDIA_CONNECT_STATUS), - CPU_TO_LE32(OID_GEN_XMIT_OK), - CPU_TO_LE32(OID_GEN_RCV_OK), - CPU_TO_LE32(OID_GEN_XMIT_ERROR), - CPU_TO_LE32(OID_GEN_RCV_ERROR), - CPU_TO_LE32(OID_GEN_RCV_NO_BUFFER), - CPU_TO_LE32(OID_802_3_PERMANENT_ADDRESS), - CPU_TO_LE32(OID_802_3_CURRENT_ADDRESS), - CPU_TO_LE32(OID_802_3_MULTICAST_LIST), - CPU_TO_LE32(OID_802_3_MAXIMUM_LIST_SIZE), - CPU_TO_LE32(OID_802_3_RCV_ERROR_ALIGNMENT), - CPU_TO_LE32(OID_802_3_XMIT_ONE_COLLISION), - CPU_TO_LE32(OID_802_3_XMIT_MORE_COLLISIONS), - }; - -void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) -{ - if (!(Endpoint_IsSETUPReceived())) - return; - - if (USB_ControlRequest.wIndex != RNDISInterfaceInfo->Config.ControlInterfaceNumber) - return; - - switch (USB_ControlRequest.bRequest) - { - case RNDIS_REQ_SendEncapsulatedCommand: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, USB_ControlRequest.wLength); - Endpoint_ClearIN(); - - RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo); - } - - break; - case RNDIS_REQ_GetEncapsulatedResponse: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - - if (!(MessageHeader->MessageLength)) - { - RNDISInterfaceInfo->State.RNDISMessageBuffer[0] = 0; - MessageHeader->MessageLength = CPU_TO_LE32(1); - } - - Endpoint_ClearSETUP(); - Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, le32_to_cpu(MessageHeader->MessageLength)); - Endpoint_ClearOUT(); - - MessageHeader->MessageLength = CPU_TO_LE32(0); - } - - break; - } -} - -bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) -{ - memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State)); - - RNDISInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; - RNDISInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; - RNDISInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT; - - if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataINEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataOUTEndpoint, 1))) - return false; - - if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.NotificationEndpoint, 1))) - return false; - - return true; -} - -void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) -{ - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpoint.Address); - - if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.ResponseReady) - { - USB_Request_Header_t Notification = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = RNDIS_NOTIF_ResponseAvailable, - .wValue = CPU_TO_LE16(0), - .wIndex = CPU_TO_LE16(0), - .wLength = CPU_TO_LE16(0), - }; - - Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL); - - Endpoint_ClearIN(); - - RNDISInterfaceInfo->State.ResponseReady = false; - } -} - -void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) -{ - /* Note: Only a single buffer is used for both the received message and its response to save SRAM. Because of - this, response bytes should be filled in order so that they do not clobber unread data in the buffer. */ - - RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - - switch (le32_to_cpu(MessageHeader->MessageType)) - { - case REMOTE_NDIS_INITIALIZE_MSG: - RNDISInterfaceInfo->State.ResponseReady = true; - - RNDIS_Initialize_Message_t* INITIALIZE_Message = - (RNDIS_Initialize_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - RNDIS_Initialize_Complete_t* INITIALIZE_Response = - (RNDIS_Initialize_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - - INITIALIZE_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_INITIALIZE_CMPLT); - INITIALIZE_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Initialize_Complete_t)); - INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId; - INITIALIZE_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); - - INITIALIZE_Response->MajorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MAJOR); - INITIALIZE_Response->MinorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MINOR); - INITIALIZE_Response->DeviceFlags = CPU_TO_LE32(REMOTE_NDIS_DF_CONNECTIONLESS); - INITIALIZE_Response->Medium = CPU_TO_LE32(REMOTE_NDIS_MEDIUM_802_3); - INITIALIZE_Response->MaxPacketsPerTransfer = CPU_TO_LE32(1); - INITIALIZE_Response->MaxTransferSize = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) + ETHERNET_FRAME_SIZE_MAX); - INITIALIZE_Response->PacketAlignmentFactor = CPU_TO_LE32(0); - INITIALIZE_Response->AFListOffset = CPU_TO_LE32(0); - INITIALIZE_Response->AFListSize = CPU_TO_LE32(0); - - RNDISInterfaceInfo->State.CurrRNDISState = RNDIS_Initialized; - break; - case REMOTE_NDIS_HALT_MSG: - RNDISInterfaceInfo->State.ResponseReady = false; - - MessageHeader->MessageLength = CPU_TO_LE32(0); - - RNDISInterfaceInfo->State.CurrRNDISState = RNDIS_Uninitialized; - break; - case REMOTE_NDIS_QUERY_MSG: - RNDISInterfaceInfo->State.ResponseReady = true; - - RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - uint32_t Query_Oid = CPU_TO_LE32(QUERY_Message->Oid); - - void* QueryData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + - le32_to_cpu(QUERY_Message->InformationBufferOffset)]; - void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)]; - uint16_t ResponseSize; - - QUERY_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_QUERY_CMPLT); - - if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, le32_to_cpu(QUERY_Message->InformationBufferLength), - ResponseData, &ResponseSize)) - { - QUERY_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); - QUERY_Response->MessageLength = cpu_to_le32(sizeof(RNDIS_Query_Complete_t) + ResponseSize); - - QUERY_Response->InformationBufferLength = CPU_TO_LE32(ResponseSize); - QUERY_Response->InformationBufferOffset = CPU_TO_LE32(sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t)); - } - else - { - QUERY_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_NOT_SUPPORTED); - QUERY_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Query_Complete_t)); - - QUERY_Response->InformationBufferLength = CPU_TO_LE32(0); - QUERY_Response->InformationBufferOffset = CPU_TO_LE32(0); - } - - break; - case REMOTE_NDIS_SET_MSG: - RNDISInterfaceInfo->State.ResponseReady = true; - - RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - uint32_t SET_Oid = le32_to_cpu(SET_Message->Oid); - - SET_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_SET_CMPLT); - SET_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Set_Complete_t)); - SET_Response->RequestId = SET_Message->RequestId; - - void* SetData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + - le32_to_cpu(SET_Message->InformationBufferOffset)]; - - SET_Response->Status = RNDIS_Device_ProcessNDISSet(RNDISInterfaceInfo, SET_Oid, SetData, - le32_to_cpu(SET_Message->InformationBufferLength)) ? - REMOTE_NDIS_STATUS_SUCCESS : REMOTE_NDIS_STATUS_NOT_SUPPORTED; - break; - case REMOTE_NDIS_RESET_MSG: - RNDISInterfaceInfo->State.ResponseReady = true; - - RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - - RESET_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_RESET_CMPLT); - RESET_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Reset_Complete_t)); - RESET_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); - RESET_Response->AddressingReset = CPU_TO_LE32(0); - - break; - case REMOTE_NDIS_KEEPALIVE_MSG: - RNDISInterfaceInfo->State.ResponseReady = true; - - RNDIS_KeepAlive_Message_t* KEEPALIVE_Message = - (RNDIS_KeepAlive_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - RNDIS_KeepAlive_Complete_t* KEEPALIVE_Response = - (RNDIS_KeepAlive_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; - - KEEPALIVE_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_KEEPALIVE_CMPLT); - KEEPALIVE_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_KeepAlive_Complete_t)); - KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId; - KEEPALIVE_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); - - break; - } -} - -static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - const uint32_t OId, - void* const QueryData, - const uint16_t QuerySize, - void* ResponseData, - uint16_t* const ResponseSize) -{ - (void)QueryData; - (void)QuerySize; - - switch (OId) - { - case OID_GEN_SUPPORTED_LIST: - *ResponseSize = sizeof(AdapterSupportedOIDList); - - memcpy_P(ResponseData, AdapterSupportedOIDList, sizeof(AdapterSupportedOIDList)); - - return true; - case OID_GEN_PHYSICAL_MEDIUM: - *ResponseSize = sizeof(uint32_t); - - /* Indicate that the device is a true ethernet link */ - *((uint32_t*)ResponseData) = CPU_TO_LE32(0); - - return true; - case OID_GEN_HARDWARE_STATUS: - *ResponseSize = sizeof(uint32_t); - - *((uint32_t*)ResponseData) = CPU_TO_LE32(NDIS_HardwareStatus_Ready); - - return true; - case OID_GEN_MEDIA_SUPPORTED: - case OID_GEN_MEDIA_IN_USE: - *ResponseSize = sizeof(uint32_t); - - *((uint32_t*)ResponseData) = CPU_TO_LE32(REMOTE_NDIS_MEDIUM_802_3); - - return true; - case OID_GEN_VENDOR_ID: - *ResponseSize = sizeof(uint32_t); - - /* Vendor ID 0x0xFFFFFF is reserved for vendors who have not purchased a NDIS VID */ - *((uint32_t*)ResponseData) = CPU_TO_LE32(0x00FFFFFF); - - return true; - case OID_GEN_MAXIMUM_FRAME_SIZE: - case OID_GEN_TRANSMIT_BLOCK_SIZE: - case OID_GEN_RECEIVE_BLOCK_SIZE: - *ResponseSize = sizeof(uint32_t); - - *((uint32_t*)ResponseData) = CPU_TO_LE32(ETHERNET_FRAME_SIZE_MAX); - - return true; - case OID_GEN_VENDOR_DESCRIPTION: - *ResponseSize = (strlen(RNDISInterfaceInfo->Config.AdapterVendorDescription) + 1); - - memcpy(ResponseData, RNDISInterfaceInfo->Config.AdapterVendorDescription, *ResponseSize); - - return true; - case OID_GEN_MEDIA_CONNECT_STATUS: - *ResponseSize = sizeof(uint32_t); - - *((uint32_t*)ResponseData) = CPU_TO_LE32(REMOTE_NDIS_MEDIA_STATE_CONNECTED); - - return true; - case OID_GEN_LINK_SPEED: - *ResponseSize = sizeof(uint32_t); - - /* Indicate 10Mb/s link speed */ - *((uint32_t*)ResponseData) = CPU_TO_LE32(100000); - - return true; - case OID_802_3_PERMANENT_ADDRESS: - case OID_802_3_CURRENT_ADDRESS: - *ResponseSize = sizeof(MAC_Address_t); - - memcpy(ResponseData, &RNDISInterfaceInfo->Config.AdapterMACAddress, sizeof(MAC_Address_t)); - - return true; - case OID_802_3_MAXIMUM_LIST_SIZE: - *ResponseSize = sizeof(uint32_t); - - /* Indicate only one multicast address supported */ - *((uint32_t*)ResponseData) = CPU_TO_LE32(1); - - return true; - case OID_GEN_CURRENT_PACKET_FILTER: - *ResponseSize = sizeof(uint32_t); - - *((uint32_t*)ResponseData) = cpu_to_le32(RNDISInterfaceInfo->State.CurrPacketFilter); - - return true; - case OID_GEN_XMIT_OK: - case OID_GEN_RCV_OK: - case OID_GEN_XMIT_ERROR: - case OID_GEN_RCV_ERROR: - case OID_GEN_RCV_NO_BUFFER: - case OID_802_3_RCV_ERROR_ALIGNMENT: - case OID_802_3_XMIT_ONE_COLLISION: - case OID_802_3_XMIT_MORE_COLLISIONS: - *ResponseSize = sizeof(uint32_t); - - /* Unused statistic OIDs - always return 0 for each */ - *((uint32_t*)ResponseData) = CPU_TO_LE32(0); - - return true; - case OID_GEN_MAXIMUM_TOTAL_SIZE: - *ResponseSize = sizeof(uint32_t); - - /* Indicate maximum overall buffer (Ethernet frame and RNDIS header) the adapter can handle */ - *((uint32_t*)ResponseData) = CPU_TO_LE32(RNDIS_MESSAGE_BUFFER_SIZE + ETHERNET_FRAME_SIZE_MAX); - - return true; - default: - return false; - } -} - -static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - const uint32_t OId, - const void* SetData, - const uint16_t SetSize) -{ - (void)SetSize; - - switch (OId) - { - case OID_GEN_CURRENT_PACKET_FILTER: - RNDISInterfaceInfo->State.CurrPacketFilter = le32_to_cpu(*((uint32_t*)SetData)); - RNDISInterfaceInfo->State.CurrRNDISState = (RNDISInterfaceInfo->State.CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_Initialized; - - return true; - case OID_802_3_MULTICAST_LIST: - /* Do nothing - throw away the value from the host as it is unused */ - - return true; - default: - return false; - } -} - -bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || - (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized)) - { - return false; - } - - Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address); - return Endpoint_IsOUTReceived(); -} - -uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - void* Buffer, - uint16_t* const PacketLength) -{ - if ((USB_DeviceState != DEVICE_STATE_Configured) || - (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized)) - { - return ENDPOINT_RWSTREAM_DeviceDisconnected; - } - - Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address); - - *PacketLength = 0; - - if (!(Endpoint_IsOUTReceived())) - return ENDPOINT_RWSTREAM_NoError; - - RNDIS_Packet_Message_t RNDISPacketHeader; - Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL); - - if (le32_to_cpu(RNDISPacketHeader.DataLength) > ETHERNET_FRAME_SIZE_MAX) - { - Endpoint_StallTransaction(); - - return RNDIS_ERROR_LOGICAL_CMD_FAILED; - } - - *PacketLength = (uint16_t)le32_to_cpu(RNDISPacketHeader.DataLength); - - Endpoint_Read_Stream_LE(Buffer, *PacketLength, NULL); - Endpoint_ClearOUT(); - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t PacketLength) -{ - uint8_t ErrorCode; - - if ((USB_DeviceState != DEVICE_STATE_Configured) || - (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized)) - { - return ENDPOINT_RWSTREAM_DeviceDisconnected; - } - - Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpoint.Address); - - if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) - return ErrorCode; - - RNDIS_Packet_Message_t RNDISPacketHeader; - - memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t)); - - RNDISPacketHeader.MessageType = CPU_TO_LE32(REMOTE_NDIS_PACKET_MSG); - RNDISPacketHeader.MessageLength = cpu_to_le32(sizeof(RNDIS_Packet_Message_t) + PacketLength); - RNDISPacketHeader.DataOffset = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)); - RNDISPacketHeader.DataLength = cpu_to_le32(PacketLength); - - Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL); - Endpoint_Write_Stream_LE(Buffer, PacketLength, NULL); - Endpoint_ClearIN(); - - return ENDPOINT_RWSTREAM_NoError; -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h deleted file mode 100644 index 4d1a4cff8b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Device mode driver for the library USB RNDIS Class driver. - * - * Device mode driver for the library USB RNDIS Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassRNDIS - * \defgroup Group_USBClassRNDISDevice RNDIS Class Device Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Device Mode USB Class driver framework interface, for the RNDIS USB Class driver. - * - * @{ - */ - -#ifndef _RNDIS_CLASS_DEVICE_H_ -#define _RNDIS_CLASS_DEVICE_H_ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/RNDISClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief RNDIS Class Device Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made for each RNDIS interface - * within the user application, and passed to each of the RNDIS class driver functions as the - * \c RNDISInterfaceInfo parameter. This stores each RNDIS interface's configuration and state information. - */ - typedef struct - { - struct - { - uint8_t ControlInterfaceNumber; /**< Interface number of the RNDIS control interface within the device. */ - - USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ - USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ - USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */ - - char* AdapterVendorDescription; /**< String description of the adapter vendor. */ - MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host, - * managed by the class driver. - */ - bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host. */ - uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the \ref RNDIS_States_t enum. */ - uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * are reset to their defaults when the interface is enumerated. - */ - } USB_ClassInfo_RNDIS_Device_t; - - /* Function Prototypes: */ - /** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library - * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration - * containing the given RNDIS interface is selected. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. - * - * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. - */ - bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Processes incoming control requests from the host, that are directed to the given RNDIS class interface. This should be - * linked to the library \ref EVENT_USB_Device_ControlRequest() event. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. - */ - void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** General management task for a given RNDIS class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. - */ - void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Determines if a packet is currently waiting for the device to read in and process. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or the - * call will fail. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class configuration and state. - * - * \return Boolean \c true if a packet is waiting to be read in by the host, \c false otherwise. - */ - bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); - - /** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave - * only the packet contents for processing by the device in the nominated buffer. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or the - * call will fail. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class configuration and state. - * \param[out] Buffer Pointer to a buffer where the packer data is to be written to. - * \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - void* Buffer, - uint16_t* const PacketLength); - - /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header. - * - * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or the - * call will fail. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class configuration and state. - * \param[in] Buffer Pointer to a buffer where the packer data is to be read from. - * \param[in] PacketLength Length in bytes of the packet to send. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t PacketLength); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_RNDIS_DEVICE_C) - static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1); - static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - const uint32_t OId, - void* const QueryData, - const uint16_t QuerySize, - void* ResponseData, - uint16_t* const ResponseSize) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(5) ATTR_NON_NULL_PTR_ARG(6); - static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, - const uint32_t OId, - const void* SetData, - const uint16_t SetSize) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(3); - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h deleted file mode 100644 index 288559c757..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB HID Class driver. - * - * Master include file for the library USB HID Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassHID HID Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/HIDClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/HIDClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/HIDParser.c (Makefile source module name: LUFA_SRC_USB) - * - * \section Sec_ModDescription Module Description - * HID Class Driver module. This module contains an internal implementation of the USB HID Class, for both Device - * and Host USB modes. User applications can use this class driver instead of implementing the HID class manually - * via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Hosts or Devices using the USB HID Class. - * - * @{ - */ - -#ifndef _HID_CLASS_H_ -#define _HID_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_HID_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "Device/HIDClassDevice.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "Host/HIDClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c deleted file mode 100644 index 67a1352b34..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_AOA_DRIVER -#define __INCLUDE_FROM_ANDROIDACCESSORY_HOST_C -#include "AndroidAccessoryClassHost.h" - -bool AOA_Host_ValidateAccessoryDevice(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const USB_Descriptor_Device_t* const DeviceDescriptor, - bool* const NeedModeSwitch) -{ - (void)AOAInterfaceInfo; - - if (DeviceDescriptor->Header.Type != DTYPE_Device) - return false; - - *NeedModeSwitch = ((DeviceDescriptor->ProductID != ANDROID_ACCESSORY_PRODUCT_ID) && - (DeviceDescriptor->ProductID != ANDROID_ACCESSORY_ADB_PRODUCT_ID)); - - return true; -} - -uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* AOAInterface = NULL; - - memset(&AOAInterfaceInfo->State, 0x00, sizeof(AOAInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return AOA_ENUMERROR_InvalidConfigDescriptor; - - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_AOA_Host_NextAndroidAccessoryInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return AOA_ENUMERROR_NoCompatibleInterfaceFound; - } - - AOAInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - while (!(DataINEndpoint) || !(DataOUTEndpoint)) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_AOA_Host_NextInterfaceBulkEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - return AOA_ENUMERROR_NoCompatibleInterfaceFound; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - AOAInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - AOAInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - AOAInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - AOAInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - AOAInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - AOAInterfaceInfo->State.IsActive = true; - AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber; - - return AOA_ENUMERROR_NoError; -} - -static uint8_t DCOMP_AOA_Host_NextAndroidAccessoryInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == AOA_CSCP_AOADataClass) && - (Interface->SubClass == AOA_CSCP_AOADataSubclass) && - (Interface->Protocol == AOA_CSCP_AOADataProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_AOA_Host_NextInterfaceBulkEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))) - return DESCRIPTOR_SEARCH_Found; - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -void AOA_Host_USBTask(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return; - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - AOA_Host_Flush(AOAInterfaceInfo); - #endif -} - -uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - uint8_t ErrorCode; - - uint16_t AccessoryProtocol; - if ((ErrorCode = AOA_Host_GetAccessoryProtocol(&AccessoryProtocol)) != HOST_WAITERROR_Successful) - return ErrorCode; - - if (AccessoryProtocol != CPU_TO_LE16(AOA_PROTOCOL_AccessoryV1)) - return AOA_ERROR_LOGICAL_CMD_FAILED; - - for (uint8_t PropertyIndex = 0; PropertyIndex < AOA_STRING_TOTAL_STRINGS; PropertyIndex++) - { - if ((ErrorCode = AOA_Host_SendPropertyString(AOAInterfaceInfo, PropertyIndex)) != HOST_WAITERROR_Successful) - return ErrorCode; - } - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE), - .bRequest = AOA_REQ_StartAccessoryMode, - .wValue = 0, - .wIndex = 0, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(NULL); -} - -static uint8_t AOA_Host_GetAccessoryProtocol(uint16_t* const Protocol) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE), - .bRequest = AOA_REQ_GetAccessoryProtocol, - .wValue = 0, - .wIndex = 0, - .wLength = sizeof(uint16_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(Protocol); -} - -static uint8_t AOA_Host_SendPropertyString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t StringIndex) -{ - const char* String = AOAInterfaceInfo->Config.PropertyStrings[StringIndex]; - - if (String == NULL) - String = ""; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE), - .bRequest = AOA_REQ_SendString, - .wValue = 0, - .wIndex = StringIndex, - .wLength = (strlen(String) + 1), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest((char*)String); -} - -uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t* const Buffer, - const uint16_t Length) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - - Pipe_Unfreeze(); - ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const char* const String) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - - Pipe_Unfreeze(); - ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t Data) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - } - - Pipe_Write_8(Data); - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return 0; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (!(Pipe_BytesInPipe())) - { - Pipe_ClearIN(); - Pipe_Freeze(); - return 0; - } - else - { - Pipe_Freeze(); - return Pipe_BytesInPipe(); - } - } - else - { - Pipe_Freeze(); - - return 0; - } -} - -int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return -1; - - int16_t ReceivedByte = -1; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (Pipe_BytesInPipe()) - ReceivedByte = Pipe_Read_8(); - - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - } - - Pipe_Freeze(); - - return ReceivedByte; -} - -uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(AOAInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(AOAInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_BytesInPipe())) - return PIPE_READYWAIT_NoError; - - bool BankFull = !(Pipe_IsReadWriteAllowed()); - - Pipe_ClearOUT(); - - if (BankFull) - { - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - } - - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -#if defined(FDEV_SETUP_STREAM) -void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(AOA_Host_putchar, AOA_Host_getchar, _FDEV_SETUP_RW); - fdev_set_udata(Stream, AOAInterfaceInfo); -} - -void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(AOA_Host_putchar, AOA_Host_getchar_Blocking, _FDEV_SETUP_RW); - fdev_set_udata(Stream, AOAInterfaceInfo); -} - -static int AOA_Host_putchar(char c, - FILE* Stream) -{ - return AOA_Host_SendByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; -} - -static int AOA_Host_getchar(FILE* Stream) -{ - int16_t ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); - - if (ReceivedByte < 0) - return _FDEV_EOF; - - return ReceivedByte; -} - -static int AOA_Host_getchar_Blocking(FILE* Stream) -{ - int16_t ReceivedByte; - - while ((ReceivedByte = AOA_Host_ReceiveByte((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream))) < 0) - { - if (USB_HostState == HOST_STATE_Unattached) - return _FDEV_EOF; - - AOA_Host_USBTask((USB_ClassInfo_AOA_Host_t*)fdev_get_udata(Stream)); - USB_USBTask(); - } - - return ReceivedByte; -} -#endif - -#endif - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h deleted file mode 100644 index f55cd340ae..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB Android Open Accessory Class driver. - * - * Host mode driver for the library USB Android Open Accessory Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAOA - * \defgroup Group_USBClassAndroidAccessoryHost Android Open Accessory Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Android Open Accessory USB Class driver. - * - * @{ - */ - -#ifndef __AOA_CLASS_HOST_H__ -#define __AOA_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/AndroidAccessoryClassCommon.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AOA_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Error code for some Android Open Accessory Host functions, indicating a logical (and not hardware) error. */ - #define AOA_ERROR_LOGICAL_CMD_FAILED 0x80 - - /* Type Defines: */ - /** \brief Android Open Accessory Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the Android Open Accessory class driver functions as the \c AOAInterfaceInfo - * parameter. This stores each Android Open Accessory interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - - char* PropertyStrings[AOA_STRING_TOTAL_STRINGS]; /**< Android Accessory property strings, sent to identify the accessory when the - * Android device is switched into Open Accessory mode. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref AOA_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the AOA interface within the attached device. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_AOA_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref AOA_Host_ConfigurePipes() function. */ - enum AOA_Host_EnumerationFailure_ErrorCodes_t - { - AOA_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - AOA_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - AOA_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Android Open Accessory interface was not found in the device's Configuration Descriptor. */ - AOA_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** General management task for a given Android Open Accessory host class interface, required for the correct operation of the interface. - * This should be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an Android Open Accessory Class host configuration and state. - */ - void AOA_Host_USBTask(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Validates a device descriptor, to check if the device is a valid Android device, and if it is currently in Android Open Accessory mode. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. - * \param[in] DeviceDescriptor Pointer a buffer containing the attached device's Device Descriptor. - * \param[out] NeedModeSwitch Pointer to a boolean where the mode switch requirement of the attached device is to be stored. - * - * \return Boolean \c true if the attached device is a valid Android device, \c false otherwise. - */ - bool AOA_Host_ValidateAccessoryDevice(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const USB_Descriptor_Device_t* const DeviceDescriptor, - bool* const NeedModeSwitch) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); - - /** Host interface configuration routine, to configure a given Android Open Accessory host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given Android Open Accessory Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the device. This should be - * called once after the stack has enumerated the attached device, while the host state machine is in the Addressed state. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref AOA_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Starts Accessory Mode in the attached Android device. This function will validate the device's Android Open Accessory protocol - * version, send the configured property strings, and request a switch to Android Open Accessory mode. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing an AOA Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum, or \ref AOA_ERROR_LOGICAL_CMD_FAILED if a logical error occurred.. - */ - uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a given data buffer to the attached USB device, if connected. If a device is not connected when the function is - * called, the data will be discarded. Bytes will be queued for transmission to the device until either the pipe bank - * becomes full, or the \ref AOA_Host_Flush() function is called to flush the pending data to the device. This allows for - * multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * \param[in] Buffer Pointer to a buffer containing the data to send to the device. - * \param[in] Length Length of the data to send to the device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t AOA_Host_SendData(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t* const Buffer, - const uint16_t Length); - - /** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the - * function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe - * bank becomes full, or the \ref AOA_Host_Flush() function is called to flush the pending data to the device. This allows - * for multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * \param[in] String Pointer to the null terminated string to send to the device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t AOA_Host_SendString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the - * byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the - * \ref AOA_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be - * packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * \param[in] Data Byte of data to send to the device. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t AOA_Host_SendByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Determines the number of bytes received by the AOA interface from the device, waiting to be read. This indicates the number - * of bytes in the IN pipe bank only, and thus the number of calls to \ref AOA_Host_ReceiveByte() which are guaranteed to succeed - * immediately. If multiple bytes are to be received, they should be buffered by the user application, as the pipe bank will not be - * released back to the USB controller until all bytes are read. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * - * \return Total number of buffered bytes received from the device. - */ - uint16_t AOA_Host_BytesReceived(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function - * returns a negative value. The \ref AOA_Host_BytesReceived() function may be queried in advance to determine how many bytes - * are currently buffered in the AOA interface's data receive pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * - * \return Next received byte from the device, or a negative value if no data received. - */ - int16_t AOA_Host_ReceiveByte(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class host configuration and state. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t AOA_Host_Flush(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Creates a standard character stream for the given AOA Device instance so that it can be used with all the regular - * functions in the standard \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created - * stream is bidirectional and can be used for both input and output functions. - * - * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single - * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own - * line buffering. - * - * \note The created stream can be given as \c stdout if desired to direct the standard output from all \c functions - * to the given AOA interface. - * \n\n - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void AOA_Host_CreateStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream); - - /** Identical to \ref AOA_Host_CreateStream(), except that reads are blocking until the calling stream function terminates - * the transfer. While blocking, the USB and AOA service tasks are called repeatedly to maintain USB communications. - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] AOAInterfaceInfo Pointer to a structure containing a AOA Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void AOA_Host_CreateBlockingStream(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - FILE* const Stream); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_ANDROIDACCESSORY_HOST_C) - #if defined(FDEV_SETUP_STREAM) - static int AOA_Host_putchar(char c, - FILE* Stream) ATTR_NON_NULL_PTR_ARG(2); - static int AOA_Host_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - static int AOA_Host_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - #endif - - static uint8_t AOA_Host_GetAccessoryProtocol(uint16_t* const Protocol) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t AOA_Host_SendPropertyString(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo, - const uint8_t StringIndex) ATTR_NON_NULL_PTR_ARG(1); - - static uint8_t DCOMP_AOA_Host_NextAndroidAccessoryInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_AOA_Host_NextInterfaceBulkEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c deleted file mode 100644 index 1e869e830d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_AUDIO_DRIVER -#define __INCLUDE_FROM_AUDIO_HOST_C -#include "AudioClassHost.h" - -uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* AudioControlInterface = NULL; - USB_Descriptor_Interface_t* AudioStreamingInterface = NULL; - - memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return AUDIO_ENUMERROR_InvalidConfigDescriptor; - - while ((AudioInterfaceInfo->Config.DataINPipe.Address && !(DataINEndpoint)) || - (AudioInterfaceInfo->Config.DataOUTPipe.Address && !(DataOUTEndpoint))) - { - if (!(AudioControlInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (!(AudioControlInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_Audio_Host_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_Audio_Host_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return AUDIO_ENUMERROR_NoCompatibleInterfaceFound; - } - - AudioControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_Audio_Host_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return AUDIO_ENUMERROR_NoCompatibleInterfaceFound; - } - } - - AudioStreamingInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - AudioInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - AudioInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - AudioInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_ISOCHRONOUS; - AudioInterfaceInfo->Config.DataINPipe.Banks = 2; - - AudioInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - AudioInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - AudioInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_ISOCHRONOUS; - AudioInterfaceInfo->Config.DataOUTPipe.Banks = 2; - - if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - AudioInterfaceInfo->State.ControlInterfaceNumber = AudioControlInterface->InterfaceNumber; - AudioInterfaceInfo->State.StreamingInterfaceNumber = AudioStreamingInterface->InterfaceNumber; - AudioInterfaceInfo->State.EnabledStreamingAltIndex = AudioStreamingInterface->AlternateSetting; - AudioInterfaceInfo->State.IsActive = true; - - return AUDIO_ENUMERROR_NoError; -} - -static uint8_t DCOMP_Audio_Host_NextAudioControlInterface(void* CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == AUDIO_CSCP_AudioClass) && - (Interface->SubClass == AUDIO_CSCP_ControlSubclass) && - (Interface->Protocol == AUDIO_CSCP_ControlProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_Audio_Host_NextAudioStreamInterface(void* CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == AUDIO_CSCP_AudioClass) && - (Interface->SubClass == AUDIO_CSCP_AudioStreamingSubclass) && - (Interface->Protocol == AUDIO_CSCP_StreamingProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - if ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_ISOCHRONOUS) - return DESCRIPTOR_SEARCH_Found; - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const bool EnableStreaming) -{ - if (!(AudioInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - return USB_Host_SetInterfaceAltSetting(AudioInterfaceInfo->State.StreamingInterfaceNumber, - EnableStreaming ? AudioInterfaceInfo->State.EnabledStreamingAltIndex : 0); -} - -uint8_t Audio_Host_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const uint8_t DataPipeIndex, - const uint8_t EndpointProperty, - const uint8_t EndpointControl, - const uint16_t DataLength, - void* const Data) -{ - if (!(AudioInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - uint8_t RequestType; - uint8_t EndpointAddress; - - if (EndpointProperty & 0x80) - RequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT); - else - RequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT); - - Pipe_SelectPipe(DataPipeIndex); - EndpointAddress = Pipe_GetBoundEndpointAddress(); - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = RequestType, - .bRequest = EndpointProperty, - .wValue = ((uint16_t)EndpointControl << 8), - .wIndex = EndpointAddress, - .wLength = DataLength, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(Data); -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h deleted file mode 100644 index 6cb78a6210..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h +++ /dev/null @@ -1,411 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB Audio 1.0 Class driver. - * - * Host mode driver for the library USB Audio 1.0 Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassAudio - * \defgroup Group_USBClassAudioHost Audio 1.0 Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/AudioClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Audio 1.0 USB Class driver. - * - * @{ - */ - -#ifndef __AUDIO_CLASS_HOST_H__ -#define __AUDIO_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/AudioClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_AUDIO_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief Audio Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the Audio class driver functions as the \c AudioInterfaceInfo parameter. This - * stores each Audio interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref Audio_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t ControlInterfaceNumber; /**< Interface index of the Audio Control interface within the attached device. */ - uint8_t StreamingInterfaceNumber; /**< Interface index of the Audio Streaming interface within the attached device. */ - - uint8_t EnabledStreamingAltIndex; /**< Alternative setting index of the Audio Streaming interface when the stream is enabled. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_Audio_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref Audio_Host_ConfigurePipes() function. */ - enum AUDIO_Host_EnumerationFailure_ErrorCodes_t - { - AUDIO_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - AUDIO_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - AUDIO_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible AUDIO interface was not found in the device's Configuration Descriptor. */ - AUDIO_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given Audio host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given Audio Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the - * device. This should be called once after the stack has enumerated the attached device, while the host state - * machine is in the Addressed state. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref AUDIO_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Starts or stops the audio streaming for the given configured Audio Host interface, allowing for audio samples to be - * send and/or received. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state. - * \param[in] EnableStreaming Boolean true to enable streaming of the specified interface, false to disable - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const bool EnableStreaming) ATTR_NON_NULL_PTR_ARG(1); - - /** Gets or sets the specified property of a streaming audio class endpoint that is bound to a pipe in the given - * class instance. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state. - * \param[in] DataPipeIndex Index of the data pipe whose bound endpoint is to be altered. - * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t. - * \param[in] EndpointControl Parameter of the endpoint to get or set, a value from \ref Audio_EndpointControls_t. - * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum - * length of the retrieved data. - * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where - * the retrieved data is to be stored for GET operations. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t Audio_Host_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const uint8_t DataPipeIndex, - const uint8_t EndpointProperty, - const uint8_t EndpointControl, - const uint16_t DataLength, - void* const Data) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6); - - /* Inline Functions: */ - /** General management task for a given Audio host class interface, required for the correct operation of - * the interface. This should be called frequently in the main program loop, before the master USB management task - * \ref USB_USBTask(). - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class host configuration and state. - */ - static inline void Audio_Host_USBTask(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Host_USBTask(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - { - (void)AudioInterfaceInfo; - } - - /** Determines if the given audio interface is ready for a sample to be read from it, and selects the streaming - * IN pipe ready for reading. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or - * the call will fail. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Boolean \c true if the given Audio interface has a sample to be read, \c false otherwise. - */ - static inline bool Audio_Host_IsSampleReceived(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline bool Audio_Host_IsSampleReceived(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - { - if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive)) - return false; - - bool SampleReceived = false; - - Pipe_SelectPipe(AudioInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - SampleReceived = Pipe_IsINReceived(); - Pipe_Freeze(); - - return SampleReceived; - } - - /** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects - * the streaming OUT pipe ready for writing. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or - * the call will fail. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Boolean \c true if the given Audio interface is ready to accept the next sample, \c false otherwise. - */ - static inline bool Audio_Host_IsReadyForNextSample(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline bool Audio_Host_IsReadyForNextSample(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - { - if ((USB_HostState != HOST_STATE_Configured) || !(AudioInterfaceInfo->State.IsActive)) - return false; - - Pipe_SelectPipe(AudioInterfaceInfo->Config.DataOUTPipe.Address); - return Pipe_IsOUTReady(); - } - - /** Reads the next 8-bit audio sample from the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Host_IsSampleReceived() function to ensure - * that the correct pipe is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Signed 8-bit audio sample from the audio interface. - */ - static inline int8_t Audio_Host_ReadSample8(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline int8_t Audio_Host_ReadSample8(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - { - int8_t Sample; - - (void)AudioInterfaceInfo; - - Sample = Pipe_Read_8(); - - if (!(Pipe_BytesInPipe())) - { - Pipe_Unfreeze(); - Pipe_ClearIN(); - Pipe_Freeze(); - } - - return Sample; - } - - /** Reads the next 16-bit audio sample from the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Host_IsSampleReceived() function to ensure - * that the correct pipe is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Signed 16-bit audio sample from the audio interface. - */ - static inline int16_t Audio_Host_ReadSample16(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline int16_t Audio_Host_ReadSample16(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - { - int16_t Sample; - - (void)AudioInterfaceInfo; - - Sample = (int16_t)Pipe_Read_16_LE(); - - if (!(Pipe_BytesInPipe())) - { - Pipe_Unfreeze(); - Pipe_ClearIN(); - Pipe_Freeze(); - } - - return Sample; - } - - /** Reads the next 24-bit audio sample from the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Host_IsSampleReceived() function to ensure - * that the correct pipe is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * - * \return Signed 24-bit audio sample from the audio interface. - */ - static inline int32_t Audio_Host_ReadSample24(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline int32_t Audio_Host_ReadSample24(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo) - { - int32_t Sample; - - (void)AudioInterfaceInfo; - - Sample = (((uint32_t)Pipe_Read_8() << 16) | Pipe_Read_16_LE()); - - if (!(Pipe_BytesInPipe())) - { - Pipe_Unfreeze(); - Pipe_ClearIN(); - Pipe_Freeze(); - } - - return Sample; - } - - /** Writes the next 8-bit audio sample to the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Host_IsReadyForNextSample() function to - * ensure that the correct pipe is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Sample Signed 8-bit audio sample. - */ - static inline void Audio_Host_WriteSample8(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const int8_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Host_WriteSample8(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const int8_t Sample) - { - (void)AudioInterfaceInfo; - - Pipe_Write_8(Sample); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_Unfreeze(); - Pipe_ClearOUT(); - Pipe_WaitUntilReady(); - Pipe_Freeze(); - } - } - - /** Writes the next 16-bit audio sample to the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Host_IsReadyForNextSample() function to - * ensure that the correct pipe is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Sample Signed 16-bit audio sample. - */ - static inline void Audio_Host_WriteSample16(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const int16_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Host_WriteSample16(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const int16_t Sample) - { - (void)AudioInterfaceInfo; - - Pipe_Write_16_LE(Sample); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_Unfreeze(); - Pipe_ClearOUT(); - Pipe_WaitUntilReady(); - Pipe_Freeze(); - } - } - - /** Writes the next 24-bit audio sample to the current audio interface. - * - * \pre This should be preceded immediately by a call to the \ref Audio_Host_IsReadyForNextSample() function to - * ensure that the correct pipe is selected and ready for data. - * - * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. - * \param[in] Sample Signed 24-bit audio sample. - */ - static inline void Audio_Host_WriteSample24(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const int32_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void Audio_Host_WriteSample24(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - const int32_t Sample) - { - (void)AudioInterfaceInfo; - - Pipe_Write_16_LE(Sample); - Pipe_Write_8(Sample >> 16); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_Unfreeze(); - Pipe_ClearOUT(); - Pipe_WaitUntilReady(); - Pipe_Freeze(); - } - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_AUDIO_HOST_C) - static uint8_t DCOMP_Audio_Host_NextAudioControlInterface(void* CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_Audio_Host_NextAudioStreamInterface(void* CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c deleted file mode 100644 index dd48da1d8e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_CDC_DRIVER -#define __INCLUDE_FROM_CDC_HOST_C -#include "CDCClassHost.h" - -uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Endpoint_t* NotificationEndpoint = NULL; - USB_Descriptor_Interface_t* CDCControlInterface = NULL; - - memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return CDC_ENUMERROR_InvalidConfigDescriptor; - - while (!(DataINEndpoint) || !(DataOUTEndpoint) || !(NotificationEndpoint)) - { - if (!(CDCControlInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (NotificationEndpoint) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return CDC_ENUMERROR_NoCompatibleInterfaceFound; - } - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - } - else - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return CDC_ENUMERROR_NoCompatibleInterfaceFound; - } - - CDCControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - NotificationEndpoint = NULL; - } - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - { - if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT) - NotificationEndpoint = EndpointData; - else - DataINEndpoint = EndpointData; - } - else - { - DataOUTEndpoint = EndpointData; - } - } - - CDCInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - CDCInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - CDCInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - CDCInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - CDCInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - CDCInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - CDCInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize); - CDCInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress; - CDCInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT; - - if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.NotificationPipe, 1))) - return false; - - CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber; - CDCInterfaceInfo->State.ControlLineStates.HostToDevice = (CDC_CONTROL_LINE_OUT_RTS | CDC_CONTROL_LINE_OUT_DTR); - CDCInterfaceInfo->State.ControlLineStates.DeviceToHost = (CDC_CONTROL_LINE_IN_DCD | CDC_CONTROL_LINE_IN_DSR); - CDCInterfaceInfo->State.IsActive = true; - - return CDC_ENUMERROR_NoError; -} - -static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == CDC_CSCP_CDCClass) && - (Interface->SubClass == CDC_CSCP_ACMSubclass) && - (Interface->Protocol == CDC_CSCP_ATCommandProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == CDC_CSCP_CDCDataClass) && - (Interface->SubClass == CDC_CSCP_NoDataSubclass) && - (Interface->Protocol == CDC_CSCP_NoDataProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) && - !(Pipe_IsEndpointBound(Endpoint->EndpointAddress))) - { - return DESCRIPTOR_SEARCH_Found; - } - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - USB_Request_Header_t Notification; - Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL); - - if ((Notification.bRequest == CDC_NOTIF_SerialState) && - (Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))) - { - Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost, - sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost), - NULL); - - Pipe_ClearIN(); - - EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo); - } - else - { - Pipe_ClearIN(); - } - } - - Pipe_Freeze(); - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - CDC_Host_Flush(CDCInterfaceInfo); - #endif -} - -uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = CDC_REQ_SetLineEncoding, - .wValue = 0, - .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber, - .wLength = sizeof(CDCInterfaceInfo->State.LineEncoding), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(&CDCInterfaceInfo->State.LineEncoding); -} - -uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = CDC_REQ_SetControlLineState, - .wValue = CDCInterfaceInfo->State.ControlLineStates.HostToDevice, - .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(NULL); -} - -uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const uint8_t Duration) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = CDC_REQ_SendBreak, - .wValue = Duration, - .wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(NULL); -} - -uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const uint8_t* const Buffer, - const uint16_t Length) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); - - Pipe_Unfreeze(); - ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const char* const String) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); - - Pipe_Unfreeze(); - ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const uint8_t Data) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - } - - Pipe_Write_8(Data); - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return 0; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (!(Pipe_BytesInPipe())) - { - Pipe_ClearIN(); - Pipe_Freeze(); - return 0; - } - else - { - Pipe_Freeze(); - return Pipe_BytesInPipe(); - } - } - else - { - Pipe_Freeze(); - - return 0; - } -} - -int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return -1; - - int16_t ReceivedByte = -1; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (Pipe_BytesInPipe()) - ReceivedByte = Pipe_Read_8(); - - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - } - - Pipe_Freeze(); - - return ReceivedByte; -} - -uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_BytesInPipe())) - return PIPE_READYWAIT_NoError; - - bool BankFull = !(Pipe_IsReadWriteAllowed()); - - Pipe_ClearOUT(); - - if (BankFull) - { - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - } - - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -#if defined(FDEV_SETUP_STREAM) -void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Host_putchar, CDC_Host_getchar, _FDEV_SETUP_RW); - fdev_set_udata(Stream, CDCInterfaceInfo); -} - -void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - FILE* const Stream) -{ - *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Host_putchar, CDC_Host_getchar_Blocking, _FDEV_SETUP_RW); - fdev_set_udata(Stream, CDCInterfaceInfo); -} - -static int CDC_Host_putchar(char c, - FILE* Stream) -{ - return CDC_Host_SendByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; -} - -static int CDC_Host_getchar(FILE* Stream) -{ - int16_t ReceivedByte = CDC_Host_ReceiveByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream)); - - if (ReceivedByte < 0) - return _FDEV_EOF; - - return ReceivedByte; -} - -static int CDC_Host_getchar_Blocking(FILE* Stream) -{ - int16_t ReceivedByte; - - while ((ReceivedByte = CDC_Host_ReceiveByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream))) < 0) - { - if (USB_HostState == HOST_STATE_Unattached) - return _FDEV_EOF; - - CDC_Host_USBTask((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream)); - USB_USBTask(); - } - - return ReceivedByte; -} -#endif - -// cppcheck-suppress unusedFunction -void CDC_Host_Event_Stub(void) -{ - -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h deleted file mode 100644 index f5faab9357..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h +++ /dev/null @@ -1,351 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB CDC Class driver. - * - * Host mode driver for the library USB CDC Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassCDC - * \defgroup Group_USBClassCDCHost CDC Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/CDCClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the CDC USB Class driver. - * - * @{ - */ - -#ifndef __CDC_CLASS_HOST_H__ -#define __CDC_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/CDCClassCommon.h" - - #include - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_CDC_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief CDC Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the CDC class driver functions as the \c CDCInterfaceInfo parameter. This - * stores each CDC interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref CDC_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */ - - struct - { - uint16_t HostToDevice; /**< Control line states from the host to device, as a set of \c CDC_CONTROL_LINE_OUT_* - * masks - to notify the device of changes to these values, call the - * \ref CDC_Host_SendControlLineStateChange() function. - */ - uint16_t DeviceToHost; /**< Control line states from the device to host, as a set of \c CDC_CONTROL_LINE_IN_* - * masks. This value is updated each time \ref CDC_Host_USBTask() is called. - */ - } ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and host. */ - - CDC_LineEncoding_t LineEncoding; /**< Line encoding used in the virtual serial port, for the device's information. - * This is generally only used if the virtual serial port data is to be - * reconstructed on a physical UART. When set by the host application, the - * \ref CDC_Host_SetLineEncoding() function must be called to push the changes - * to the device. - */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_CDC_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref CDC_Host_ConfigurePipes() function. */ - enum CDC_Host_EnumerationFailure_ErrorCodes_t - { - CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - CDC_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible CDC interface was not found in the device's Configuration Descriptor. */ - CDC_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** General management task for a given CDC host class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state. - */ - void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Host interface configuration routine, to configure a given CDC host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given CDC Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the device. - * This should be called once after the stack has enumerated the attached device, while the host state machine is in - * the Addressed state. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref CDC_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Sets the line encoding for the attached device's virtual serial port. This should be called when the \c LineEncoding - * values of the interface have been changed to push the new settings to the USB device. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a Serial Control Line State Change notification to the device. This should be called when the virtual serial - * control lines (DTR, RTS, etc.) have changed states. Line states persist until they are cleared via a second - * notification. This should be called each time the CDC class driver's \c ControlLineStates.HostToDevice value is updated - * to push the new states to the USB device. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a Send Break request to the device. This is generally used to separate data or to indicate a special condition - * to the receiving device. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * \param[in] Duration Duration of the break, in milliseconds. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a given data buffer to the attached USB device, if connected. If a device is not connected when the function is - * called, the data will be discarded. Bytes will be queued for transmission to the device until either the pipe bank - * becomes full, or the \ref CDC_Host_Flush() function is called to flush the pending data to the device. This allows for - * multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * \param[in] Buffer Pointer to a buffer containing the data to send to the device. - * \param[in] Length Length of the data to send to the device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t CDC_Host_SendData(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const uint8_t* const Buffer, - const uint16_t Length); - - /** Sends a given null-terminated string to the attached USB device, if connected. If a device is not connected when the - * function is called, the string is discarded. Bytes will be queued for transmission to the device until either the pipe - * bank becomes full, or the \ref CDC_Host_Flush() function is called to flush the pending data to the device. This allows - * for multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * \param[in] String Pointer to the null terminated string to send to the device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the - * byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the - * \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be - * packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * \param[in] Data Byte of data to send to the device. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Determines the number of bytes received by the CDC interface from the device, waiting to be read. This indicates the number - * of bytes in the IN pipe bank only, and thus the number of calls to \ref CDC_Host_ReceiveByte() which are guaranteed to succeed - * immediately. If multiple bytes are to be received, they should be buffered by the user application, as the pipe bank will not be - * released back to the USB controller until all bytes are read. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * - * \return Total number of buffered bytes received from the device. - */ - uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function - * returns a negative value. The \ref CDC_Host_BytesReceived() function may be queried in advance to determine how many bytes - * are currently buffered in the CDC interface's data receive pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * - * \return Next received byte from the device, or a negative value if no data received. - */ - int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - #if defined(FDEV_SETUP_STREAM) || defined(__DOXYGEN__) - /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular - * functions in the standard \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created - * stream is bidirectional and can be used for both input and output functions. - * - * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single - * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may - * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own - * line buffering. - * - * \note The created stream can be given as \c stdout if desired to direct the standard output from all \c functions - * to the given CDC interface. - * \n\n - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - FILE* const Stream); - - /** Identical to \ref CDC_Host_CreateStream(), except that reads are blocking until the calling stream function terminates - * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. - * - * \note This function is not available on all microcontroller architectures. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. - * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. - */ - void CDC_Host_CreateBlockingStream(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, - FILE* const Stream); - #endif - - /** CDC class driver event for a control line state change on a CDC host interface. This event fires each time the device notifies - * the host of a control line state change (containing the virtual serial control line states, such as DCD) and may be hooked in the - * user program by declaring a handler function with the same name and parameters listed here. The new control line states - * are available in the \c ControlLineStates.DeviceToHost value inside the CDC host interface structure passed as a parameter, set as - * a mask of \c CDC_CONTROL_LINE_IN_* masks. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - */ - void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_CDC_HOST_C) - #if defined(FDEV_SETUP_STREAM) - static int CDC_Host_putchar(char c, - FILE* Stream) ATTR_NON_NULL_PTR_ARG(2); - static int CDC_Host_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - static int CDC_Host_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); - #endif - - void CDC_Host_Event_Stub(void) ATTR_CONST; - - void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) - ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Host_Event_Stub); - - static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c deleted file mode 100644 index ae2395bc7a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c +++ /dev/null @@ -1,396 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_HID_DRIVER -#define __INCLUDE_FROM_HID_HOST_C -#include "HIDClassHost.h" - -uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* HIDInterface = NULL; - USB_HID_Descriptor_HID_t* HIDDescriptor = NULL; - - memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return HID_ENUMERROR_InvalidConfigDescriptor; - - while (!(DataINEndpoint) || !(DataOUTEndpoint)) - { - if (!(HIDInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_HID_Host_NextHIDInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (DataINEndpoint || DataOUTEndpoint) - break; - - do - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_HID_Host_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return HID_ENUMERROR_NoCompatibleInterfaceFound; - } - - HIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - } while (HIDInterfaceInfo->Config.HIDInterfaceProtocol && - (HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol)); - - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_HID_Host_NextHIDDescriptor) != DESCRIPTOR_SEARCH_COMP_Found) - { - return HID_ENUMERROR_NoCompatibleInterfaceFound; - } - - HIDDescriptor = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_HID_Descriptor_HID_t); - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - HIDInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - HIDInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - HIDInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_INTERRUPT; - - HIDInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - HIDInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - HIDInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_INTERRUPT; - - if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber; - HIDInterfaceInfo->State.HIDReportSize = LE16_TO_CPU(HIDDescriptor->HIDReportLength); - HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_CSCP_NonBootProtocol); - HIDInterfaceInfo->State.LargestReportSize = 8; - HIDInterfaceInfo->State.IsActive = true; - - return HID_ENUMERROR_NoError; -} - -static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if (Interface->Class == HID_CSCP_HIDClass) - return DESCRIPTOR_SEARCH_Found; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_HID_Host_NextHIDDescriptor(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == HID_DTYPE_HID) - return DESCRIPTOR_SEARCH_Found; - else if (Header->Type == DTYPE_Interface) - return DESCRIPTOR_SEARCH_Fail; - else - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - if (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress))) - return DESCRIPTOR_SEARCH_Found; - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) -uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - const uint8_t ReportID, - void* Buffer) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = HID_REQ_SetReport, - .wValue = ((HID_REPORT_ITEM_In + 1) << 8) | ReportID, - .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(Buffer); -} -#endif - -uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - void* Buffer) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - uint16_t ReportSize; - uint8_t* BufferPos = Buffer; - -#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - if (!(HIDInterfaceInfo->State.UsingBootProtocol)) - { - uint8_t ReportID = 0; - - if (HIDInterfaceInfo->Config.HIDParserData->UsingReportIDs) - { - ReportID = Pipe_Read_8(); - *(BufferPos++) = ReportID; - } - - ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In); - } - else -#endif - { - ReportSize = Pipe_BytesInPipe(); - } - - if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_ClearIN(); - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, -#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - const uint8_t ReportID, -#endif - const uint8_t ReportType, - void* Buffer, - const uint16_t ReportSize) -{ -#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive)) - return false; - - if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == HID_REPORT_ITEM_Out)) - { - uint8_t ErrorCode; - - Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (ReportID) - Pipe_Write_Stream_LE(&ReportID, sizeof(ReportID), NULL); - - if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; - } - else -#endif - { - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = HID_REQ_SetReport, -#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - .wValue = ((ReportType + 1) << 8) | ReportID, -#else - .wValue = ((ReportType + 1) << 8), -#endif - .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = ReportSize, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(Buffer); - } -} - -bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive)) - return false; - - bool ReportReceived; - - Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - ReportReceived = Pipe_IsINReceived(); - - Pipe_Freeze(); - - return ReportReceived; -} - -uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) -{ - uint8_t ErrorCode; - - if (!(HIDInterfaceInfo->State.SupportsBootProtocol)) - return HID_ERROR_LOGICAL; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = HID_REQ_SetProtocol, - .wValue = 0, - .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - HIDInterfaceInfo->State.LargestReportSize = 8; - HIDInterfaceInfo->State.UsingBootProtocol = true; - - return HOST_SENDCONTROL_Successful; -} - -uint8_t HID_Host_SetIdlePeriod(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - const uint16_t MS) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = HID_REQ_SetIdle, - .wValue = ((MS << 6) & 0xFF00), - .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(NULL); -} - -#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) -uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) -{ - uint8_t ErrorCode; - - uint8_t HIDReportData[HIDInterfaceInfo->State.HIDReportSize]; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE), - .bRequest = REQ_GetDescriptor, - .wValue = (HID_DTYPE_Report << 8), - .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = HIDInterfaceInfo->State.HIDReportSize, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(HIDReportData)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - if (HIDInterfaceInfo->State.UsingBootProtocol) - { - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = HID_REQ_SetProtocol, - .wValue = 1, - .wIndex = HIDInterfaceInfo->State.InterfaceNumber, - .wLength = 0, - }; - - if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - HIDInterfaceInfo->State.UsingBootProtocol = false; - } - - if (HIDInterfaceInfo->Config.HIDParserData == NULL) - return HID_ERROR_LOGICAL; - - if ((ErrorCode = USB_ProcessHIDReport(HIDReportData, HIDInterfaceInfo->State.HIDReportSize, - HIDInterfaceInfo->Config.HIDParserData)) != HID_PARSE_Successful) - { - return HID_ERROR_LOGICAL | ErrorCode; - } - - uint16_t LargestReportSizeBits = HIDInterfaceInfo->Config.HIDParserData->LargestReportSizeBits; - HIDInterfaceInfo->State.LargestReportSize = (LargestReportSizeBits >> 3) + ((LargestReportSizeBits & 0x07) != 0); - - return 0; -} -#endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h deleted file mode 100644 index 5d617b92ff..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB HID Class driver. - * - * Host mode driver for the library USB HID Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassHID - * \defgroup Group_USBClassHIDHost HID Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/HIDClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the HID USB Class driver. - * - * @{ - */ - -#ifndef __HID_CLASS_HOST_H__ -#define __HID_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/HIDClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_HID_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Error code for some HID Host functions, indicating a logical (and not hardware) error. */ - #define HID_ERROR_LOGICAL 0x80 - - /* Type Defines: */ - /** \brief HID Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the HID class driver functions as the \c HIDInterfaceInfo parameter. This - * stores each HID interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - - uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific - * boot subclass protocol is required, a protocol value from the - * \ref HID_Descriptor_ClassSubclassProtocol_t enum. - */ - #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - HID_ReportInfo_t* HIDParserData; /**< HID parser data to store the parsed HID report data, when boot protocol - * is not used. - * - * \note When the \c HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, - * this method is unavailable. - */ - #endif - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device. */ - - bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot - * Protocol when enabled via \ref HID_Host_SetBootProtocol(). - */ - bool DeviceUsesOUTPipe; /**< Indicates if the current interface instance uses a separate OUT data pipe for - * OUT reports, or if OUT reports are sent via the control pipe instead. - */ - bool UsingBootProtocol; /**< Indicates that the interface is currently initialized in Boot Protocol mode */ - uint16_t HIDReportSize; /**< Size in bytes of the HID report descriptor in the device. */ - - uint8_t LargestReportSize; /**< Largest report the device will send, in bytes. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_HID_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref HID_Host_ConfigurePipes() function. */ - enum HID_Host_EnumerationFailure_ErrorCodes_t - { - HID_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - HID_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor. */ - HID_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given HID host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given HID Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the - * device. This should be called once after the stack has enumerated the attached device, while the host state - * machine is in the Addressed state. - * - * \attention Once the device pipes are configured, the HID device's reporting protocol must be set via a call - * to either the \ref HID_Host_SetBootProtocol() or \ref HID_Host_SetReportProtocol() function. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref HID_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - - /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \attention The destination buffer should be large enough to accommodate the largest report that the attached device - * can generate. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * \param[in] Buffer Buffer to store the received report into. - * - * \return An error code from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - /** Receives a HID IN report from the attached device, by the report ID. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \note When the \c HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * \param[in] ReportID Report ID of the received report if ControlRequest is false, set by the to the Report ID to fetch. - * \param[in] Buffer Buffer to store the received report into. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - const uint8_t ReportID, - void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - #endif - - /** Sends an OUT or FEATURE report to the currently attached HID device, using the device's OUT pipe if available, - * or the device's Control pipe if not. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \note When the \c HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed - * from the parameter list of this function. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * \param[in] ReportID Report ID of the report to send to the device, or 0 if the device does not use report IDs. - * \param[in] ReportType Type of report to issue to the device, either \ref HID_REPORT_ITEM_Out or \ref HID_REPORT_ITEM_Feature. - * \param[in] Buffer Buffer containing the report to send to the attached device. - * \param[in] ReportSize Report size in bytes to send to the attached device. - * - * \return An error code from the \ref USB_Host_SendControlErrorCodes_t enum if the DeviceUsesOUTPipe flag is set in - * the interface's state structure, a value from the \ref Pipe_Stream_RW_ErrorCodes_t enum otherwise. - */ - uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - const uint8_t ReportID, - #endif - const uint8_t ReportType, - void* Buffer, - const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) - #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - ATTR_NON_NULL_PTR_ARG(4); - #else - ATTR_NON_NULL_PTR_ARG(3); - #endif - - /** Determines if a HID IN report has been received from the attached device on the data IN pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * - * \return Boolean \c true if a report has been received, \c false otherwise. - */ - bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Switches the attached HID device's reporting protocol over to the Boot Report protocol mode, on supported devices. - * - * \note When the \c HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method must still be called - * to explicitly place the attached device into boot protocol mode before use. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * - * \return \ref HID_ERROR_LOGICAL if the device does not support Boot Protocol mode, a value from the - * \ref USB_Host_SendControlErrorCodes_t enum otherwise. - */ - uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sets the idle period for the attached HID device to the specified interval. The HID idle period determines the rate - * at which the device should send a report, when no state changes have occurred; i.e. on HID keyboards, this sets the - * hardware key repeat interval. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * \param[in] MS Idle period as a multiple of four milliseconds, zero to disable hardware repeats - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t HID_Host_SetIdlePeriod(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, - const uint16_t MS) ATTR_NON_NULL_PTR_ARG(1); - - #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY) - /** Switches the attached HID device's reporting protocol over to the standard Report protocol mode. This also retrieves - * and parses the device's HID report descriptor, so that the size of each report can be determined in advance. - * - * \attention Whether this function is used or not, the \ref CALLBACK_HIDParser_FilterHIDReportItem() callback from the HID - * Report Parser this function references must be implemented in the user code. - * - * \note When the \c HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable. - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum if an error occurs while retrieving the HID - * Report descriptor or the setting of the Report protocol, \ref HID_ERROR_LOGICAL if the HID interface does - * not have a valid \ref HID_ReportInfo_t structure set in its configuration, a mask of \ref HID_ERROR_LOGICAL - * and a value from the \ref HID_Parse_ErrorCodes_t otherwise. - */ - uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - #endif - - /* Inline Functions: */ - /** General management task for a given Human Interface Class host class interface, required for the correct operation of - * the interface. This should be called frequently in the main program loop, before the master USB management task - * \ref USB_USBTask(). - * - * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state. - */ - static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) - { - (void)HIDInterfaceInfo; - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_HID_HOST_C) - static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_HID_Host_NextHIDDescriptor(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c deleted file mode 100644 index 29a6696db8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_MIDI_DRIVER -#define __INCLUDE_FROM_MIDI_HOST_C -#include "MIDIClassHost.h" - -uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* MIDIInterface = NULL; - - memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return MIDI_ENUMERROR_InvalidConfigDescriptor; - - while (!(DataINEndpoint) || !(DataOUTEndpoint)) - { - if (!(MIDIInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return MIDI_ENUMERROR_NoCompatibleInterfaceFound; - } - - MIDIInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - MIDIInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - MIDIInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - MIDIInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - MIDIInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - MIDIInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - MIDIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber; - MIDIInterfaceInfo->State.IsActive = true; - - return MIDI_ENUMERROR_NoError; -} - -static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == AUDIO_CSCP_AudioClass) && - (Interface->SubClass == AUDIO_CSCP_MIDIStreamingSubclass) && - (Interface->Protocol == AUDIO_CSCP_StreamingProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if ((EndpointType == EP_TYPE_BULK) && !(Pipe_IsEndpointBound(Endpoint->EndpointAddress))) - return DESCRIPTOR_SEARCH_Found; - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive)) - return; - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - MIDI_Host_Flush(MIDIInterfaceInfo); - #endif -} - -uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_BytesInPipe()) - { - Pipe_ClearOUT(); - - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - { - Pipe_Freeze(); - return ErrorCode; - } - } - - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, - MIDI_EventPacket_t* const Event) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != PIPE_RWSTREAM_NoError) - { - Pipe_Freeze(); - return ErrorCode; - } - - if (!(Pipe_IsReadWriteAllowed())) - Pipe_ClearOUT(); - - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, - MIDI_EventPacket_t* const Event) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - bool DataReady = false; - - Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (Pipe_BytesInPipe()) - { - Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL); - DataReady = true; - } - - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - } - - Pipe_Freeze(); - - return DataReady; -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h deleted file mode 100644 index 15b9e4fc16..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB MIDI Class driver. - * - * Host mode driver for the library USB MIDI Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassMIDI - * \defgroup Group_USBClassMIDIHost MIDI Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/MIDIClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the MIDI USB Class driver. - * - * @{ - */ - -#ifndef __MIDI_CLASS_HOST_H__ -#define __MIDI_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/MIDIClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_MIDI_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief MIDI Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the MIDI class driver functions as the \c MIDIInterfaceInfo parameter. This - * stores each MIDI interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref MIDI_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the MIDI interface within the attached device. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_MIDI_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref MIDI_Host_ConfigurePipes() function. */ - enum MIDI_Host_EnumerationFailure_ErrorCodes_t - { - MIDI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - MIDI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible MIDI interface was not found in the device's Configuration Descriptor. */ - MIDI_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given MIDI host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given MIDI Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the device. - * This should be called once after the stack has enumerated the attached device, while the host state machine is in - * the Addressed state. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing an MIDI Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref MIDI_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** General management task for a given MIDI host class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing an MIDI Class host configuration and state. - */ - void MIDI_Host_USBTask(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a MIDI event packet to the device. If no device is connected, the event packet is discarded. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, - MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Flushes the MIDI send buffer, sending any queued MIDI events to the device. This should be called to override the - * \ref MIDI_Host_SendEventPacket() function's packing behavior, to flush queued events. Events are queued into the - * pipe bank until either the pipe bank is full, or \ref MIDI_Host_Flush() is called. This allows for multiple MIDI - * events to be packed into a single pipe packet, increasing data throughput. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Receives a MIDI event packet from the device. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. - * \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed. - * - * \return Boolean \c true if a MIDI event packet was received, \c false otherwise. - */ - bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, - MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_MIDI_HOST_C) - static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c deleted file mode 100644 index 91e2ef022f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c +++ /dev/null @@ -1,579 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_MS_DRIVER -#define __INCLUDE_FROM_MASSSTORAGE_HOST_C -#include "MassStorageClassHost.h" - -uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* MassStorageInterface = NULL; - - memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return MS_ENUMERROR_InvalidConfigDescriptor; - - while (!(DataINEndpoint) || !(DataOUTEndpoint)) - { - if (!(MassStorageInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_MS_Host_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_MS_Host_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return MS_ENUMERROR_NoCompatibleInterfaceFound; - } - - MassStorageInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - MSInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - MSInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - MSInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - MSInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - MSInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - MSInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber; - MSInterfaceInfo->State.IsActive = true; - - return MS_ENUMERROR_NoError; -} - -static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == MS_CSCP_MassStorageClass) && - (Interface->SubClass == MS_CSCP_SCSITransparentSubclass) && - (Interface->Protocol == MS_CSCP_BulkOnlyTransportProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if ((EndpointType == EP_TYPE_BULK) && (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))) - { - return DESCRIPTOR_SEARCH_Found; - } - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - MS_CommandBlockWrapper_t* const SCSICommandBlock, - const void* const BufferPtr) -{ - uint8_t ErrorCode = PIPE_RWSTREAM_NoError; - - if (++MSInterfaceInfo->State.TransactionTag == 0xFFFFFFFF) - MSInterfaceInfo->State.TransactionTag = 1; - - SCSICommandBlock->Signature = CPU_TO_LE32(MS_CBW_SIGNATURE); - SCSICommandBlock->Tag = cpu_to_le32(MSInterfaceInfo->State.TransactionTag); - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t), - NULL)) != PIPE_RWSTREAM_NoError) - { - return ErrorCode; - } - - Pipe_ClearOUT(); - Pipe_WaitUntilReady(); - - Pipe_Freeze(); - - if (BufferPtr != NULL) - { - ErrorCode = MS_Host_SendReceiveData(MSInterfaceInfo, SCSICommandBlock, (void*)BufferPtr); - - if ((ErrorCode != PIPE_RWSTREAM_NoError) && (ErrorCode != PIPE_RWSTREAM_PipeStalled)) - { - Pipe_Freeze(); - return ErrorCode; - } - } - - MS_CommandStatusWrapper_t SCSIStatusBlock; - return MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSIStatusBlock); -} - -static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) -{ - uint16_t TimeoutMSRem = MS_COMMAND_DATA_TIMEOUT_MS; - uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - while (!(Pipe_IsINReceived())) - { - uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return PIPE_RWSTREAM_Timeout; - } - - Pipe_Freeze(); - Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsStalled()) - { - USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); - return PIPE_RWSTREAM_PipeStalled; - } - - Pipe_Freeze(); - Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsStalled()) - { - USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); - return PIPE_RWSTREAM_PipeStalled; - } - - if (USB_HostState == HOST_STATE_Unattached) - return PIPE_RWSTREAM_DeviceDisconnected; - }; - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); - Pipe_Freeze(); - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - MS_CommandBlockWrapper_t* const SCSICommandBlock, - void* BufferPtr) -{ - uint8_t ErrorCode = PIPE_RWSTREAM_NoError; - uint16_t BytesRem = le32_to_cpu(SCSICommandBlock->DataTransferLength); - - if (SCSICommandBlock->Flags & MS_COMMAND_DIR_DATA_IN) - { - if ((ErrorCode = MS_Host_WaitForDataReceived(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError) - { - Pipe_Freeze(); - return ErrorCode; - } - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_ClearIN(); - } - else - { - Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - - while (!(Pipe_IsOUTReady())) - { - if (USB_HostState == HOST_STATE_Unattached) - return PIPE_RWSTREAM_DeviceDisconnected; - } - } - - Pipe_Freeze(); - - return ErrorCode; -} - -static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - MS_CommandStatusWrapper_t* const SCSICommandStatus) -{ - uint8_t ErrorCode = PIPE_RWSTREAM_NoError; - - if ((ErrorCode = MS_Host_WaitForDataReceived(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t), - NULL)) != PIPE_RWSTREAM_NoError) - { - return ErrorCode; - } - - Pipe_ClearIN(); - Pipe_Freeze(); - - if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass) - ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED; - - return ErrorCode; -} - -uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) -{ - uint8_t ErrorCode; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = MS_REQ_MassStorageReset, - .wValue = 0, - .wIndex = MSInterfaceInfo->State.InterfaceNumber, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipe.Address); - - if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipe.Address); - - if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - return HOST_SENDCONTROL_Successful; -} - -uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - uint8_t* const MaxLUNIndex) -{ - uint8_t ErrorCode; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = MS_REQ_GetMaxLUN, - .wValue = 0, - .wIndex = MSInterfaceInfo->State.InterfaceNumber, - .wLength = 1, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) == HOST_SENDCONTROL_SetupStalled) - { - *MaxLUNIndex = 0; - ErrorCode = HOST_SENDCONTROL_Successful; - } - - return ErrorCode; -} - -uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - SCSI_Inquiry_Response_t* const InquiryData) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = CPU_TO_LE32(sizeof(SCSI_Inquiry_Response_t)), - .Flags = MS_COMMAND_DIR_DATA_IN, - .LUN = LUNIndex, - .SCSICommandLength = 6, - .SCSICommandData = - { - SCSI_CMD_INQUIRY, - 0x00, // Reserved - 0x00, // Reserved - 0x00, // Reserved - sizeof(SCSI_Inquiry_Response_t), // Allocation Length - 0x00 // Unused (control) - } - }; - - return MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, InquiryData); -} - -uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = CPU_TO_LE32(0), - .Flags = MS_COMMAND_DIR_DATA_IN, - .LUN = LUNIndex, - .SCSICommandLength = 6, - .SCSICommandData = - { - SCSI_CMD_TEST_UNIT_READY, - 0x00, // Reserved - 0x00, // Reserved - 0x00, // Reserved - 0x00, // Reserved - 0x00 // Unused (control) - } - }; - - return MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL); -} - -uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - SCSI_Capacity_t* const DeviceCapacity) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - uint8_t ErrorCode; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = CPU_TO_LE32(sizeof(SCSI_Capacity_t)), - .Flags = MS_COMMAND_DIR_DATA_IN, - .LUN = LUNIndex, - .SCSICommandLength = 10, - .SCSICommandData = - { - SCSI_CMD_READ_CAPACITY_10, - 0x00, // Reserved - 0x00, // MSB of Logical block address - 0x00, - 0x00, - 0x00, // LSB of Logical block address - 0x00, // Reserved - 0x00, // Reserved - 0x00, // Partial Medium Indicator - 0x00 // Unused (control) - } - }; - - if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, DeviceCapacity)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - DeviceCapacity->Blocks = BE32_TO_CPU(DeviceCapacity->Blocks); - DeviceCapacity->BlockSize = BE32_TO_CPU(DeviceCapacity->BlockSize); - - return PIPE_RWSTREAM_NoError; -} - -uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - SCSI_Request_Sense_Response_t* const SenseData) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = CPU_TO_LE32(sizeof(SCSI_Request_Sense_Response_t)), - .Flags = MS_COMMAND_DIR_DATA_IN, - .LUN = LUNIndex, - .SCSICommandLength = 6, - .SCSICommandData = - { - SCSI_CMD_REQUEST_SENSE, - 0x00, // Reserved - 0x00, // Reserved - 0x00, // Reserved - sizeof(SCSI_Request_Sense_Response_t), // Allocation Length - 0x00 // Unused (control) - } - }; - - return MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, SenseData); -} - -uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - const bool PreventRemoval) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = CPU_TO_LE32(0), - .Flags = MS_COMMAND_DIR_DATA_OUT, - .LUN = LUNIndex, - .SCSICommandLength = 6, - .SCSICommandData = - { - SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL, - 0x00, // Reserved - 0x00, // Reserved - PreventRemoval, // Prevent flag - 0x00, // Reserved - 0x00 // Unused (control) - } - }; - - return MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL); -} - -uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - const uint32_t BlockAddress, - const uint8_t Blocks, - const uint16_t BlockSize, - void* BlockBuffer) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = cpu_to_le32((uint32_t)Blocks * BlockSize), - .Flags = MS_COMMAND_DIR_DATA_IN, - .LUN = LUNIndex, - .SCSICommandLength = 10, - .SCSICommandData = - { - SCSI_CMD_READ_10, - 0x00, // Unused (control bits, all off) - (BlockAddress >> 24), // MSB of Block Address - (BlockAddress >> 16), - (BlockAddress >> 8), - (BlockAddress & 0xFF), // LSB of Block Address - 0x00, // Reserved - 0x00, // MSB of Total Blocks to Read - Blocks, // LSB of Total Blocks to Read - 0x00 // Unused (control) - } - }; - - return MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, BlockBuffer); -} - -uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - const uint32_t BlockAddress, - const uint8_t Blocks, - const uint16_t BlockSize, - const void* BlockBuffer) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive)) - return HOST_SENDCONTROL_DeviceDisconnected; - - MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) - { - .DataTransferLength = cpu_to_le32((uint32_t)Blocks * BlockSize), - .Flags = MS_COMMAND_DIR_DATA_OUT, - .LUN = LUNIndex, - .SCSICommandLength = 10, - .SCSICommandData = - { - SCSI_CMD_WRITE_10, - 0x00, // Unused (control bits, all off) - (BlockAddress >> 24), // MSB of Block Address - (BlockAddress >> 16), - (BlockAddress >> 8), - (BlockAddress & 0xFF), // LSB of Block Address - 0x00, // Reserved - 0x00, // MSB of Total Blocks to Write - Blocks, // LSB of Total Blocks to Write - 0x00 // Unused (control) - } - }; - - return MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, BlockBuffer); -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h deleted file mode 100644 index 2e78431849..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB Mass Storage Class driver. - * - * Host mode driver for the library USB Mass Storage Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassMS - * \defgroup Group_USBClassMassStorageHost Mass Storage Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Mass Storage USB Class driver. - * - * @{ - */ - -#ifndef __MS_CLASS_HOST_H__ -#define __MS_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/MassStorageClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_MS_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Error code for some Mass Storage Host functions, indicating a logical (and not hardware) error. */ - #define MS_ERROR_LOGICAL_CMD_FAILED 0x80 - - /* Type Defines: */ - /** \brief Mass Storage Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the Mass Storage class driver functions as the \c MSInterfaceInfo parameter. This - * stores each Mass Storage interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref MS_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device. */ - - uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_MS_Host_t; - - /** \brief SCSI Device LUN Capacity Structure. - * - * SCSI capacity structure, to hold the total capacity of the device in both the number - * of blocks in the current LUN, and the size of each block. This structure is filled by - * the device when the \ref MS_Host_ReadDeviceCapacity() function is called. - */ - typedef struct - { - uint32_t Blocks; /**< Number of blocks in the addressed LUN of the device. */ - uint32_t BlockSize; /**< Number of bytes in each block in the addressed LUN. */ - } SCSI_Capacity_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref MS_Host_ConfigurePipes() function. */ - enum MS_Host_EnumerationFailure_ErrorCodes_t - { - MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - MS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor. */ - MS_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given Mass Storage host interface instance using the - * Configuration Descriptor read from an attached USB device. This function automatically updates the given Mass - * Storage Host instance's state values and configures the pipes required to communicate with the interface if it - * is found within the device. This should be called once after the stack has enumerated the attached device, while - * the host state machine is in the Addressed state. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref MS_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface - * and readying it for the next Mass Storage command. This should be called after a failed SCSI request to - * ensure the attached Mass Storage device is ready to receive the next command. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a GET MAX LUN control request to the attached device, retrieving the index of the highest LUN (Logical - * UNit, a logical drive) in the device. This value can then be used in the other functions of the Mass Storage - * Host mode Class driver to address a specific LUN within the device. - * - * \note Some devices do not support this request, and will STALL it when issued. To get around this, - * on unsupported devices the max LUN index will be reported as zero and no error will be returned - * if the device STALLs the request. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[out] MaxLUNIndex Pointer to a location where the highest LUN index value should be stored. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - uint8_t* const MaxLUNIndex) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Retrieves the Mass Storage device's inquiry data for the specified LUN, indicating the device characteristics and - * properties. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * \param[out] InquiryData Location where the read inquiry data should be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED. - */ - uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - SCSI_Inquiry_Response_t* const InquiryData) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(3); - - /** Sends a TEST UNIT READY command to the device, to determine if it is ready to accept other SCSI commands. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED if not ready. - */ - uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex) ATTR_NON_NULL_PTR_ARG(1); - - /** Retrieves the total capacity of the attached USB Mass Storage device, in blocks, and block size. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * \param[out] DeviceCapacity Pointer to the location where the capacity information should be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED if not ready. - */ - uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(3); - - /** Retrieves the device sense data, indicating the current device state and error codes for the previously - * issued command. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * \param[out] SenseData Pointer to the location where the sense information should be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED if not ready. - */ - uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(3); - - /** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock - * the device from removal so that blocks of data on the medium can be read or altered. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * \param[in] PreventRemoval Boolean \c true if the device should be locked from removal, \c false otherwise. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED if not ready. - */ - uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads blocks of data from the attached Mass Storage device's medium. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * \param[in] BlockAddress Starting block address within the device to read from. - * \param[in] Blocks Total number of blocks to read. - * \param[in] BlockSize Size in bytes of each block within the device. - * \param[out] BlockBuffer Pointer to where the read data from the device should be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED if not ready. - */ - uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - const uint32_t BlockAddress, - const uint8_t Blocks, - const uint16_t BlockSize, - void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6); - - /** Writes blocks of data to the attached Mass Storage device's medium. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state. - * \param[in] LUNIndex LUN index within the device the command is being issued to. - * \param[in] BlockAddress Starting block address within the device to write to. - * \param[in] Blocks Total number of blocks to read. - * \param[in] BlockSize Size in bytes of each block within the device. - * \param[in] BlockBuffer Pointer to where the data to write should be sourced from. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or \ref MS_ERROR_LOGICAL_CMD_FAILED if not ready. - */ - uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - const uint8_t LUNIndex, - const uint32_t BlockAddress, - const uint8_t Blocks, - const uint16_t BlockSize, - const void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6); - - /* Inline Functions: */ - /** General management task for a given Mass Storage host class interface, required for the correct operation of - * the interface. This should be called frequently in the main program loop, before the master USB management task - * \ref USB_USBTask(). - * - * \param[in,out] MSInterfaceInfo Pointer to a structure containing an Mass Storage Class host configuration and state. - */ - static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) - { - (void)MSInterfaceInfo; - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define MS_COMMAND_DATA_TIMEOUT_MS 10000 - - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C) - static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - MS_CommandBlockWrapper_t* const SCSICommandBlock, - const void* const BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - MS_CommandBlockWrapper_t* const SCSICommandBlock, - void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, - MS_CommandStatusWrapper_t* const SCSICommandStatus) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c deleted file mode 100644 index 1ecf19115a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_PRINTER_DRIVER -#define __INCLUDE_FROM_PRINTER_HOST_C -#include "PrinterClassHost.h" - -uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Interface_t* PrinterInterface = NULL; - - memset(&PRNTInterfaceInfo->State, 0x00, sizeof(PRNTInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return PRNT_ENUMERROR_InvalidConfigDescriptor; - - while (!(DataINEndpoint) || !(DataOUTEndpoint)) - { - if (!(PrinterInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_PRNT_Host_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return PRNT_ENUMERROR_NoCompatibleInterfaceFound; - } - - PrinterInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - DataINEndpoint = EndpointData; - else - DataOUTEndpoint = EndpointData; - } - - PRNTInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - PRNTInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - PRNTInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - PRNTInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - PRNTInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - PRNTInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - PRNTInterfaceInfo->State.InterfaceNumber = PrinterInterface->InterfaceNumber; - PRNTInterfaceInfo->State.AlternateSetting = PrinterInterface->AlternateSetting; - PRNTInterfaceInfo->State.IsActive = true; - - return PRNT_ENUMERROR_NoError; -} - -static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == PRNT_CSCP_PrinterClass) && - (Interface->SubClass == PRNT_CSCP_PrinterSubclass) && - (Interface->Protocol == PRNT_CSCP_BidirectionalProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if (EndpointType == EP_TYPE_BULK) - return DESCRIPTOR_SEARCH_Found; - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -void PRNT_Host_USBTask(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return; - - #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) - PRNT_Host_Flush(PRNTInterfaceInfo); - #endif -} - -uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) -{ - if (PRNTInterfaceInfo->State.AlternateSetting) - { - uint8_t ErrorCode; - - if ((ErrorCode = USB_Host_SetInterfaceAltSetting(PRNTInterfaceInfo->State.InterfaceNumber, - PRNTInterfaceInfo->State.AlternateSetting)) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - } - - return HOST_SENDCONTROL_Successful; -} - -uint8_t PRNT_Host_GetPortStatus(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - uint8_t* const PortStatus) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = PRNT_REQ_GetPortStatus, - .wValue = 0, - .wIndex = PRNTInterfaceInfo->State.InterfaceNumber, - .wLength = sizeof(uint8_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(PortStatus); -} - -uint8_t PRNT_Host_SoftReset(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = PRNT_REQ_SoftReset, - .wValue = 0, - .wIndex = PRNTInterfaceInfo->State.InterfaceNumber, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(NULL); -} - -uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_BytesInPipe())) - return PIPE_READYWAIT_NoError; - - bool BankFull = !(Pipe_IsReadWriteAllowed()); - - Pipe_ClearOUT(); - - if (BankFull) - { - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - } - - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - const uint8_t Data) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - uint8_t ErrorCode; - - Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError) - return ErrorCode; - } - - Pipe_Write_8(Data); - Pipe_Freeze(); - - return PIPE_READYWAIT_NoError; -} - -uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - const char* const String) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(String, strlen(String), NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - - ErrorCode = Pipe_WaitUntilReady(); - - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - void* Buffer, - const uint16_t Length) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - Pipe_ClearOUT(); - - ErrorCode = Pipe_WaitUntilReady(); - - Pipe_Freeze(); - - return ErrorCode; -} - -uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return 0; - - Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (!(Pipe_BytesInPipe())) - { - Pipe_ClearIN(); - Pipe_Freeze(); - return 0; - } - else - { - Pipe_Freeze(); - return Pipe_BytesInPipe(); - } - } - else - { - Pipe_Freeze(); - - return 0; - } -} - -int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - int16_t ReceivedByte = -1; - - Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsINReceived()) - { - if (Pipe_BytesInPipe()) - ReceivedByte = Pipe_Read_8(); - - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - } - - Pipe_Freeze(); - - return ReceivedByte; -} - -uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - char* const DeviceIDString, - const uint16_t BufferSize) -{ - uint8_t ErrorCode; - uint16_t DeviceIDStringLength = 0; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = PRNT_REQ_GetDeviceID, - .wValue = 0, - .wIndex = PRNTInterfaceInfo->State.InterfaceNumber, - .wLength = sizeof(DeviceIDStringLength), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - if (!(DeviceIDStringLength)) - { - DeviceIDString[0] = 0x00; - return HOST_SENDCONTROL_Successful; - } - - DeviceIDStringLength = be16_to_cpu(DeviceIDStringLength); - - if (DeviceIDStringLength > BufferSize) - DeviceIDStringLength = BufferSize; - - USB_ControlRequest.wLength = DeviceIDStringLength; - - if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - memmove(&DeviceIDString[0], &DeviceIDString[2], DeviceIDStringLength - 2); - - DeviceIDString[DeviceIDStringLength - 2] = 0x00; - - return HOST_SENDCONTROL_Successful; -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h deleted file mode 100644 index 64494b1f67..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB Printer Class driver. - * - * Host mode driver for the library USB Printer Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassPrinter - * \defgroup Group_USBClassPrinterHost Printer Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/PrinterClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Printer USB Class driver. - * - * @{ - */ - -#ifndef __PRINTER_CLASS_HOST_H__ -#define __PRINTER_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/PrinterClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_PRINTER_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief Printer Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the Printer class driver functions as the \c PRNTInterfaceInfo parameter. This - * stores each Printer interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref PRNT_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the Printer interface within the attached device. */ - uint8_t AlternateSetting; /**< Alternate setting within the Printer Interface in the attached device. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_PRNT_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref PRNT_Host_ConfigurePipes() function. */ - enum PRNT_Host_EnumerationFailure_ErrorCodes_t - { - PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - PRNT_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Printer interface was not found in the device's Configuration Descriptor. */ - PRNT_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given Printer host interface instance using the - * Configuration Descriptor read from an attached USB device. This function automatically updates the given Printer - * instance's state values and configures the pipes required to communicate with the interface if it is found within - * the device. This should be called once after the stack has enumerated the attached device, while the host state - * machine is in the Addressed state. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref PRNT_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** General management task for a given Printer host class interface, required for the correct operation of - * the interface. This should be called frequently in the main program loop, before the master USB management task - * \ref USB_USBTask(). - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - */ - void PRNT_Host_USBTask(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called - * once the connected device's configuration has been set, to ensure the printer is ready to accept commands. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Retrieves the status of the virtual Printer port's inbound status lines. The result can then be masked against the - * \c PRNT_PORTSTATUS_* macros to determine the printer port's status. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * \param[out] PortStatus Location where the retrieved port status should be stored. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t PRNT_Host_GetPortStatus(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - uint8_t* const PortStatus) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Soft-resets the attached printer, readying it for new commands. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum. - */ - uint8_t PRNT_Host_SoftReset(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends the given null terminated string to the attached printer's input endpoint. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * \param[in] String Pointer to a null terminated string to send. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends the given raw data stream to the attached printer's input endpoint. This should contain commands that the - * printer is able to understand - for example, PCL data. Not all printers accept all printer languages; see - * \ref PRNT_Host_GetDeviceID() for details on determining acceptable languages for an attached printer. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * \param[in] Buffer Pointer to a buffer containing the raw command stream to send to the printer. - * \param[in] Length Size in bytes of the command stream to be sent. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t PRNT_Host_SendData(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - void* Buffer, - const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the - * byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the - * \ref PRNT_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be - * packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * \param[in] Data Byte of data to send to the device. - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); - - /** Determines the number of bytes received by the printer interface from the device, waiting to be read. This indicates the number - * of bytes in the IN pipe bank only, and thus the number of calls to \ref PRNT_Host_ReceiveByte() which are guaranteed to succeed - * immediately. If multiple bytes are to be received, they should be buffered by the user application, as the pipe bank will not be - * released back to the USB controller until all bytes are read. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * - * \return Total number of buffered bytes received from the device. - */ - uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo); - - /** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function - * returns a negative value. The \ref PRNT_Host_BytesReceived() function may be queried in advance to determine how many bytes - * are currently buffered in the Printer interface's data receive pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * - * \return Next received byte from the device, or a negative value if no data received. - */ - int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo); - - /** Retrieves the attached printer device's ID string, formatted according to IEEE 1284. This string is sent as a - * Unicode string from the device and is automatically converted to an ASCII encoded C string by this function, thus - * the maximum reportable string length is two less than the size given (to accommodate the Unicode string length - * bytes which are removed). - * - * This string, when supported, contains the model, manufacturer and acceptable printer languages for the attached device. - * - * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state. - * \param[out] DeviceIDString Pointer to a buffer where the Device ID string should be stored, in ASCII format. - * \param[in] BufferSize Size in bytes of the buffer allocated for the Device ID string. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, - char* const DeviceIDString, - const uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_PRINTER_HOST_C) - static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c deleted file mode 100644 index 1e23f8e7c6..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_RNDIS_DRIVER -#define __INCLUDE_FROM_RNDIS_HOST_C -#include "RNDISClassHost.h" - -uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Endpoint_t* NotificationEndpoint = NULL; - USB_Descriptor_Interface_t* RNDISControlInterface = NULL; - - memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return RNDIS_ENUMERROR_InvalidConfigDescriptor; - - RNDISControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - while (!(DataINEndpoint) || !(DataOUTEndpoint) || !(NotificationEndpoint)) - { - if (!(RNDISControlInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (NotificationEndpoint) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_RNDIS_Host_NextRNDISDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return RNDIS_ENUMERROR_NoCompatibleInterfaceFound; - } - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - } - else - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_RNDIS_Host_NextRNDISControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return RNDIS_ENUMERROR_NoCompatibleInterfaceFound; - } - - RNDISControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - NotificationEndpoint = NULL; - } - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - { - if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT) - NotificationEndpoint = EndpointData; - else - DataINEndpoint = EndpointData; - } - else - { - DataOUTEndpoint = EndpointData; - } - } - - RNDISInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - RNDISInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - RNDISInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - RNDISInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - RNDISInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - RNDISInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - RNDISInterfaceInfo->Config.NotificationPipe.Size = le16_to_cpu(NotificationEndpoint->EndpointSize); - RNDISInterfaceInfo->Config.NotificationPipe.EndpointAddress = NotificationEndpoint->EndpointAddress; - RNDISInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT; - - if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.NotificationPipe, 1))) - return false; - - RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber; - RNDISInterfaceInfo->State.IsActive = true; - - return RNDIS_ENUMERROR_NoError; -} - -static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == CDC_CSCP_CDCClass) && - (Interface->SubClass == CDC_CSCP_ACMSubclass) && - (Interface->Protocol == CDC_CSCP_VendorSpecificProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, - USB_Descriptor_Interface_t); - - if ((Interface->Class == CDC_CSCP_CDCDataClass) && - (Interface->SubClass == CDC_CSCP_NoDataSubclass) && - (Interface->Protocol == CDC_CSCP_NoDataProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) && - !(Pipe_IsEndpointBound(Endpoint->EndpointAddress))) - { - return DESCRIPTOR_SEARCH_Found; - } - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t Length) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = RNDIS_REQ_SendEncapsulatedCommand, - .wValue = 0, - .wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber, - .wLength = Length, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(Buffer); -} - -static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t Length) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - .bRequest = RNDIS_REQ_GetEncapsulatedResponse, - .wValue = 0, - .wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber, - .wLength = Length, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(Buffer); -} - -uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) -{ - uint8_t ErrorCode; - - RNDIS_KeepAlive_Message_t KeepAliveMessage; - RNDIS_KeepAlive_Complete_t KeepAliveMessageResponse; - - KeepAliveMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_KEEPALIVE_MSG); - KeepAliveMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_KeepAlive_Message_t)); - KeepAliveMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++); - - if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &KeepAliveMessage, - sizeof(RNDIS_KeepAlive_Message_t))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &KeepAliveMessageResponse, - sizeof(RNDIS_KeepAlive_Complete_t))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - return HOST_SENDCONTROL_Successful; -} - -uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) -{ - uint8_t ErrorCode; - - RNDIS_Initialize_Message_t InitMessage; - RNDIS_Initialize_Complete_t InitMessageResponse; - - InitMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_INITIALIZE_MSG); - InitMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_Initialize_Message_t)); - InitMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++); - - InitMessage.MajorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MAJOR); - InitMessage.MinorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MINOR); - InitMessage.MaxTransferSize = cpu_to_le32(RNDISInterfaceInfo->Config.HostMaxPacketSize); - - if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &InitMessage, - sizeof(RNDIS_Initialize_Message_t))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &InitMessageResponse, - sizeof(RNDIS_Initialize_Complete_t))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if (InitMessageResponse.Status != CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS)) - return RNDIS_ERROR_LOGICAL_CMD_FAILED; - - RNDISInterfaceInfo->State.DeviceMaxPacketSize = le32_to_cpu(InitMessageResponse.MaxTransferSize); - - return HOST_SENDCONTROL_Successful; -} - -uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - const uint32_t Oid, - void* Buffer, - const uint16_t Length) -{ - uint8_t ErrorCode; - - struct - { - RNDIS_Set_Message_t SetMessage; - uint8_t ContiguousBuffer[Length]; - } SetMessageData; - - RNDIS_Set_Complete_t SetMessageResponse; - - SetMessageData.SetMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_SET_MSG); - SetMessageData.SetMessage.MessageLength = cpu_to_le32(sizeof(RNDIS_Set_Message_t) + Length); - SetMessageData.SetMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++); - - SetMessageData.SetMessage.Oid = cpu_to_le32(Oid); - SetMessageData.SetMessage.InformationBufferLength = cpu_to_le32(Length); - SetMessageData.SetMessage.InformationBufferOffset = CPU_TO_LE32(sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t)); - SetMessageData.SetMessage.DeviceVcHandle = CPU_TO_LE32(0); - - memcpy(&SetMessageData.ContiguousBuffer, Buffer, Length); - - if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &SetMessageData, - (sizeof(RNDIS_Set_Message_t) + Length))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &SetMessageResponse, - sizeof(RNDIS_Set_Complete_t))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if (SetMessageResponse.Status != CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS)) - return RNDIS_ERROR_LOGICAL_CMD_FAILED; - - return HOST_SENDCONTROL_Successful; -} - -uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - const uint32_t Oid, - void* Buffer, - const uint16_t MaxLength) -{ - uint8_t ErrorCode; - - RNDIS_Query_Message_t QueryMessage; - - struct - { - RNDIS_Query_Complete_t QueryMessageResponse; - uint8_t ContiguousBuffer[MaxLength]; - } QueryMessageResponseData; - - QueryMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_QUERY_MSG); - QueryMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_Query_Message_t)); - QueryMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++); - - QueryMessage.Oid = cpu_to_le32(Oid); - QueryMessage.InformationBufferLength = CPU_TO_LE32(0); - QueryMessage.InformationBufferOffset = CPU_TO_LE32(0); - QueryMessage.DeviceVcHandle = CPU_TO_LE32(0); - - if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &QueryMessage, - sizeof(RNDIS_Query_Message_t))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &QueryMessageResponseData, - sizeof(QueryMessageResponseData))) != HOST_SENDCONTROL_Successful) - { - return ErrorCode; - } - - if (QueryMessageResponseData.QueryMessageResponse.Status != CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS)) - return RNDIS_ERROR_LOGICAL_CMD_FAILED; - - memcpy(Buffer, &QueryMessageResponseData.ContiguousBuffer, MaxLength); - - return HOST_SENDCONTROL_Successful; -} - -bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) -{ - bool PacketWaiting; - - if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive)) - return false; - - Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address); - - Pipe_Unfreeze(); - PacketWaiting = Pipe_IsINReceived(); - Pipe_Freeze(); - - return PacketWaiting; -} - -uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - uint16_t* const PacketLength) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (!(Pipe_IsReadWriteAllowed())) - { - if (Pipe_IsINReceived()) - Pipe_ClearIN(); - - *PacketLength = 0; - Pipe_Freeze(); - return PIPE_RWSTREAM_NoError; - } - - RNDIS_Packet_Message_t DeviceMessage; - - if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t), - NULL)) != PIPE_RWSTREAM_NoError) - { - return ErrorCode; - } - - *PacketLength = (uint16_t)le32_to_cpu(DeviceMessage.DataLength); - - Pipe_Discard_Stream(le32_to_cpu(DeviceMessage.DataOffset) - - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)), - NULL); - - Pipe_Read_Stream_LE(Buffer, *PacketLength, NULL); - - if (!(Pipe_BytesInPipe())) - Pipe_ClearIN(); - - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t PacketLength) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive)) - return PIPE_READYWAIT_DeviceDisconnected; - - RNDIS_Packet_Message_t DeviceMessage; - - memset(&DeviceMessage, 0, sizeof(RNDIS_Packet_Message_t)); - DeviceMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_PACKET_MSG); - DeviceMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) + PacketLength); - DeviceMessage.DataOffset = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)); - DeviceMessage.DataLength = cpu_to_le32(PacketLength); - - Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t), - NULL)) != PIPE_RWSTREAM_NoError) - { - return ErrorCode; - } - - Pipe_Write_Stream_LE(Buffer, PacketLength, NULL); - Pipe_ClearOUT(); - - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h deleted file mode 100644 index bac6d5c2e8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB RNDIS Class driver. - * - * Host mode driver for the library USB RNDIS Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassRNDIS - * \defgroup Group_USBClassRNDISHost RNDIS Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/RNDISClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Microsoft RNDIS Ethernet - * USB Class driver. - * - * @{ - */ - -#ifndef __RNDIS_CLASS_HOST_H__ -#define __RNDIS_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/RNDISClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** \brief RNDIS Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the RNDIS class driver functions as the \c RNDISInterfaceInfo parameter. This - * stores each RNDIS interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - USB_Pipe_Table_t NotificationPipe; /**< Notification IN Pipe configuration table. */ - - uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref RNDIS_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device. */ - - uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device. */ - - uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_RNDIS_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref RNDIS_Host_ConfigurePipes() function. */ - enum RNDIS_Host_EnumerationFailure_ErrorCodes_t - { - RNDIS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - RNDIS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - RNDIS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible RNDIS interface was not found in the device's Configuration Descriptor. */ - RNDIS_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given RNDIS host interface instance using the Configuration - * Descriptor read from an attached USB device. This function automatically updates the given RNDIS Host instance's - * state values and configures the pipes required to communicate with the interface if it is found within the device. - * This should be called once after the stack has enumerated the attached device, while the host state machine is in - * the Addressed state. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref RNDIS_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Sends a RNDIS KEEPALIVE command to the device, to ensure that it does not enter standby mode after periods - * of long inactivity. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum or \ref RNDIS_ERROR_LOGICAL_CMD_FAILED if the device returned a - * logical command failure. - */ - uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Initializes the attached RNDIS device's RNDIS interface. This should be called after the device's pipes have been - * configured via the call to \ref RNDIS_Host_ConfigurePipes(). - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum or \ref RNDIS_ERROR_LOGICAL_CMD_FAILED if the - * device returned a logical command failure. - */ - uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sets a given RNDIS property of an attached RNDIS device. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * \param[in] Oid OID number of the parameter to set. - * \param[in] Buffer Pointer to where the property data is to be sourced from. - * \param[in] Length Length in bytes of the property data to sent to the device. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum or \ref RNDIS_ERROR_LOGICAL_CMD_FAILED if the - * device returned a logical command failure. - */ - uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - const uint32_t Oid, - void* Buffer, - const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Gets a given RNDIS property of an attached RNDIS device. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * \param[in] Oid OID number of the parameter to get. - * \param[in] Buffer Pointer to where the property data is to be written to. - * \param[in] MaxLength Length in bytes of the destination buffer size. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum or \ref RNDIS_ERROR_LOGICAL_CMD_FAILED if the - * device returned a logical command failure. - */ - uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - const uint32_t Oid, - void* Buffer, - const uint16_t MaxLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Determines if a packet is currently waiting for the host to read in and process. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * - * \return Boolean \c true if a packet is waiting to be read in by the host, \c false otherwise. - */ - bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave - * only the packet contents for processing by the host in the nominated buffer. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * \param[out] Buffer Pointer to a buffer where the packer data is to be written to. - * \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - uint16_t* const PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) - ATTR_NON_NULL_PTR_ARG(3); - - /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - * \param[in] Buffer Pointer to a buffer where the packer data is to be read from. - * \param[in] PacketLength Length in bytes of the packet to send. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /* Inline Functions: */ - /** General management task for a given RNDIS host class interface, required for the correct operation of the interface. This should - * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). - * - * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state. - */ - static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void RNDIS_Host_USBTask(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) - { - (void)RNDISInterfaceInfo; - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_RNDIS_HOST_C) - static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); - static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, - void* Buffer, - const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); - - static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c deleted file mode 100644 index a6137b1918..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../../Core/USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_SI_DRIVER -#define __INCLUDE_FROM_STILLIMAGE_HOST_C -#include "StillImageClassHost.h" - -uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) -{ - USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; - USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; - USB_Descriptor_Endpoint_t* EventsEndpoint = NULL; - USB_Descriptor_Interface_t* StillImageInterface = NULL; - - memset(&SIInterfaceInfo->State, 0x00, sizeof(SIInterfaceInfo->State)); - - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return SI_ENUMERROR_InvalidConfigDescriptor; - - while (!(DataINEndpoint) || !(DataOUTEndpoint) || !(EventsEndpoint)) - { - if (!(StillImageInterface) || - USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) - { - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DCOMP_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found) - { - return SI_ENUMERROR_NoCompatibleInterfaceFound; - } - - StillImageInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); - - DataINEndpoint = NULL; - DataOUTEndpoint = NULL; - EventsEndpoint = NULL; - - continue; - } - - USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t); - - if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) - { - if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT) - EventsEndpoint = EndpointData; - else - DataINEndpoint = EndpointData; - } - else - { - DataOUTEndpoint = EndpointData; - } - } - - SIInterfaceInfo->Config.DataINPipe.Size = le16_to_cpu(DataINEndpoint->EndpointSize); - SIInterfaceInfo->Config.DataINPipe.EndpointAddress = DataINEndpoint->EndpointAddress; - SIInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_BULK; - - SIInterfaceInfo->Config.DataOUTPipe.Size = le16_to_cpu(DataOUTEndpoint->EndpointSize); - SIInterfaceInfo->Config.DataOUTPipe.EndpointAddress = DataOUTEndpoint->EndpointAddress; - SIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; - - SIInterfaceInfo->Config.EventsPipe.Size = le16_to_cpu(EventsEndpoint->EndpointSize); - SIInterfaceInfo->Config.EventsPipe.EndpointAddress = EventsEndpoint->EndpointAddress; - SIInterfaceInfo->Config.EventsPipe.Type = EP_TYPE_INTERRUPT; - - if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataINPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataOUTPipe, 1))) - return false; - - if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.EventsPipe, 1))) - return false; - - SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber; - SIInterfaceInfo->State.IsActive = true; - - return SI_ENUMERROR_NoError; -} - -uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Interface) - { - USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - - if ((Interface->Class == SI_CSCP_StillImageClass) && - (Interface->SubClass == SI_CSCP_StillImageSubclass) && - (Interface->Protocol == SI_CSCP_BulkOnlyProtocol)) - { - return DESCRIPTOR_SEARCH_Found; - } - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) -{ - USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); - - if (Header->Type == DTYPE_Endpoint) - { - USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); - - uint8_t EndpointType = (Endpoint->Attributes & EP_TYPE_MASK); - - if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) && - (!(Pipe_IsEndpointBound(Endpoint->EndpointAddress)))) - { - return DESCRIPTOR_SEARCH_Found; - } - } - else if (Header->Type == DTYPE_Interface) - { - return DESCRIPTOR_SEARCH_Fail; - } - - return DESCRIPTOR_SEARCH_NotFound; -} - -uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - PIMA_Container_t* const PIMAHeader) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - if (SIInterfaceInfo->State.IsSessionOpen) - PIMAHeader->TransactionID = cpu_to_le32(SIInterfaceInfo->State.TransactionID++); - - Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0)); - - if (ParamBytes) - { - if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NULL)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - } - - Pipe_ClearOUT(); - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - PIMA_Container_t* const PIMAHeader) -{ - uint16_t TimeoutMSRem = SI_COMMAND_DATA_TIMEOUT_MS; - uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - while (!(Pipe_IsINReceived())) - { - uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return PIPE_RWSTREAM_Timeout; - } - - Pipe_Freeze(); - Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsStalled()) - { - USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); - return PIPE_RWSTREAM_PipeStalled; - } - - Pipe_Freeze(); - Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_IsStalled()) - { - USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); - return PIPE_RWSTREAM_PipeStalled; - } - - if (USB_HostState == HOST_STATE_Unattached) - return PIPE_RWSTREAM_DeviceDisconnected; - } - - Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL); - - if (PIMAHeader->Type == CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) - { - uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0)); - - if (ParamBytes) - Pipe_Read_Stream_LE(&PIMAHeader->Params, ParamBytes, NULL); - - Pipe_ClearIN(); - } - - Pipe_Freeze(); - - return PIPE_RWSTREAM_NoError; -} - -uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipe.Address); - Pipe_Unfreeze(); - - ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NULL); - - Pipe_ClearOUT(); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipe.Address); - Pipe_Unfreeze(); - - ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL); - - Pipe_Freeze(); - - return ErrorCode; -} - -bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) -{ - bool IsEventReceived = false; - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return false; - - Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipe.Address); - Pipe_Unfreeze(); - - if (Pipe_BytesInPipe()) - IsEventReceived = true; - - Pipe_Freeze(); - - return IsEventReceived; -} - -uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - PIMA_Container_t* const PIMAHeader) -{ - uint8_t ErrorCode; - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipe.Address); - Pipe_Unfreeze(); - - ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NULL); - - Pipe_ClearIN(); - Pipe_Freeze(); - - return ErrorCode; -} - -uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - SIInterfaceInfo->State.TransactionID = 0; - SIInterfaceInfo->State.IsSessionOpen = false; - - PIMA_Container_t PIMABlock = (PIMA_Container_t) - { - .DataLength = CPU_TO_LE32(PIMA_COMMAND_SIZE(1)), - .Type = CPU_TO_LE16(PIMA_CONTAINER_CommandBlock), - .Code = CPU_TO_LE16(0x1002), - .Params = {CPU_TO_LE32(1)}, - }; - - if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - if ((PIMABlock.Type != CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) || (PIMABlock.Code != CPU_TO_LE16(0x2001))) - return SI_ERROR_LOGICAL_CMD_FAILED; - - SIInterfaceInfo->State.IsSessionOpen = true; - - return PIPE_RWSTREAM_NoError; -} - -uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - PIMA_Container_t PIMABlock = (PIMA_Container_t) - { - .DataLength = CPU_TO_LE32(PIMA_COMMAND_SIZE(1)), - .Type = CPU_TO_LE16(PIMA_CONTAINER_CommandBlock), - .Code = CPU_TO_LE16(0x1003), - .Params = {CPU_TO_LE32(1)}, - }; - - if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - SIInterfaceInfo->State.IsSessionOpen = false; - - if ((PIMABlock.Type != CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) || (PIMABlock.Code != CPU_TO_LE16(0x2001))) - return SI_ERROR_LOGICAL_CMD_FAILED; - - return PIPE_RWSTREAM_NoError; -} - -uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - const uint16_t Operation, - const uint8_t TotalParams, - uint32_t* const Params) -{ - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - uint8_t ErrorCode; - - PIMA_Container_t PIMABlock = (PIMA_Container_t) - { - .DataLength = cpu_to_le32(PIMA_COMMAND_SIZE(TotalParams)), - .Type = CPU_TO_LE16(PIMA_CONTAINER_CommandBlock), - .Code = cpu_to_le16(Operation), - }; - - memcpy(&PIMABlock.Params, Params, sizeof(uint32_t) * TotalParams); - - if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - return PIPE_RWSTREAM_NoError; -} - -uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) -{ - uint8_t ErrorCode; - PIMA_Container_t PIMABlock; - - if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) - return PIPE_RWSTREAM_DeviceDisconnected; - - if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - if ((PIMABlock.Type != CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) || (PIMABlock.Code != CPU_TO_LE16(0x2001))) - return SI_ERROR_LOGICAL_CMD_FAILED; - - return PIPE_RWSTREAM_NoError; -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h deleted file mode 100644 index acfbd7d617..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Host mode driver for the library USB Still Image Class driver. - * - * Host mode driver for the library USB Still Image Class driver. - * - * \note This file should not be included directly. It is automatically included as needed by the USB module driver - * dispatch header located in LUFA/Drivers/USB.h. - */ - -/** \ingroup Group_USBClassSI - * \defgroup Group_USBClassStillImageHost Still Image Class Host Mode Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/StillImageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Host Mode USB Class driver framework interface, for the Still Image USB Class driver. - * - * @{ - */ - -#ifndef __SI_CLASS_HOST_H__ -#define __SI_CLASS_HOST_H__ - - /* Includes: */ - #include "../../USB.h" - #include "../Common/StillImageClassCommon.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_SI_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Error code for some Still Image Host functions, indicating a logical (and not hardware) error. */ - #define SI_ERROR_LOGICAL_CMD_FAILED 0x80 - - /* Type Defines: */ - /** \brief Still Image Class Host Mode Configuration and State Structure. - * - * Class state structure. An instance of this structure should be made within the user application, - * and passed to each of the Still Image class driver functions as the \c SIInterfaceInfo parameter. This - * stores each Still Image interface's configuration and state information. - */ - typedef struct - { - struct - { - USB_Pipe_Table_t DataINPipe; /**< Data IN Pipe configuration table. */ - USB_Pipe_Table_t DataOUTPipe; /**< Data OUT Pipe configuration table. */ - USB_Pipe_Table_t EventsPipe; /**< Event notification IN Pipe configuration table. */ - } Config; /**< Config data for the USB class interface within the device. All elements in this section - * must be set or the interface will fail to enumerate and operate correctly. - */ - struct - { - bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid - * after \ref SI_Host_ConfigurePipes() is called and the Host state machine is in the - * Configured state. - */ - uint8_t InterfaceNumber; /**< Interface index of the Still Image interface within the attached device. */ - - bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device. */ - uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device. */ - } State; /**< State data for the USB class interface within the device. All elements in this section - * may be set to initial values, but may also be ignored to default to sane values when - * the interface is enumerated. - */ - } USB_ClassInfo_SI_Host_t; - - /* Enums: */ - /** Enum for the possible error codes returned by the \ref SI_Host_ConfigurePipes() function. */ - enum SI_Host_EnumerationFailure_ErrorCodes_t - { - SI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ - SI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */ - SI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Still Image interface was not found in the device's - * Configuration Descriptor. - */ - SI_ENUMERROR_PipeConfigurationFailed = 3, /**< One or more pipes for the specified interface could not be configured correctly. */ - }; - - /* Function Prototypes: */ - /** Host interface configuration routine, to configure a given Still Image host interface instance using the - * Configuration Descriptor read from an attached USB device. This function automatically updates the given Still - * Image Host instance's state values and configures the pipes required to communicate with the interface if it is - * found within the device. This should be called once after the stack has enumerated the attached device, while - * the host state machine is in the Addressed state. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor. - * \param[in] ConfigDescriptorData Pointer to a buffer containing the attached device's Configuration Descriptor. - * - * \return A value from the \ref SI_Host_EnumerationFailure_ErrorCodes_t enum. - */ - uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - uint16_t ConfigDescriptorSize, - void* ConfigDescriptorData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); - - /** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands - * are issued to the device. Only one session can be open at the one time. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device - * returned a logical command failure. - */ - uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Closes an already opened PIMA session with the attached device. This should be used after all session-orientated - * PIMA commands have been issued to the device. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device - * returned a logical command failure. - */ - uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a raw PIMA block header to the device, filling out the transaction ID automatically. This can be used to send - * arbitrary PIMA blocks to the device with or without parameters. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[in] PIMAHeader Pointer to a PIMA container structure that is to be sent. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); - - /** Receives a raw PIMA block header from the device. This can be used to receive arbitrary PIMA blocks from the device with - * or without parameters. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[out] PIMAHeader Pointer to a PIMA container structure where the received block is to be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); - - /** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[in] Operation PIMA operation code to issue to the device. - * \param[in] TotalParams Total number of 32-bit parameters to send to the device in the issued command block. - * \param[in] Params Pointer to an array of 32-bit values containing the parameters to send in the command block. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device - * returned a logical command failure. - */ - uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - const uint16_t Operation, - const uint8_t TotalParams, - uint32_t* const Params) ATTR_NON_NULL_PTR_ARG(1); - - /** Receives and checks a response block from the attached Still Image device, once a command has been issued and all data - * associated with the command has been transferred. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device - * returned a logical command failure. - */ - uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Indicates if the device has issued a PIMA event block to the host via the asynchronous events pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * - * \return Boolean \c true if an event is waiting to be read, \c false otherwise. - */ - bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - - /** Receives an asynchronous event block from the device via the asynchronous events pipe. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device - * returned a logical command failure. - */ - uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1) - ATTR_NON_NULL_PTR_ARG(2); - - /** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data - * transfer beyond the regular PIMA command block parameters. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[in] Buffer Pointer to a buffer where the data to send has been stored. - * \param[in] Bytes Length in bytes of the data in the buffer to send to the attached device. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Receives arbitrary data from the attached device, for use in the data phase of PIMA commands which require data - * transfer beyond the regular PIMA command block parameters. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the - * call will fail. - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - * \param[out] Buffer Pointer to a buffer where the received data is to be stored. - * \param[in] Bytes Length in bytes of the data to read. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, - void* Buffer, - const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /* Inline Functions: */ - /** General management task for a given Still Image host class interface, required for the correct operation of the - * interface. This should be called frequently in the main program loop, before the master USB management task - * \ref USB_USBTask(). - * - * \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state. - */ - static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; - static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) - { - (void)SIInterfaceInfo; - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define SI_COMMAND_DATA_TIMEOUT_MS 10000 - - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C) - static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h deleted file mode 100644 index e3b8e2f5ef..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB MIDI Class driver. - * - * Master include file for the library USB MIDI Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassMIDI MIDI Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/MIDIClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * MIDI Class Driver module. This module contains an internal implementation of the USB MIDI Class, for both Device - * and Host USB modes. User applications can use this class driver instead of implementing the MIDI class manually - * via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Hosts or Devices using the USB MIDI Class. - * - * \note The USB MIDI class is actually a special case of the regular Audio class, thus this module depends on - * structure definitions from the \ref Group_USBClassAudioDevice class driver module. - * - * @{ - */ - -#ifndef _MIDI_CLASS_H_ -#define _MIDI_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_MIDI_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "Device/MIDIClassDevice.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "Host/MIDIClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h deleted file mode 100644 index a5af1496b9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB Mass Storage Class driver. - * - * Master include file for the library USB Mass Storage Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassMS Mass Storage Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Mass Storage Class Driver module. This module contains an internal implementation of the USB Mass Storage Class, for both - * Device and Host USB modes. User applications can use this class driver instead of implementing the Mass Storage class - * manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Hosts or Devices using the USB Mass Storage Class. - * - * @{ - */ - -#ifndef _MS_CLASS_H_ -#define _MS_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_MS_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "Device/MassStorageClassDevice.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "Host/MassStorageClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h deleted file mode 100644 index 181d6931e6..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB Printer Class driver. - * - * Master include file for the library USB Printer Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassPrinter Printer Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/PrinterClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Printer Class Driver module. This module contains an internal implementation of the USB Printer Class, for the base - * USB Printer transport layer for USB Host mode only. Note that printers are free to implement whatever printer language - * they choose on top of this (e.g. Postscript), and so this driver exposes low level data transport functions only rather - * than high level raster or text functions. User applications can use this class driver instead of implementing the Printer - * class manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Devices using the USB Printer Class. - * - * @{ - */ - -#ifndef _PRINTER_CLASS_H_ -#define _PRINTER_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_PRINTER_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_HOST) - #include "Host/PrinterClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h deleted file mode 100644 index e270629e21..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB RNDIS Class driver. - * - * Master include file for the library USB RNDIS Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassRNDIS RNDIS (Networking) Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - LUFA/Drivers/USB/Class/Host/RNDISClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * RNDIS Class Driver module. This module contains an internal implementation of the Microsoft USB RNDIS Networking - * Class, for both Device and Host USB modes. User applications can use this class driver instead of implementing the - * RNDIS class manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Hosts using the USB RNDIS Class. - * - * @{ - */ - -#ifndef _RNDIS_CLASS_H_ -#define _RNDIS_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_RNDIS_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "Device/RNDISClassDevice.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "Host/RNDISClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h deleted file mode 100644 index e8c28b441f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB Still Image Class driver. - * - * Master include file for the library USB Still Image Class driver, for both host and device modes, where available. - * - * This file should be included in all user projects making use of this optional class driver, instead of - * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. - */ - -/** \ingroup Group_USBClassDrivers - * \defgroup Group_USBClassSI Still Image Class Driver - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Class/Host/StillImageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) - * - * \section Sec_ModDescription Module Description - * Still Image Class Driver module. This module contains an internal implementation of the USB Still Image Class, - * for USB Host mode only. User applications can use this class driver instead of implementing the Still Image class - * manually via the low-level LUFA APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Devices using the USB Still Image Class. - * - * @{ - */ - -#ifndef _SI_CLASS_H_ -#define _SI_CLASS_H_ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - #define __INCLUDE_FROM_SI_DRIVER - - /* Includes: */ - #include "../Core/USBMode.h" - - #if defined(USB_CAN_BE_HOST) - #include "Host/StillImageClassHost.h" - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c deleted file mode 100644 index 09d6f3775c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "../Device.h" - -void USB_Device_SendRemoteWakeup(void) -{ - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - { - USB_PLL_On(); - while (!(USB_PLL_IsReady())); - } - - USB_CLK_Unfreeze(); - - UDCON |= (1 << RMWKUP); - while (UDCON & (1 << RMWKUP)); -} - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h deleted file mode 100644 index 318ff87200..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h +++ /dev/null @@ -1,264 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Device definitions for the AVR8 microcontrollers. - * \copydetails Group_Device_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_Device - * \defgroup Group_Device_AVR8 Device Management (AVR8) - * \brief USB Device definitions for the AVR8 microcontrollers. - * - * Architecture specific USB Device definitions for the Atmel 8-bit AVR microcontrollers. - * - * @{ - */ - -#ifndef __USBDEVICE_AVR8_H__ -#define __USBDEVICE_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBController.h" - #include "../StdDescriptors.h" - #include "../USBInterrupt.h" - #include "../Endpoint.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - #if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) - #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. - #endif - - #if (defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) - #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. - #endif - - #if (defined(USE_FLASH_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)) - #error USE_FLASH_DESCRIPTORS and USE_RAM_DESCRIPTORS are mutually exclusive. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name USB Device Mode Option Masks */ - //@{ - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__) - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in low speed (1.5Mb/s) mode. - * - * \note Low Speed mode is not available on all USB AVR models. - * \n - * - * \note Restrictions apply on the number, size and type of endpoints which can be used - * when running in low speed mode - please refer to the USB 2.0 specification. - */ - #define USB_DEVICE_OPT_LOWSPEED (1 << 0) - #endif - - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in full speed (12Mb/s) mode. - */ - #define USB_DEVICE_OPT_FULLSPEED (0 << 0) - //@} - - #if (!defined(NO_INTERNAL_SERIAL) && \ - (defined(USB_SERIES_7_AVR) || defined(USB_SERIES_6_AVR) || \ - defined(USB_SERIES_4_AVR) || defined(USB_SERIES_2_AVR) || \ - defined(__DOXYGEN__))) - /** String descriptor index for the device's unique serial number string descriptor within the device. - * This unique serial number is used by the host to associate resources to the device (such as drivers or COM port - * number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers contain - * a unique serial number internally, and setting the device descriptors serial number string index to this value - * will cause it to use the internal serial number. - * - * On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR and so will force the host to create a pseudo-serial - * number for the device. - */ - #define USE_INTERNAL_SERIAL 0xDC - - /** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller - * model. - */ - #define INTERNAL_SERIAL_LENGTH_BITS 80 - - /** Start address of the internal serial number, in the appropriate address space, if present on the selected microcontroller - * model. - */ - #define INTERNAL_SERIAL_START_ADDRESS 0x0E - #else - #define USE_INTERNAL_SERIAL NO_DESCRIPTOR - - #define INTERNAL_SERIAL_LENGTH_BITS 0 - #define INTERNAL_SERIAL_START_ADDRESS 0 - #endif - - /* Function Prototypes: */ - /** Sends a Remote Wakeup request to the host. This signals to the host that the device should - * be taken out of suspended mode, and communications should resume. - * - * Typically, this is implemented so that HID devices (mice, keyboards, etc.) can wake up the - * host computer when the host has suspended all USB devices to enter a low power state. - * - * \attention This function should only be used if the device has indicated to the host that it - * supports the Remote Wakeup feature in the device descriptors, and should only be - * issued if the host is currently allowing remote wakeup events from the device (i.e., - * the \ref USB_Device_RemoteWakeupEnabled flag is set). When the \c NO_DEVICE_REMOTE_WAKEUP - * compile time option is used, this function is unavailable. - * \n\n - * - * \attention The USB clock must be running for this function to operate. If the stack is initialized with - * the \ref USB_OPT_MANUAL_PLL option enabled, the user must ensure that the PLL is running - * before attempting to call this function. - * - * \see \ref Group_StdDescriptors for more information on the RMWAKEUP feature and device descriptors. - */ - void USB_Device_SendRemoteWakeup(void); - - /* Inline Functions: */ - /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) - * the frame number is incremented by one. - * - * \return Current USB frame number from the USB controller. - */ - static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint16_t USB_Device_GetFrameNumber(void) - { - return UDFNUM; - } - - #if !defined(NO_SOF_EVENTS) - /** Enables the device mode Start Of Frame events. When enabled, this causes the - * \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, - * at the start of each USB frame when enumerated in device mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_EnableSOFEvents(void) - { - USB_INT_Enable(USB_INT_SOFI); - } - - /** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the - * \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_DisableSOFEvents(void) - { - USB_INT_Disable(USB_INT_SOFI); - } - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Inline Functions: */ - #if defined(USB_DEVICE_OPT_LOWSPEED) - static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetLowSpeed(void) - { - UDCON |= (1 << LSM); - } - - static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetFullSpeed(void) - { - UDCON &= ~(1 << LSM); - } - #endif - - static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetDeviceAddress(const uint8_t Address) - { - uint8_t Temp = (UDADDR & (1 << ADDEN)) | (Address & 0x7F); - - UDADDR = Temp; - UDADDR = Temp | (1 << ADDEN); - } - - static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_Device_IsAddressSet(void) - { - return (UDADDR & (1 << ADDEN)); - } - - #if (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) - static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) ATTR_NON_NULL_PTR_ARG(1); - static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) - { - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - uint8_t SigReadAddress = INTERNAL_SERIAL_START_ADDRESS; - - for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) - { - uint8_t SerialByte = boot_signature_byte_get(SigReadAddress); - - if (SerialCharNum & 0x01) - { - SerialByte >>= 4; - SigReadAddress++; - } - - SerialByte &= 0x0F; - - UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? - (('A' - 10) + SerialByte) : ('0' + SerialByte)); - } - - SetGlobalInterruptMask(CurrentGlobalInt); - } - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c deleted file mode 100644 index 7563ed35ab..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "EndpointStream_AVR8.h" - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" -#endif - -#endif - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" -#endif - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h deleted file mode 100644 index 77c9c82fe3..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h +++ /dev/null @@ -1,648 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management for the AVR8 microcontrollers. - * \copydetails Group_EndpointStreamRW_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointStreamRW - * \defgroup Group_EndpointStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) - * \brief Endpoint data stream transmission and reception management for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_AVR8_H__ -#define __ENDPOINT_STREAM_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the currently selected endpoint's bank, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of bytes to discard via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending - * full packets to the host as needed. The last packet is not automatically sent once the - * remaining bytes have been written; the user is responsible for manually sending the last - * packet to the host via the \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of zero bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the status OUT packet - * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the status OUT packet - * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for EEPROM source/destination data */ - //@{ - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for PROGMEM source/destination data */ - //@{ - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c deleted file mode 100644 index 0002a256d5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "../Endpoint.h" - -#if !defined(FIXED_CONTROL_ENDPOINT_SIZE) -uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE; -#endif - -bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, - const uint8_t Entries) -{ - for (uint8_t i = 0; i < Entries; i++) - { - if (!(Table[i].Address)) - continue; - - if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks))) - return false; - } - - return true; -} - -bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, - const uint8_t UECFG0XData, - const uint8_t UECFG1XData) -{ -#if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG) - Endpoint_SelectEndpoint(Number); - Endpoint_EnableEndpoint(); - - UECFG1X = 0; - UECFG0X = UECFG0XData; - UECFG1X = UECFG1XData; - - return Endpoint_IsConfigured(); -#else - for (uint8_t EPNum = Number; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) - { - uint8_t UECFG0XTemp; - uint8_t UECFG1XTemp; - uint8_t UEIENXTemp; - - Endpoint_SelectEndpoint(EPNum); - - if (EPNum == Number) - { - UECFG0XTemp = UECFG0XData; - UECFG1XTemp = UECFG1XData; - UEIENXTemp = 0; - } - else - { - UECFG0XTemp = UECFG0X; - UECFG1XTemp = UECFG1X; - UEIENXTemp = UEIENX; - } - - if (!(UECFG1XTemp & (1 << ALLOC))) - continue; - - Endpoint_DisableEndpoint(); - UECFG1X &= ~(1 << ALLOC); - - Endpoint_EnableEndpoint(); - UECFG0X = UECFG0XTemp; - UECFG1X = UECFG1XTemp; - UEIENX = UEIENXTemp; - - if (!(Endpoint_IsConfigured())) - return false; - } - - Endpoint_SelectEndpoint(Number); - return true; -#endif -} - -void Endpoint_ClearEndpoints(void) -{ - UEINT = 0; - - for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) - { - Endpoint_SelectEndpoint(EPNum); - UEIENX = 0; - UEINTX = 0; - UECFG1X = 0; - Endpoint_DisableEndpoint(); - } -} - -void Endpoint_ClearStatusStage(void) -{ - if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) - { - while (!(Endpoint_IsOUTReceived())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - Endpoint_ClearOUT(); - } - else - { - while (!(Endpoint_IsINReady())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - Endpoint_ClearIN(); - } -} - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_WaitUntilReady(void) -{ - #if (USB_STREAM_TIMEOUT_MS < 0xFF) - uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #else - uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #endif - - uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber(); - - for (;;) - { - if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) - { - if (Endpoint_IsINReady()) - return ENDPOINT_READYWAIT_NoError; - } - else - { - if (Endpoint_IsOUTReceived()) - return ENDPOINT_READYWAIT_NoError; - } - - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_READYWAIT_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_READYWAIT_BusSuspended; - else if (Endpoint_IsStalled()) - return ENDPOINT_READYWAIT_EndpointStalled; - - uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return ENDPOINT_READYWAIT_Timeout; - } - } -} -#endif - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h deleted file mode 100644 index 08944babc4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h +++ /dev/null @@ -1,819 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Endpoint definitions for the AVR8 microcontrollers. - * \copydetails Group_EndpointManagement_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointRW - * \defgroup Group_EndpointRW_AVR8 Endpoint Data Reading and Writing (AVR8) - * \brief Endpoint data read/write definitions for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. - */ - -/** \ingroup Group_EndpointPrimitiveRW - * \defgroup Group_EndpointPrimitiveRW_AVR8 Read/Write of Primitive Data Types (AVR8) - * \brief Endpoint primitive read/write definitions for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to endpoints. - */ - -/** \ingroup Group_EndpointPacketManagement - * \defgroup Group_EndpointPacketManagement_AVR8 Endpoint Packet Management (AVR8) - * \brief Endpoint packet management definitions for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to packet management of endpoints. - */ - -/** \ingroup Group_EndpointManagement - * \defgroup Group_EndpointManagement_AVR8 Endpoint Management (AVR8) - * \brief Endpoint management definitions for the Atmel AVR8 architecture. - * - * Functions, macros and enums related to endpoint management when in USB Device mode. This - * module contains the endpoint management macros, as well as endpoint interrupt and data - * send/receive functions for various data types. - * - * @{ - */ - -#ifndef __ENDPOINT_AVR8_H__ -#define __ENDPOINT_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBTask.h" - #include "../USBInterrupt.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Inline Functions: */ - static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST - ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) - { - uint8_t MaskVal = 0; - uint16_t CheckBytes = 8; - - while (CheckBytes < Bytes) - { - MaskVal++; - CheckBytes <<= 1; - } - - return (MaskVal << EPSIZE0); - } - - /* Function Prototypes: */ - void Endpoint_ClearEndpoints(void); - bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, - const uint8_t UECFG0XData, - const uint8_t UECFG1XData); - - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) - /** Default size of the default control endpoint's bank, until altered by the control endpoint bank size - * value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined. - */ - #define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 - #endif - - #if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__) - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - #define ENDPOINT_TOTAL_ENDPOINTS 7 - #else - /** Total number of endpoints (including the default control endpoint at address 0) which may - * be used in the device. Different USB AVR models support different amounts of endpoints, - * this value reflects the maximum number of endpoints for the currently selected AVR model. - */ - #define ENDPOINT_TOTAL_ENDPOINTS 5 - #endif - #else - #define ENDPOINT_TOTAL_ENDPOINTS 1 - #endif - - /* Enums: */ - /** Enum for the possible error return codes of the \ref Endpoint_WaitUntilReady() function. - * - * \ingroup Group_EndpointRW_AVR8 - */ - enum Endpoint_WaitUntilReady_ErrorCodes_t - { - ENDPOINT_READYWAIT_NoError = 0, /**< Endpoint is ready for next packet, no error. */ - ENDPOINT_READYWAIT_EndpointStalled = 1, /**< The endpoint was stalled during the stream - * transfer by the host or device. - */ - ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while - * waiting for the endpoint to become ready. - */ - ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and - * no USB endpoint traffic can occur until the bus - * has resumed. - */ - ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - }; - - /* Inline Functions: */ - /** Configures the specified endpoint address with the given endpoint type, bank size and number of hardware - * banks. Once configured, the endpoint may be read from or written to, depending on its direction. - * - * \param[in] Address Endpoint address to configure. - * - * \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types - * are available on Low Speed USB devices - refer to the USB 2.0 specification. - * - * \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted - * to the USB host, or after they have been received from the USB host (depending on - * the endpoint's data direction). The bank size must indicate the maximum packet size - * that the endpoint can handle. - * - * \param[in] Banks Number of banks to use for the endpoint being configured. - * - * \attention When the \c ORDERED_EP_CONFIG compile time option is used, Endpoints must be configured in - * ascending order, or bank corruption will occur. - * - * \note Different endpoints may have different maximum packet sizes based on the endpoint's index - please - * refer to the chosen microcontroller model's datasheet to determine the maximum bank size for each endpoint. - * \n\n - * - * \note The default control endpoint should not be manually configured by the user application, as - * it is automatically configured by the library internally. - * \n\n - * - * \note This routine will automatically select the specified endpoint upon success. Upon failure, the endpoint - * which failed to reconfigure correctly will be selected. - * - * \return Boolean \c true if the configuration succeeded, \c false otherwise. - */ - static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, - const uint8_t Type, - const uint16_t Size, - const uint8_t Banks) ATTR_ALWAYS_INLINE; - static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, - const uint8_t Type, - const uint16_t Size, - const uint8_t Banks) - { - uint8_t Number = (Address & ENDPOINT_EPNUM_MASK); - - if (Number >= ENDPOINT_TOTAL_ENDPOINTS) - return false; - - return Endpoint_ConfigureEndpoint_Prv(Number, - ((Type << EPTYPE0) | ((Address & ENDPOINT_DIR_IN) ? (1 << EPDIR) : 0)), - ((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Endpoint_BytesToEPSizeMask(Size))); - } - - /** Indicates the number of bytes currently stored in the current endpoint's selected bank. - * - * \ingroup Group_EndpointRW_AVR8 - * - * \return Total number of bytes in the currently selected Endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_BytesInEndpoint(void) - { - #if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) && !defined(__AVR_ATmega32U6__) - return UEBCX; - #elif defined(USB_SERIES_4_AVR) || defined(__AVR_ATmega32U6__) - return (((uint16_t)UEBCHX << 8) | UEBCLX); - #elif defined(USB_SERIES_2_AVR) - return UEBCLX; - #endif - } - - /** Determines the currently selected endpoint's direction. - * - * \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask. - */ - static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_GetEndpointDirection(void) - { - return (UECFG0X & (1 << EPDIR)) ? ENDPOINT_DIR_IN : ENDPOINT_DIR_OUT; - } - - /** Get the endpoint address of the currently selected endpoint. This is typically used to save - * the currently selected endpoint so that it can be restored after another endpoint has been - * manipulated. - * - * \return Index of the currently selected endpoint. - */ - static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_GetCurrentEndpoint(void) - { - #if !defined(CONTROL_ONLY_DEVICE) - return ((UENUM & ENDPOINT_EPNUM_MASK) | Endpoint_GetEndpointDirection()); - #else - return ENDPOINT_CONTROLEP; - #endif - } - - /** Selects the given endpoint address. - * - * Any endpoint operations which do not require the endpoint address to be indicated will operate on - * the currently selected endpoint. - * - * \param[in] Address Endpoint address to select. - */ - static inline void Endpoint_SelectEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Endpoint_SelectEndpoint(const uint8_t Address) - { - #if !defined(CONTROL_ONLY_DEVICE) - UENUM = (Address & ENDPOINT_EPNUM_MASK); - #endif - } - - /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's - * data In and Out pointers to the bank's contents. - * - * \param[in] Address Endpoint address whose FIFO buffers are to be reset. - */ - static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ResetEndpoint(const uint8_t Address) - { - UERST = (1 << (Address & ENDPOINT_EPNUM_MASK)); - UERST = 0; - } - - /** Enables the currently selected endpoint so that data can be sent and received through it to - * and from a host. - * - * \note Endpoints must first be configured properly via \ref Endpoint_ConfigureEndpoint(). - */ - static inline void Endpoint_EnableEndpoint(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_EnableEndpoint(void) - { - UECONX |= (1 << EPEN); - } - - /** Disables the currently selected endpoint so that data cannot be sent and received through it - * to and from a host. - */ - static inline void Endpoint_DisableEndpoint(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_DisableEndpoint(void) - { - UECONX &= ~(1 << EPEN); - } - - /** Determines if the currently selected endpoint is enabled, but not necessarily configured. - * - * \return Boolean \c true if the currently selected endpoint is enabled, \c false otherwise. - */ - static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsEnabled(void) - { - return ((UECONX & (1 << EPEN)) ? true : false); - } - - /** Retrieves the number of busy banks in the currently selected endpoint, which have been queued for - * transmission via the \ref Endpoint_ClearIN() command, or are awaiting acknowledgement via the - * \ref Endpoint_ClearOUT() command. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \return Total number of busy banks in the selected endpoint. - */ - static inline uint8_t Endpoint_GetBusyBanks(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Endpoint_GetBusyBanks(void) - { - return (UESTA0X & (0x03 << NBUSYBK0)); - } - - /** Aborts all pending IN transactions on the currently selected endpoint, once the bank - * has been queued for transmission to the host via \ref Endpoint_ClearIN(). This function - * will terminate all queued transactions, resetting the endpoint banks ready for a new - * packet. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - */ - static inline void Endpoint_AbortPendingIN(void) - { - while (Endpoint_GetBusyBanks() != 0) - { - UEINTX |= (1 << RXOUTI); - while (UEINTX & (1 << RXOUTI)); - } - } - - /** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint - * bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN - * direction). This function will return false if an error has occurred in the endpoint, if the endpoint - * is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN - * direction and the endpoint bank is full. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \return Boolean \c true if the currently selected endpoint may be read from or written to, depending - * on its direction. - */ - static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsReadWriteAllowed(void) - { - return ((UEINTX & (1 << RWAL)) ? true : false); - } - - /** Determines if the currently selected endpoint is configured. - * - * \return Boolean \c true if the currently selected endpoint has been configured, \c false otherwise. - */ - static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsConfigured(void) - { - return ((UESTA0X & (1 << CFGOK)) ? true : false); - } - - /** Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their - * interrupt duration has elapsed. Which endpoints have interrupted can be determined by - * masking the return value against (1 << {Endpoint Number}). - * - * \return Mask whose bits indicate which endpoints have interrupted. - */ - static inline uint8_t Endpoint_GetEndpointInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_GetEndpointInterrupts(void) - { - return UEINT; - } - - /** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type - * endpoints). - * - * \param[in] Address Address of the endpoint whose interrupt flag should be tested. - * - * \return Boolean \c true if the specified endpoint has interrupted, \c false otherwise. - */ - static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address) - { - return ((Endpoint_GetEndpointInterrupts() & (1 << (Address & ENDPOINT_EPNUM_MASK))) ? true : false); - } - - /** Determines if the selected IN endpoint is ready for a new packet to be sent to the host. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \return Boolean \c true if the current endpoint is ready for an IN packet, \c false otherwise. - */ - static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsINReady(void) - { - return ((UEINTX & (1 << TXINI)) ? true : false); - } - - /** Determines if the selected OUT endpoint has received new packet from the host. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \return Boolean \c true if current endpoint is has received an OUT packet, \c false otherwise. - */ - static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsOUTReceived(void) - { - return ((UEINTX & (1 << RXOUTI)) ? true : false); - } - - /** Determines if the current CONTROL type endpoint has received a SETUP packet. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \return Boolean \c true if the selected endpoint has received a SETUP packet, \c false otherwise. - */ - static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsSETUPReceived(void) - { - return ((UEINTX & (1 << RXSTPI)) ? true : false); - } - - /** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the - * endpoint for the next packet. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \note This is not applicable for non CONTROL type endpoints. - */ - static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearSETUP(void) - { - UEINTX &= ~(1 << RXSTPI); - } - - /** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the - * next packet and switching to the alternative endpoint bank if double banked. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - */ - static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearIN(void) - { - #if !defined(CONTROL_ONLY_DEVICE) - UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); - #else - UEINTX &= ~(1 << TXINI); - #endif - } - - /** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint - * for the next packet and switching to the alternative endpoint bank if double banked. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - */ - static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearOUT(void) - { - #if !defined(CONTROL_ONLY_DEVICE) - UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); - #else - UEINTX &= ~(1 << RXOUTI); - #endif - } - - /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the - * indicated endpoint and that the current transfer sequence should be aborted. This provides a - * way for devices to indicate invalid commands to the host so that the current transfer can be - * aborted and the host can begin its own recovery sequence. - * - * The currently selected endpoint remains stalled until either the \ref Endpoint_ClearStall() macro - * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected - * endpoint. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - */ - static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_StallTransaction(void) - { - UECONX |= (1 << STALLRQ); - } - - /** Clears the STALL condition on the currently selected endpoint. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - */ - static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearStall(void) - { - UECONX |= (1 << STALLRQC); - } - - /** Determines if the currently selected endpoint is stalled, false otherwise. - * - * \ingroup Group_EndpointPacketManagement_AVR8 - * - * \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise. - */ - static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsStalled(void) - { - return ((UECONX & (1 << STALLRQ)) ? true : false); - } - - /** Resets the data toggle of the currently selected endpoint. */ - static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ResetDataToggle(void) - { - UECONX |= (1 << RSTDT); - } - - /** Sets the direction of the currently selected endpoint. - * - * \param[in] DirectionMask New endpoint direction, as a \c ENDPOINT_DIR_* mask. - */ - static inline void Endpoint_SetEndpointDirection(const uint8_t DirectionMask) ATTR_ALWAYS_INLINE; - static inline void Endpoint_SetEndpointDirection(const uint8_t DirectionMask) - { - UECFG0X = ((UECFG0X & ~(1 << EPDIR)) | (DirectionMask ? (1 << EPDIR) : 0)); - } - - /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \return Next byte in the currently selected endpoint's FIFO buffer. - */ - static inline uint8_t Endpoint_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_Read_8(void) - { - return UEDATX; - } - - /** Writes one byte to the currently selected endpoint's bank, for IN direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \param[in] Data Data to write into the the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_8(const uint8_t Data) - { - UEDATX = Data; - } - - /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - */ - static inline void Endpoint_Discard_8(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_8(void) - { - uint8_t Dummy; - - Dummy = UEDATX; - - (void)Dummy; - } - - /** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \return Next two bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_Read_16_LE(void) - { - union - { - uint16_t Value; - uint8_t Bytes[2]; - } Data; - - Data.Bytes[0] = UEDATX; - Data.Bytes[1] = UEDATX; - - return Data.Value; - } - - /** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \return Next two bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_Read_16_BE(void) - { - union - { - uint16_t Value; - uint8_t Bytes[2]; - } Data; - - Data.Bytes[1] = UEDATX; - Data.Bytes[0] = UEDATX; - - return Data.Value; - } - - /** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_16_LE(const uint16_t Data) - { - UEDATX = (Data & 0xFF); - UEDATX = (Data >> 8); - } - - /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_16_BE(const uint16_t Data) - { - UEDATX = (Data >> 8); - UEDATX = (Data & 0xFF); - } - - /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - */ - static inline void Endpoint_Discard_16(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_16(void) - { - uint8_t Dummy; - - Dummy = UEDATX; - Dummy = UEDATX; - - (void)Dummy; - } - - /** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \return Next four bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_Read_32_LE(void) - { - union - { - uint32_t Value; - uint8_t Bytes[4]; - } Data; - - Data.Bytes[0] = UEDATX; - Data.Bytes[1] = UEDATX; - Data.Bytes[2] = UEDATX; - Data.Bytes[3] = UEDATX; - - return Data.Value; - } - - /** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \return Next four bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint32_t Endpoint_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_Read_32_BE(void) - { - union - { - uint32_t Value; - uint8_t Bytes[4]; - } Data; - - Data.Bytes[3] = UEDATX; - Data.Bytes[2] = UEDATX; - Data.Bytes[1] = UEDATX; - Data.Bytes[0] = UEDATX; - - return Data.Value; - } - - /** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_32_LE(const uint32_t Data) - { - UEDATX = (Data & 0xFF); - UEDATX = (Data >> 8); - UEDATX = (Data >> 16); - UEDATX = (Data >> 24); - } - - /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_32_BE(const uint32_t Data) - { - UEDATX = (Data >> 24); - UEDATX = (Data >> 16); - UEDATX = (Data >> 8); - UEDATX = (Data & 0xFF); - } - - /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_AVR8 - */ - static inline void Endpoint_Discard_32(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_32(void) - { - uint8_t Dummy; - - Dummy = UEDATX; - Dummy = UEDATX; - Dummy = UEDATX; - Dummy = UEDATX; - - (void)Dummy; - } - - /* External Variables: */ - /** Global indicating the maximum packet size of the default control endpoint located at address - * 0 in the device. This value is set to the value indicated in the device descriptor in the user - * project once the USB interface is initialized into device mode. - * - * If space is an issue, it is possible to fix this to a static value by defining the control - * endpoint size in the \c FIXED_CONTROL_ENDPOINT_SIZE token passed to the compiler in the makefile - * via the -D switch. When a fixed control endpoint size is used, the size is no longer dynamically - * read from the descriptors at runtime and instead fixed to the given value. When used, it is - * important that the descriptor control endpoint size value matches the size given as the - * \c FIXED_CONTROL_ENDPOINT_SIZE token - it is recommended that the \c FIXED_CONTROL_ENDPOINT_SIZE token - * be used in the device descriptors to ensure this. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) - extern uint8_t USB_Device_ControlEndpointSize; - #else - #define USB_Device_ControlEndpointSize FIXED_CONTROL_ENDPOINT_SIZE - #endif - - /* Function Prototypes: */ - /** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple - * endpoints at the same time. - * - * \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the - * control endpoint. - * - * \param[in] Table Pointer to a table of endpoint descriptions. - * \param[in] Entries Number of entries in the endpoint table to configure. - * - * \return Boolean \c true if all endpoints configured successfully, \c false otherwise. - */ - bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, - const uint8_t Entries); - - /** Completes the status stage of a control transfer on a CONTROL type endpoint automatically, - * with respect to the data direction. This is a convenience function which can be used to - * simplify user control request handling. - * - * \note This routine should not be called on non CONTROL type endpoints. - */ - void Endpoint_ClearStatusStage(void); - - /** Spin-loops until the currently selected non-control endpoint is ready for the next packet of data - * to be read or written to it. - * - * \note This routine should not be called on CONTROL type endpoints. - * - * \ingroup Group_EndpointRW_AVR8 - * - * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t Endpoint_WaitUntilReady(void); - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c deleted file mode 100644 index d932683374..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_HOST_C -#include "../Host.h" - -void USB_Host_ProcessNextHostState(void) -{ - uint8_t ErrorCode = HOST_ENUMERROR_NoError; - uint8_t SubErrorCode = HOST_ENUMERROR_NoError; - - static uint16_t WaitMSRemaining; - static uint8_t PostWaitState; - - switch (USB_HostState) - { - case HOST_STATE_WaitForDevice: - if (WaitMSRemaining) - { - if ((SubErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) - { - USB_HostState = PostWaitState; - ErrorCode = HOST_ENUMERROR_WaitStage; - break; - } - - if (!(--WaitMSRemaining)) - USB_HostState = PostWaitState; - } - - break; - case HOST_STATE_Powered: - WaitMSRemaining = HOST_DEVICE_SETTLE_DELAY_MS; - - USB_HostState = HOST_STATE_Powered_WaitForDeviceSettle; - break; - case HOST_STATE_Powered_WaitForDeviceSettle: - if (WaitMSRemaining--) - { - Delay_MS(1); - break; - } - else - { - USB_Host_VBUS_Manual_Off(); - - USB_OTGPAD_On(); - USB_Host_VBUS_Auto_Enable(); - USB_Host_VBUS_Auto_On(); - - #if defined(NO_AUTO_VBUS_MANAGEMENT) - USB_Host_VBUS_Manual_Enable(); - USB_Host_VBUS_Manual_On(); - #endif - - USB_HostState = HOST_STATE_Powered_WaitForConnect; - } - - break; - case HOST_STATE_Powered_WaitForConnect: - if (USB_INT_HasOccurred(USB_INT_DCONNI)) - { - USB_INT_Clear(USB_INT_DCONNI); - USB_INT_Clear(USB_INT_DDISCI); - - USB_INT_Clear(USB_INT_VBERRI); - USB_INT_Enable(USB_INT_VBERRI); - - USB_Host_ResumeBus(); - Pipe_ClearPipes(); - - HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Powered_DoReset); - } - - break; - case HOST_STATE_Powered_DoReset: - USB_Host_ResetDevice(); - - HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe); - break; - case HOST_STATE_Powered_ConfigPipe: - if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, PIPE_CONTROLPIPE_DEFAULT_SIZE, 1))) - { - ErrorCode = HOST_ENUMERROR_PipeConfigError; - SubErrorCode = 0; - break; - } - - USB_HostState = HOST_STATE_Default; - break; - case HOST_STATE_Default: - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetDescriptor, - .wValue = (DTYPE_Device << 8), - .wIndex = 0, - .wLength = 8, - }; - - uint8_t DataBuffer[8]; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful) - { - ErrorCode = HOST_ENUMERROR_ControlError; - break; - } - - USB_Host_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, Endpoint0Size)]; - - USB_Host_ResetDevice(); - - HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset); - break; - case HOST_STATE_Default_PostReset: - if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, USB_Host_ControlPipeSize, 1))) - { - ErrorCode = HOST_ENUMERROR_PipeConfigError; - SubErrorCode = 0; - break; - } - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_SetAddress, - .wValue = USB_HOST_DEVICEADDRESS, - .wIndex = 0, - .wLength = 0, - }; - - if ((SubErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) - { - ErrorCode = HOST_ENUMERROR_ControlError; - break; - } - - HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Default_PostAddressSet); - break; - case HOST_STATE_Default_PostAddressSet: - USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS); - - USB_HostState = HOST_STATE_Addressed; - - EVENT_USB_Host_DeviceEnumerationComplete(); - break; - } - - if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached)) - { - EVENT_USB_Host_DeviceEnumerationFailed(ErrorCode, SubErrorCode); - - USB_Host_VBUS_Auto_Off(); - - EVENT_USB_Host_DeviceUnattached(); - - USB_ResetInterface(); - } -} - -uint8_t USB_Host_WaitMS(uint8_t MS) -{ - bool BusSuspended = USB_Host_IsBusSuspended(); - uint8_t ErrorCode = HOST_WAITERROR_Successful; - bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); - - USB_INT_Disable(USB_INT_HSOFI); - USB_INT_Clear(USB_INT_HSOFI); - - USB_Host_ResumeBus(); - - while (MS) - { - if (USB_INT_HasOccurred(USB_INT_HSOFI)) - { - USB_INT_Clear(USB_INT_HSOFI); - MS--; - } - - if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host)) - { - ErrorCode = HOST_WAITERROR_DeviceDisconnect; - - break; - } - - if (Pipe_IsError()) - { - Pipe_ClearError(); - ErrorCode = HOST_WAITERROR_PipeError; - - break; - } - - if (Pipe_IsStalled()) - { - Pipe_ClearStall(); - ErrorCode = HOST_WAITERROR_SetupStalled; - - break; - } - } - - if (BusSuspended) - USB_Host_SuspendBus(); - - if (HSOFIEnabled) - USB_INT_Enable(USB_INT_HSOFI); - - return ErrorCode; -} - -static void USB_Host_ResetDevice(void) -{ - bool BusSuspended = USB_Host_IsBusSuspended(); - - USB_INT_Disable(USB_INT_DDISCI); - - USB_Host_ResetBus(); - while (!(USB_Host_IsBusResetComplete())); - USB_Host_ResumeBus(); - - USB_Host_ConfigurationNumber = 0; - - bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); - - USB_INT_Disable(USB_INT_HSOFI); - USB_INT_Clear(USB_INT_HSOFI); - - for (uint8_t MSRem = 10; MSRem != 0; MSRem--) - { - /* Workaround for powerless-pull-up devices. After a USB bus reset, - all disconnection interrupts are suppressed while a USB frame is - looked for - if it is found within 10ms, the device is still - present. */ - - if (USB_INT_HasOccurred(USB_INT_HSOFI)) - { - USB_INT_Clear(USB_INT_HSOFI); - USB_INT_Clear(USB_INT_DDISCI); - break; - } - - Delay_MS(1); - } - - if (HSOFIEnabled) - USB_INT_Enable(USB_INT_HSOFI); - - if (BusSuspended) - USB_Host_SuspendBus(); - - USB_INT_Enable(USB_INT_DDISCI); -} - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h deleted file mode 100644 index f8d92f81f6..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h +++ /dev/null @@ -1,372 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Host definitions for the AVR8 microcontrollers. - * \copydetails Group_Host_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_Host - * \defgroup Group_Host_AVR8 Host Management (AVR8) - * \brief USB Host definitions for the AVR8 microcontrollers. - * - * Architecture specific USB Host definitions for the Atmel 8-bit AVR microcontrollers. - * - * @{ - */ - -#ifndef __USBHOST_AVR8_H__ -#define __USBHOST_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../StdDescriptors.h" - #include "../Pipe.h" - #include "../USBInterrupt.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - #if defined(INVERTED_VBUS_ENABLE_LINE) && !defined(NO_AUTO_VBUS_MANAGEMENT) - #error The INVERTED_VBUS_ENABLE_LINE compile option requires NO_AUTO_VBUS_MANAGEMENT for the AVR8 architecture. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Indicates the fixed USB device address which any attached device is enumerated to when in - * host mode. As only one USB device may be attached to the AVR in host mode at any one time - * and that the address used is not important (other than the fact that it is non-zero), a - * fixed value is specified by the library. - */ - #define USB_HOST_DEVICEADDRESS 1 - - #if !defined(HOST_DEVICE_SETTLE_DELAY_MS) || defined(__DOXYGEN__) - /** Constant for the delay in milliseconds after a device is connected before the library - * will start the enumeration process. Some devices require a delay of up to 5 seconds - * after connection before the enumeration process can start or incorrect operation will - * occur. - * - * The default delay value may be overridden in the user project makefile by defining the - * \c HOST_DEVICE_SETTLE_DELAY_MS token to the required delay in milliseconds, and passed to the - * compiler using the -D switch. - */ - #define HOST_DEVICE_SETTLE_DELAY_MS 1000 - #endif - - /** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event. - * - * \see \ref Group_Events for more information on this event. - */ - enum USB_Host_ErrorCodes_t - { - HOST_ERROR_VBusVoltageDip = 0, /**< VBUS voltage dipped to an unacceptable level. This - * error may be the result of an attached device drawing - * too much current from the VBUS line, or due to the - * AVR's power source being unable to supply sufficient - * current. - */ - }; - - /** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event. - * - * \see \ref Group_Events for more information on this event. - */ - enum USB_Host_EnumerationErrorCodes_t - { - HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid - * ErrorCode parameter value for the \ref EVENT_USB_Host_DeviceEnumerationFailed() - * event. - */ - HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed - * to complete successfully, due to a timeout or other - * error. - */ - HOST_ENUMERROR_NoDeviceDetected = 2, /**< No device was detected, despite the USB data lines - * indicating the attachment of a device. - */ - HOST_ENUMERROR_ControlError = 3, /**< One of the enumeration control requests failed to - * complete successfully. - */ - HOST_ENUMERROR_PipeConfigError = 4, /**< The default control pipe (address 0) failed to - * configure correctly. - */ - }; - - /* Inline Functions: */ - /** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended) - * the frame number is incremented by one. - * - * \return Current USB frame number from the USB controller. - */ - static inline uint16_t USB_Host_GetFrameNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t USB_Host_GetFrameNumber(void) - { - return UHFNUM; - } - - #if !defined(NO_SOF_EVENTS) - /** Enables the host mode Start Of Frame events. When enabled, this causes the - * \ref EVENT_USB_Host_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, - * at the start of each USB frame when a device is enumerated while in host mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Host_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_EnableSOFEvents(void) - { - USB_INT_Enable(USB_INT_HSOFI); - } - - /** Disables the host mode Start Of Frame events. When disabled, this stops the firing of the - * \ref EVENT_USB_Host_StartOfFrame() event when enumerated in host mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Host_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_DisableSOFEvents(void) - { - USB_INT_Disable(USB_INT_HSOFI); - } - #endif - - /** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host. - * USB bus resets leave the default control pipe configured (if already configured). - * - * If the USB bus has been suspended prior to issuing a bus reset, the attached device will be - * woken up automatically and the bus resumed after the reset has been correctly issued. - */ - static inline void USB_Host_ResetBus(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ResetBus(void) - { - UHCON |= (1 << RESET); - } - - /** Determines if a previously issued bus reset (via the \ref USB_Host_ResetBus() macro) has - * completed. - * - * \return Boolean \c true if no bus reset is currently being sent, \c false otherwise. - */ - static inline bool USB_Host_IsBusResetComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsBusResetComplete(void) - { - return ((UHCON & (1 << RESET)) ? false : true); - } - - /** Resumes USB communications with an attached and enumerated device, by resuming the transmission - * of the 1MS Start Of Frame messages to the device. When resumed, USB communications between the - * host and attached device may occur. - */ - static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ResumeBus(void) - { - UHCON |= (1 << SOFEN); - } - - /** Suspends the USB bus, preventing any communications from occurring between the host and attached - * device until the bus has been resumed. This stops the transmission of the 1MS Start Of Frame - * messages to the device. - * - * \attention While the USB bus is suspended, all USB interrupt sources are also disabled; this means that - * some events (such as device disconnections) will not fire until the bus is resumed. - */ - static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_SuspendBus(void) - { - UHCON &= ~(1 << SOFEN); - } - - /** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro, - * false otherwise. While suspended, no USB communications can occur until the bus is resumed, - * except for the Remote Wakeup event from the device if supported. - * - * \return Boolean \c true if the bus is currently suspended, \c false otherwise. - */ - static inline bool USB_Host_IsBusSuspended(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsBusSuspended(void) - { - return ((UHCON & (1 << SOFEN)) ? false : true); - } - - /** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or - * false if the attached device is enumerated in Low Speed mode (1.5Mb/s). - * - * \return Boolean \c true if the attached device is enumerated in Full Speed mode, \c false otherwise. - */ - static inline bool USB_Host_IsDeviceFullSpeed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsDeviceFullSpeed(void) - { - return ((USBSTA & (1 << SPEED)) ? true : false); - } - - /** Determines if the attached device is currently issuing a Remote Wakeup request, requesting - * that the host resume the USB bus and wake up the device, false otherwise. - * - * \return Boolean \c true if the attached device has sent a Remote Wakeup request, \c false otherwise. - */ - static inline bool USB_Host_IsRemoteWakeupSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsRemoteWakeupSent(void) - { - return ((UHINT & (1 << RXRSMI)) ? true : false); - } - - /** Clears the flag indicating that a Remote Wakeup request has been issued by an attached device. */ - static inline void USB_Host_ClearRemoteWakeupSent(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ClearRemoteWakeupSent(void) - { - UHINT &= ~(1 << RXRSMI); - } - - /** Accepts a Remote Wakeup request from an attached device. This must be issued in response to - * a device's Remote Wakeup request within 2ms for the request to be accepted and the bus to - * be resumed. - */ - static inline void USB_Host_ResumeFromWakeupRequest(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ResumeFromWakeupRequest(void) - { - UHCON |= (1 << RESUME); - } - - /** Determines if a resume from Remote Wakeup request is currently being sent to an attached - * device. - * - * \return Boolean \c true if no resume request is currently being sent, \c false otherwise. - */ - static inline bool USB_Host_IsResumeFromWakeupRequestSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsResumeFromWakeupRequestSent(void) - { - return ((UHCON & (1 << RESUME)) ? false : true); - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - static inline void USB_Host_HostMode_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_HostMode_On(void) - { - USBCON |= (1 << HOST); - } - - static inline void USB_Host_HostMode_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_HostMode_Off(void) - { - USBCON &= ~(1 << HOST); - } - - static inline void USB_Host_VBUS_Auto_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Auto_Enable(void) - { - OTGCON &= ~(1 << VBUSHWC); - UHWCON |= (1 << UVCONE); - } - - static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Manual_Enable(void) - { - OTGCON |= (1 << VBUSHWC); - UHWCON &= ~(1 << UVCONE); - - DDRE |= (1 << 7); - } - - static inline void USB_Host_VBUS_Auto_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Auto_On(void) - { - OTGCON |= (1 << VBUSREQ); - } - - static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Manual_On(void) - { - #if defined(INVERTED_VBUS_ENABLE_LINE) - PORTE &= ~(1 << 7); - #else - PORTE |= (1 << 7); - #endif - } - - static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Auto_Off(void) - { - OTGCON |= (1 << VBUSRQC); - } - - static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Manual_Off(void) - { - #if defined(INVERTED_VBUS_ENABLE_LINE) - PORTE |= (1 << 7); - #else - PORTE &= ~(1 << 7); - #endif - } - - static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void USB_Host_SetDeviceAddress(const uint8_t Address) - { - UHADDR = (Address & 0x7F); - } - - /* Enums: */ - enum USB_Host_WaitMSErrorCodes_t - { - HOST_WAITERROR_Successful = 0, - HOST_WAITERROR_DeviceDisconnect = 1, - HOST_WAITERROR_PipeError = 2, - HOST_WAITERROR_SetupStalled = 3, - }; - - /* Function Prototypes: */ - void USB_Host_ProcessNextHostState(void); - uint8_t USB_Host_WaitMS(uint8_t MS); - - #if defined(__INCLUDE_FROM_HOST_C) - static void USB_Host_ResetDevice(void); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h deleted file mode 100644 index 5296beb6aa..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB OTG definitions for the AVR8 microcontrollers. - * \copydetails Group_OTG_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_OTG - * \defgroup Group_OTG_AVR8 USB On The Go (OTG) Management (AVR8) - * \brief USB OTG definitions for the AVR8 microcontrollers. - * - * Architecture specific USB OTG definitions for the Atmel 8-bit AVR microcontrollers. - * - * @{ - */ - -#ifndef __USBOTG_AVR8_H__ -#define __USBOTG_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the VBUS pulsing method of SRP, supported by some OTG devices. - * - * \see \ref USB_OTG_Device_InitiateSRP(). - */ - #define USB_OTG_SRP_VBUS (1 << SRPSEL) - - /** Mask for the Data + pulsing method of SRP, supported by some OTG devices. - * - * \see \ref USB_OTG_Device_InitiateSRP(). - */ - #define USB_OTG_STP_DATA 0 - - /* Inline Functions: */ - /** Initiate a Host Negotiation Protocol request. This indicates to the other connected device - * that the device wishes to change device/host roles. - */ - static inline void USB_OTG_Device_RequestHNP(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTG_Device_RequestHNP(void) - { - OTGCON |= (1 << HNPREQ); - } - - /** Cancel a Host Negotiation Protocol request. This stops a pending HNP request to the other - * connected device. - */ - static inline void USB_OTG_Device_CancelHNPRequest(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTG_Device_CancelHNPRequest(void) - { - OTGCON &= ~(1 << HNPREQ); - } - - /** Determines if the device is currently sending a HNP to an attached host. - * - * \return Boolean \c true if currently sending a HNP to the other connected device, \c false otherwise - */ - static inline bool USB_OTG_Device_IsSendingHNP(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_OTG_Device_IsSendingHNP(void) - { - return ((OTGCON & (1 << HNPREQ)) ? true : false); - } - - /** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB - * interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in - * host mode indicates that VBUS should be applied and a session started. - * - * There are two different methods of sending a SRP - either pulses on the VBUS line, or by - * pulsing the Data + line via the internal pull-up resistor. - * - * \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or - * \ref USB_OTG_STP_DATA. - */ - static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask) ATTR_ALWAYS_INLINE; - static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask) - { - OTGCON = ((OTGCON & ~(1 << SRPSEL)) | (SRPTypeMask | (1 << SRPREQ))); - } - - /** Accepts a HNP from a connected device, indicating that both devices should exchange - * device/host roles. - */ - static inline void USB_OTG_Host_AcceptHNP(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTG_Host_AcceptHNP(void) - { - OTGCON |= (1 << HNPREQ); - } - - /** Rejects a HNP from a connected device, indicating that both devices should remain in their - * current device/host roles. - */ - static inline void USB_OTG_Host_RejectHNP(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTG_Host_RejectHNP(void) - { - OTGCON &= ~(1 << HNPREQ); - } - - /** Indicates if the connected device is currently sending a HNP request. - * - * \return Boolean \c true if a HNP is currently being issued by the connected device, \c false otherwise. - */ - static inline bool USB_OTG_Host_IsHNPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_OTG_Host_IsHNPReceived(void) - { - return ((OTGCON & (1 << HNPREQ)) ? true : false); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c deleted file mode 100644 index e71a7bd327..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#include "PipeStream_AVR8.h" - -uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_IN); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_OUT); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - USB_USBTask(); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr)) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8()) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8()) -#include "Template/Template_Pipe_RW.c" - -#endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h deleted file mode 100644 index 8307ab4973..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h +++ /dev/null @@ -1,442 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Pipe data stream transmission and reception management for the AVR8 microcontrollers - * \copydetails Group_PipeStreamRW_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeStreamRW - * \defgroup Group_PipeStreamRW_AVR8 Read/Write of Multi-Byte Streams (AVR8) - * \brief Pipe data stream transmission and reception management for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to pipes. - * - * @{ - */ - -#ifndef __PIPE_STREAM_AVR8_H__ -#define __PIPE_STREAM_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host - * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data - * to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with - * the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of bytes to discard via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device - * as needed. The last packet is not automatically sent once the remaining bytes has been written; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data - * to process (and after the current packet transmission has been initiated) the BytesProcessed location will be - * updated with the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of zero bytes to write via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the pipe from the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the pipe from the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for EEPROM source/destination data */ - //@{ - - /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_EStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_EStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_EStream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_EStream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for PROGMEM source/destination data */ - //@{ - - /** FLASH buffer source version of \ref Pipe_Write_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_PStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Pipe_Write_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_PStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c deleted file mode 100644 index bf3ff003cd..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#include "../Pipe.h" - -uint8_t USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; - -bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table, - const uint8_t Entries) -{ - for (uint8_t i = 0; i < Entries; i++) - { - if (!(Table[i].Address)) - continue; - - if (!(Pipe_ConfigurePipe(Table[i].Address, Table[i].Type, Table[i].EndpointAddress, Table[i].Size, Table[i].Banks))) - { - return false; - } - } - - return true; -} - -bool Pipe_ConfigurePipe(const uint8_t Address, - const uint8_t Type, - const uint8_t EndpointAddress, - const uint16_t Size, - const uint8_t Banks) -{ - uint8_t Number = (Address & PIPE_EPNUM_MASK); - uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT; - - if (Number >= PIPE_TOTAL_PIPES) - return false; - - if (Type == EP_TYPE_CONTROL) - Token = PIPE_TOKEN_SETUP; - -#if defined(ORDERED_EP_CONFIG) - Pipe_SelectPipe(Number); - Pipe_EnablePipe(); - - UPCFG1X = 0; - - UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointAddress & PIPE_EPNUM_MASK) << PEPNUM0)); - UPCFG1X = ((1 << ALLOC) | ((Banks > 1) ? (1 << EPBK0) : 0) | Pipe_BytesToEPSizeMask(Size)); - - Pipe_SetInfiniteINRequests(); - - return Pipe_IsConfigured(); -#else - for (uint8_t PNum = Number; PNum < PIPE_TOTAL_PIPES; PNum++) - { - uint8_t UPCFG0XTemp; - uint8_t UPCFG1XTemp; - uint8_t UPCFG2XTemp; - uint8_t UPIENXTemp; - - Pipe_SelectPipe(PNum); - - if (PNum == Number) - { - UPCFG0XTemp = ((Type << EPTYPE0) | Token | ((EndpointAddress & PIPE_EPNUM_MASK) << PEPNUM0)); - UPCFG1XTemp = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size)); - UPCFG2XTemp = 0; - UPIENXTemp = 0; - } - else - { - UPCFG0XTemp = UPCFG0X; - UPCFG1XTemp = UPCFG1X; - UPCFG2XTemp = UPCFG2X; - UPIENXTemp = UPIENX; - } - - if (!(UPCFG1XTemp & (1 << ALLOC))) - continue; - - Pipe_DisablePipe(); - UPCFG1X &= ~(1 << ALLOC); - - Pipe_EnablePipe(); - UPCFG0X = UPCFG0XTemp; - UPCFG1X = UPCFG1XTemp; - UPCFG2X = UPCFG2XTemp; - UPIENX = UPIENXTemp; - - Pipe_SetInfiniteINRequests(); - - if (!(Pipe_IsConfigured())) - return false; - } - - Pipe_SelectPipe(Number); - return true; -#endif -} - -void Pipe_ClearPipes(void) -{ - UPINT = 0; - - for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) - { - Pipe_SelectPipe(PNum); - UPIENX = 0; - UPINTX = 0; - UPCFG1X = 0; - Pipe_DisablePipe(); - } -} - -bool Pipe_IsEndpointBound(const uint8_t EndpointAddress) -{ - uint8_t PrevPipeNumber = Pipe_GetCurrentPipe(); - - for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) - { - Pipe_SelectPipe(PNum); - - if (!(Pipe_IsConfigured())) - continue; - - if (Pipe_GetBoundEndpointAddress() == EndpointAddress) - return true; - } - - Pipe_SelectPipe(PrevPipeNumber); - return false; -} - -uint8_t Pipe_WaitUntilReady(void) -{ - #if (USB_STREAM_TIMEOUT_MS < 0xFF) - uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #else - uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #endif - - uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); - - for (;;) - { - if (Pipe_GetPipeToken() == PIPE_TOKEN_IN) - { - if (Pipe_IsINReceived()) - return PIPE_READYWAIT_NoError; - } - else - { - if (Pipe_IsOUTReady()) - return PIPE_READYWAIT_NoError; - } - - if (Pipe_IsStalled()) - return PIPE_READYWAIT_PipeStalled; - else if (USB_HostState == HOST_STATE_Unattached) - return PIPE_READYWAIT_DeviceDisconnected; - - uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return PIPE_READYWAIT_Timeout; - } - } -} - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h deleted file mode 100644 index 24c7b36cb5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h +++ /dev/null @@ -1,921 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Pipe definitions for the AVR8 microcontrollers. - * \copydetails Group_PipeManagement_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeRW - * \defgroup Group_PipeRW_AVR8 Pipe Data Reading and Writing (AVR8) - * \brief Pipe data read/write definitions for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to pipes. - */ - -/** \ingroup Group_PipePrimitiveRW - * \defgroup Group_PipePrimitiveRW_AVR8 Read/Write of Primitive Data Types (AVR8) - * \brief Pipe primitive data read/write definitions for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to pipes. - */ - -/** \ingroup Group_PipePacketManagement - * \defgroup Group_PipePacketManagement_AVR8 Pipe Packet Management (AVR8) - * \brief Pipe packet management definitions for the Atmel AVR8 architecture. - * - * Functions, macros, variables, enums and types related to packet management of pipes. - */ - -/** \ingroup Group_PipeControlReq - * \defgroup Group_PipeControlReq_AVR8 Pipe Control Request Management (AVR8) - * \brief Pipe control request management definitions for the Atmel AVR8 architecture. - * - * Module for host mode request processing. This module allows for the transmission of standard, class and - * vendor control requests to the default control endpoint of an attached device while in host mode. - * - * \see Chapter 9 of the USB 2.0 specification. - */ - -/** \ingroup Group_PipeManagement - * \defgroup Group_PipeManagement_AVR8 Pipe Management (AVR8) - * \brief Pipe management definitions for the Atmel AVR8 architecture. - * - * This module contains functions, macros and enums related to pipe management when in USB Host mode. This - * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions - * for various data types. - * - * @{ - */ - -#ifndef __PIPE_AVR8_H__ -#define __PIPE_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name Pipe Error Flag Masks */ - //@{ - /** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */ - #define PIPE_ERRORFLAG_OVERFLOW (1 << 6) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that an underflow error occurred in the pipe on the received data. */ - #define PIPE_ERRORFLAG_UNDERFLOW (1 << 5) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */ - #define PIPE_ERRORFLAG_CRC16 (1 << 4) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware timeout error occurred in the pipe. */ - #define PIPE_ERRORFLAG_TIMEOUT (1 << 3) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware PID error occurred in the pipe. */ - #define PIPE_ERRORFLAG_PID (1 << 2) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data PID error occurred in the pipe. */ - #define PIPE_ERRORFLAG_DATAPID (1 << 1) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data toggle error occurred in the pipe. */ - #define PIPE_ERRORFLAG_DATATGL (1 << 0) - //@} - - /** \name Pipe Token Masks */ - //@{ - /** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a SETUP token (for CONTROL type pipes), - * which will trigger a control request on the attached device when data is written to the pipe. - */ - #define PIPE_TOKEN_SETUP (0 << PTOKEN0) - - /** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a IN token (for non-CONTROL type pipes), - * indicating that the pipe data will flow from device to host. - */ - #define PIPE_TOKEN_IN (1 << PTOKEN0) - - /** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a OUT token (for non-CONTROL type pipes), - * indicating that the pipe data will flow from host to device. - */ - #define PIPE_TOKEN_OUT (2 << PTOKEN0) - //@} - - /** Default size of the default control pipe's bank, until altered by the Endpoint0Size value - * in the device descriptor of the attached device. - */ - #define PIPE_CONTROLPIPE_DEFAULT_SIZE 64 - - /** Total number of pipes (including the default control pipe at address 0) which may be used in - * the device. Different USB AVR models support different amounts of pipes, this value reflects - * the maximum number of pipes for the currently selected AVR model. - */ - #define PIPE_TOTAL_PIPES 7 - - /** Size in bytes of the largest pipe bank size possible in the device. Not all banks on each AVR - * model supports the largest bank size possible on the device; different pipe numbers support - * different maximum bank sizes. This value reflects the largest possible bank of any pipe on the - * currently selected USB AVR model. - */ - #define PIPE_MAX_SIZE 256 - - /* Enums: */ - /** Enum for the possible error return codes of the \ref Pipe_WaitUntilReady() function. - * - * \ingroup Group_PipeRW_AVR8 - */ - enum Pipe_WaitUntilReady_ErrorCodes_t - { - PIPE_READYWAIT_NoError = 0, /**< Pipe ready for next packet, no error. */ - PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */ - PIPE_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while waiting. */ - PIPE_READYWAIT_Timeout = 3, /**< The device failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - }; - - /* Inline Functions: */ - /** Indicates the number of bytes currently stored in the current pipes's selected bank. - * - * \ingroup Group_PipeRW_AVR8 - * - * \return Total number of bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint16_t Pipe_BytesInPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Pipe_BytesInPipe(void) - { - return UPBCX; - } - - /** Determines the currently selected pipe's direction. - * - * \return The currently selected pipe's direction, as a \c PIPE_DIR_* mask. - */ - static inline uint8_t Pipe_GetPipeDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetPipeDirection(void) - { - return (UPCFG0X & (1 << EPDIR)) ? PIPE_DIR_IN : PIPE_DIR_OUT; - } - - /** Returns the pipe address of the currently selected pipe. This is typically used to save the - * currently selected pipe address so that it can be restored after another pipe has been manipulated. - * - * \return Index of the currently selected pipe. - */ - static inline uint8_t Pipe_GetCurrentPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetCurrentPipe(void) - { - return ((UPNUM & PIPE_PIPENUM_MASK) | Pipe_GetPipeDirection()); - } - - /** Selects the given pipe address. Any pipe operations which do not require the pipe address to be - * indicated will operate on the currently selected pipe. - * - * \param[in] Address Address of the pipe to select. - */ - static inline void Pipe_SelectPipe(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Pipe_SelectPipe(const uint8_t Address) - { - UPNUM = (Address & PIPE_PIPENUM_MASK); - } - - /** Resets the desired pipe, including the pipe banks and flags. - * - * \param[in] Address Address of the pipe to reset. - */ - static inline void Pipe_ResetPipe(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Pipe_ResetPipe(const uint8_t Address) - { - UPRST = (1 << (Address & PIPE_PIPENUM_MASK)); - UPRST = 0; - } - - /** Enables the currently selected pipe so that data can be sent and received through it to and from - * an attached device. - * - * \pre The currently selected pipe must first be configured properly via \ref Pipe_ConfigurePipe(). - */ - static inline void Pipe_EnablePipe(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_EnablePipe(void) - { - UPCONX |= (1 << PEN); - } - - /** Disables the currently selected pipe so that data cannot be sent and received through it to and - * from an attached device. - */ - static inline void Pipe_DisablePipe(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_DisablePipe(void) - { - UPCONX &= ~(1 << PEN); - } - - /** Determines if the currently selected pipe is enabled, but not necessarily configured. - * - * \return Boolean \c true if the currently selected pipe is enabled, \c false otherwise. - */ - static inline bool Pipe_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsEnabled(void) - { - return ((UPCONX & (1 << PEN)) ? true : false); - } - - /** Gets the current pipe token, indicating the pipe's data direction and type. - * - * \return The current pipe token, as a \c PIPE_TOKEN_* mask. - */ - static inline uint8_t Pipe_GetPipeToken(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetPipeToken(void) - { - return (UPCFG0X & (0x03 << PTOKEN0)); - } - - /** Sets the token for the currently selected pipe to one of the tokens specified by the \c PIPE_TOKEN_* - * masks. This can be used on CONTROL type pipes, to allow for bidirectional transfer of data during - * control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices - * which have two endpoints of opposite direction sharing the same endpoint address within the device. - * - * \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask. - */ - static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetPipeToken(const uint8_t Token) - { - UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token); - } - - /** Configures the currently selected pipe to allow for an unlimited number of IN requests. */ - static inline void Pipe_SetInfiniteINRequests(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetInfiniteINRequests(void) - { - UPCONX |= (1 << INMODE); - } - - /** Configures the currently selected pipe to only allow the specified number of IN requests to be - * accepted by the pipe before it is automatically frozen. - * - * \param[in] TotalINRequests Total number of IN requests that the pipe may receive before freezing. - */ - static inline void Pipe_SetFiniteINRequests(const uint8_t TotalINRequests) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetFiniteINRequests(const uint8_t TotalINRequests) - { - UPCONX &= ~(1 << INMODE); - UPINRQX = TotalINRequests; - } - - /** Determines if the currently selected pipe is configured. - * - * \return Boolean \c true if the selected pipe is configured, \c false otherwise. - */ - static inline bool Pipe_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsConfigured(void) - { - return ((UPSTAX & (1 << CFGOK)) ? true : false); - } - - /** Retrieves the endpoint address of the endpoint within the attached device that the currently selected - * pipe is bound to. - * - * \return Endpoint address the currently selected pipe is bound to. - */ - static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetBoundEndpointAddress(void) - { - uint8_t UPCFG0X_Temp = UPCFG0X; - - return (((UPCFG0X_Temp >> PEPNUM0) & PIPE_EPNUM_MASK) | ((UPCFG0X_Temp & PEPNUM1) ? ENDPOINT_DIR_OUT : ENDPOINT_DIR_IN)); - } - - /** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds. - * - * \param[in] Milliseconds Number of milliseconds between each pipe poll. - */ - static inline void Pipe_SetInterruptPeriod(const uint8_t Milliseconds) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetInterruptPeriod(const uint8_t Milliseconds) - { - UPCFG2X = Milliseconds; - } - - /** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should - * be serviced. - * - * \return Mask whose bits indicate which pipes have interrupted. - */ - static inline uint8_t Pipe_GetPipeInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetPipeInterrupts(void) - { - return UPINT; - } - - /** Determines if the specified pipe address has interrupted (valid only for INTERRUPT type - * pipes). - * - * \param[in] Address Address of the pipe whose interrupt flag should be tested. - * - * \return Boolean \c true if the specified pipe has interrupted, \c false otherwise. - */ - static inline bool Pipe_HasPipeInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_HasPipeInterrupted(const uint8_t Address) - { - return ((UPINT & (1 << (Address & PIPE_PIPENUM_MASK))) ? true : false); - } - - /** Unfreezes the selected pipe, allowing it to communicate with an attached device. */ - static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Unfreeze(void) - { - UPCONX &= ~(1 << PFREEZE); - } - - /** Freezes the selected pipe, preventing it from communicating with an attached device. */ - static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Freeze(void) - { - UPCONX |= (1 << PFREEZE); - } - - /** Determines if the currently selected pipe is frozen, and not able to accept data. - * - * \return Boolean \c true if the currently selected pipe is frozen, \c false otherwise. - */ - static inline bool Pipe_IsFrozen(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsFrozen(void) - { - return ((UPCONX & (1 << PFREEZE)) ? true : false); - } - - /** Clears the error flags for the currently selected pipe. */ - static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearError(void) - { - UPERRX = 0; - UPINTX &= ~(1 << PERRI); - } - - /** Determines if the master pipe error flag is set for the currently selected pipe, indicating that - * some sort of hardware error has occurred on the pipe. - * - * \see \ref Pipe_GetErrorFlags() macro for information on retrieving the exact error flag. - * - * \return Boolean \c true if an error has occurred on the selected pipe, \c false otherwise. - */ - static inline bool Pipe_IsError(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsError(void) - { - return ((UPINTX & (1 << PERRI)) ? true : false); - } - - /** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This - * value can then be masked against the \c PIPE_ERRORFLAG_* masks to determine what error has occurred. - * - * \return Mask comprising of \c PIPE_ERRORFLAG_* bits indicating what error has occurred on the selected pipe. - */ - static inline uint8_t Pipe_GetErrorFlags(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetErrorFlags(void) - { - return ((UPERRX & (PIPE_ERRORFLAG_CRC16 | PIPE_ERRORFLAG_TIMEOUT | - PIPE_ERRORFLAG_PID | PIPE_ERRORFLAG_DATAPID | - PIPE_ERRORFLAG_DATATGL)) | - (UPSTAX & (PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW))); - } - - /** Retrieves the number of busy banks in the currently selected pipe, which have been queued for - * transmission via the \ref Pipe_ClearOUT() command, or are awaiting acknowledgement via the - * \ref Pipe_ClearIN() command. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Total number of busy banks in the selected pipe. - */ - static inline uint8_t Pipe_GetBusyBanks(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetBusyBanks(void) - { - return (UPSTAX & (0x03 << NBUSYBK0)); - } - - /** Determines if the currently selected pipe may be read from (if data is waiting in the pipe - * bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT - * direction). This function will return false if an error has occurred in the pipe, or if the pipe - * is an IN direction and no packet (or an empty packet) has been received, or if the pipe is an OUT - * direction and the pipe bank is full. - * - * \note This function is not valid on CONTROL type pipes. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Boolean \c true if the currently selected pipe may be read from or written to, depending - * on its direction. - */ - static inline bool Pipe_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsReadWriteAllowed(void) - { - return ((UPINTX & (1 << RWAL)) ? true : false); - } - - /** Determines if a packet has been received on the currently selected IN pipe from the attached device. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Boolean \c true if the current pipe has received an IN packet, \c false otherwise. - */ - static inline bool Pipe_IsINReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsINReceived(void) - { - return ((UPINTX & (1 << RXINI)) ? true : false); - } - - /** Determines if the currently selected OUT pipe is ready to send an OUT packet to the attached device. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Boolean \c true if the current pipe is ready for an OUT packet, \c false otherwise. - */ - static inline bool Pipe_IsOUTReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsOUTReady(void) - { - return ((UPINTX & (1 << TXOUTI)) ? true : false); - } - - /** Determines if no SETUP request is currently being sent to the attached device on the selected - * CONTROL type pipe. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Boolean \c true if the current pipe is ready for a SETUP packet, \c false otherwise. - */ - static inline bool Pipe_IsSETUPSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsSETUPSent(void) - { - return ((UPINTX & (1 << TXSTPI)) ? true : false); - } - - /** Sends the currently selected CONTROL type pipe's contents to the device as a SETUP packet. - * - * \ingroup Group_PipePacketManagement_AVR8 - */ - static inline void Pipe_ClearSETUP(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearSETUP(void) - { - UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON)); - } - - /** Acknowledges the reception of a setup IN request from the attached device on the currently selected - * pipe, freeing the bank ready for the next packet. - * - * \ingroup Group_PipePacketManagement_AVR8 - */ - static inline void Pipe_ClearIN(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearIN(void) - { - UPINTX &= ~((1 << RXINI) | (1 << FIFOCON)); - } - - /** Sends the currently selected pipe's contents to the device as an OUT packet on the selected pipe, freeing - * the bank ready for the next packet. - * - * \ingroup Group_PipePacketManagement_AVR8 - */ - static inline void Pipe_ClearOUT(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearOUT(void) - { - UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON)); - } - - /** Determines if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on - * the currently selected pipe. This occurs when the host sends a packet to the device, but the device - * is not currently ready to handle the packet (i.e. its endpoint banks are full). Once a NAK has been - * received, it must be cleared using \ref Pipe_ClearNAKReceived() before the previous (or any other) packet - * can be re-sent. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Boolean \c true if an NAK has been received on the current pipe, \c false otherwise. - */ - static inline bool Pipe_IsNAKReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsNAKReceived(void) - { - return ((UPINTX & (1 << NAKEDI)) ? true : false); - } - - /** Clears the NAK condition on the currently selected pipe. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \see \ref Pipe_IsNAKReceived() for more details. - */ - static inline void Pipe_ClearNAKReceived(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearNAKReceived(void) - { - UPINTX &= ~(1 << NAKEDI); - } - - /** Determines if the currently selected pipe has had the STALL condition set by the attached device. - * - * \ingroup Group_PipePacketManagement_AVR8 - * - * \return Boolean \c true if the current pipe has been stalled by the attached device, \c false otherwise. - */ - static inline bool Pipe_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsStalled(void) - { - return ((UPINTX & (1 << RXSTALLI)) ? true : false); - } - - /** Clears the STALL condition detection flag on the currently selected pipe, but does not clear the - * STALL condition itself (this must be done via a ClearFeature control request to the device). - * - * \ingroup Group_PipePacketManagement_AVR8 - */ - static inline void Pipe_ClearStall(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearStall(void) - { - UPINTX &= ~(1 << RXSTALLI); - } - - /** Reads one byte from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \return Next byte in the currently selected pipe's FIFO buffer. - */ - static inline uint8_t Pipe_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_Read_8(void) - { - return UPDATX; - } - - /** Writes one byte to the currently selected pipe's bank, for IN direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \param[in] Data Data to write into the the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_8(const uint8_t Data) - { - UPDATX = Data; - } - - /** Discards one byte from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - */ - static inline void Pipe_Discard_8(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Discard_8(void) - { - uint8_t Dummy; - - Dummy = UPDATX; - - (void)Dummy; - } - - /** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \return Next two bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint16_t Pipe_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Pipe_Read_16_LE(void) - { - union - { - uint16_t Value; - uint8_t Bytes[2]; - } Data; - - Data.Bytes[0] = UPDATX; - Data.Bytes[1] = UPDATX; - - return Data.Value; - } - - /** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \return Next two bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint16_t Pipe_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Pipe_Read_16_BE(void) - { - union - { - uint16_t Value; - uint8_t Bytes[2]; - } Data; - - Data.Bytes[1] = UPDATX; - Data.Bytes[0] = UPDATX; - - return Data.Value; - } - - /** Writes two bytes to the currently selected pipe's bank in little endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_16_LE(const uint16_t Data) - { - UPDATX = (Data & 0xFF); - UPDATX = (Data >> 8); - } - - /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_16_BE(const uint16_t Data) - { - UPDATX = (Data >> 8); - UPDATX = (Data & 0xFF); - } - - /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - */ - static inline void Pipe_Discard_16(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Discard_16(void) - { - uint8_t Dummy; - - Dummy = UPDATX; - Dummy = UPDATX; - - (void)Dummy; - } - - /** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \return Next four bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint32_t Pipe_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Pipe_Read_32_LE(void) - { - union - { - uint32_t Value; - uint8_t Bytes[4]; - } Data; - - Data.Bytes[0] = UPDATX; - Data.Bytes[1] = UPDATX; - Data.Bytes[2] = UPDATX; - Data.Bytes[3] = UPDATX; - - return Data.Value; - } - - /** Reads four bytes from the currently selected pipe's bank in big endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \return Next four bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint32_t Pipe_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Pipe_Read_32_BE(void) - { - union - { - uint32_t DWord; - uint8_t Bytes[4]; - } Data; - - Data.Bytes[3] = UPDATX; - Data.Bytes[2] = UPDATX; - Data.Bytes[1] = UPDATX; - Data.Bytes[0] = UPDATX; - - return Data.DWord; - } - - /** Writes four bytes to the currently selected pipe's bank in little endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_32_LE(const uint32_t Data) - { - UPDATX = (Data & 0xFF); - UPDATX = (Data >> 8); - UPDATX = (Data >> 16); - UPDATX = (Data >> 24); - } - - /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_32_BE(const uint32_t Data) - { - UPDATX = (Data >> 24); - UPDATX = (Data >> 16); - UPDATX = (Data >> 8); - UPDATX = (Data & 0xFF); - } - - /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_AVR8 - */ - static inline void Pipe_Discard_32(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Discard_32(void) - { - uint8_t Dummy; - - Dummy = UPDATX; - Dummy = UPDATX; - Dummy = UPDATX; - Dummy = UPDATX; - - (void)Dummy; - } - - /* External Variables: */ - /** Global indicating the maximum packet size of the default control pipe located at address - * 0 in the device. This value is set to the value indicated in the attached device's device - * descriptor once the USB interface is initialized into host mode and a device is attached - * to the USB bus. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - extern uint8_t USB_Host_ControlPipeSize; - - /* Function Prototypes: */ - /** Configures a table of pipe descriptions, in sequence. This function can be used to configure multiple - * pipes at the same time. - * - * \note Pipe with a zero address will be ignored, thus this function cannot be used to configure the - * control pipe. - * - * \param[in] Table Pointer to a table of pipe descriptions. - * \param[in] Entries Number of entries in the pipe table to configure. - * - * \return Boolean \c true if all pipes configured successfully, \c false otherwise. - */ - bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table, - const uint8_t Entries); - - /** Configures the specified pipe address with the given pipe type, endpoint address within the attached device, bank size - * and number of hardware banks. - * - * A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() - * before being used. Pipes should be kept frozen unless waiting for data from a device while in IN mode, or - * sending data to the device in OUT mode. IN type pipes are also automatically configured to accept infinite - * numbers of IN requests without automatic freezing - this can be overridden by a call to - * \ref Pipe_SetFiniteINRequests(). - * - * \param[in] Address Pipe address to configure. - * - * \param[in] Type Type of pipe to configure, an \c EP_TYPE_* mask. Not all pipe types are available on Low - * Speed USB devices - refer to the USB 2.0 specification. - * - * \param[in] EndpointAddress Endpoint address within the attached device that the pipe should interface to. - * - * \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to - * the USB device, or after they have been received from the USB device (depending on - * the pipe's data direction). The bank size must indicate the maximum packet size that - * the pipe can handle. - * - * \param[in] Banks Number of banks to use for the pipe being configured. - * - * \attention When the \c ORDERED_EP_CONFIG compile time option is used, Pipes must be configured in ascending order, - * or bank corruption will occur. - * - * \note Certain microcontroller model's pipes may have different maximum packet sizes based on the pipe's - * index - refer to the chosen microcontroller's datasheet to determine the maximum bank size for each pipe. - * \n\n - * - * \note The default control pipe should not be manually configured by the user application, as it is - * automatically configured by the library internally. - * \n\n - * - * \note This routine will automatically select the specified pipe upon success. Upon failure, the pipe which - * failed to reconfigure correctly will be selected. - * - * \return Boolean \c true if the configuration succeeded, \c false otherwise. - */ - bool Pipe_ConfigurePipe(const uint8_t Address, - const uint8_t Type, - const uint8_t EndpointAddress, - const uint16_t Size, - const uint8_t Banks); - - /** Spin-loops until the currently selected non-control pipe is ready for the next packet of data to be read - * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect). - * - * \ingroup Group_PipeRW_AVR8 - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t Pipe_WaitUntilReady(void); - - /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given - * endpoint is found, it is automatically selected. - * - * \param[in] EndpointAddress Address and direction mask of the endpoint within the attached device to check. - * - * \return Boolean \c true if a pipe bound to the given endpoint address of the specified direction is found, - * \c false otherwise. - */ - bool Pipe_IsEndpointBound(const uint8_t EndpointAddress) ATTR_WARN_UNUSED_RESULT; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #if !defined(ENDPOINT_CONTROLEP) - #define ENDPOINT_CONTROLEP 0 - #endif - - /* Inline Functions: */ - static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) - { - uint8_t MaskVal = 0; - uint16_t CheckBytes = 8; - - while ((CheckBytes < Bytes) && (CheckBytes < PIPE_MAX_SIZE)) - { - MaskVal++; - CheckBytes <<= 1; - } - - return (MaskVal << EPSIZE0); - } - - /* Function Prototypes: */ - void Pipe_ClearPipes(void); - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c deleted file mode 100644 index ab69536b06..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (void* const Buffer, - uint16_t Length) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - - if (!(Length)) - Endpoint_ClearOUT(); - - while (Length) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - else if (Endpoint_IsSETUPReceived()) - return ENDPOINT_RWCSTREAM_HostAborted; - - if (Endpoint_IsOUTReceived()) - { - while (Length && Endpoint_BytesInEndpoint()) - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - } - - Endpoint_ClearOUT(); - } - } - - while (!(Endpoint_IsINReady())) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - } - - return ENDPOINT_RWCSTREAM_NoError; -} - -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c deleted file mode 100644 index c2d171db06..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, - uint16_t Length) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - bool LastPacketFull = false; - - if (Length > USB_ControlRequest.wLength) - Length = USB_ControlRequest.wLength; - else if (!(Length)) - Endpoint_ClearIN(); - - while (Length || LastPacketFull) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - else if (Endpoint_IsSETUPReceived()) - return ENDPOINT_RWCSTREAM_HostAborted; - else if (Endpoint_IsOUTReceived()) - break; - - if (Endpoint_IsINReady()) - { - uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); - - while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInEndpoint++; - } - - LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); - Endpoint_ClearIN(); - } - } - - while (!(Endpoint_IsOUTReceived())) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - } - - return ENDPOINT_RWCSTREAM_NoError; -} - -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c deleted file mode 100644 index 02ad97867e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - uint16_t BytesInTransfer = 0; - uint8_t ErrorCode; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - { - Length -= *BytesProcessed; - TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); - } - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - TEMPLATE_CLEAR_ENDPOINT(); - - #if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); - #endif - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_BUFFER_TYPE -#undef TEMPLATE_TRANSFER_BYTE -#undef TEMPLATE_CLEAR_ENDPOINT -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c deleted file mode 100644 index 05846bb614..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - uint16_t BytesInTransfer = 0; - uint8_t ErrorCode; - - Pipe_SetPipeToken(TEMPLATE_TOKEN); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - { - Length -= *BytesProcessed; - TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); - } - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - TEMPLATE_CLEAR_PIPE(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_BUFFER_TYPE -#undef TEMPLATE_TOKEN -#undef TEMPLATE_TRANSFER_BYTE -#undef TEMPLATE_CLEAR_PIPE -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c deleted file mode 100644 index 37b106ab62..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#define __INCLUDE_FROM_USB_CONTROLLER_C -#include "../USBController.h" - -#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) -volatile uint8_t USB_CurrentMode = USB_MODE_None; -#endif - -#if !defined(USE_STATIC_OPTIONS) -volatile uint8_t USB_Options; -#endif - -void USB_Init( - #if defined(USB_CAN_BE_BOTH) - const uint8_t Mode - #endif - - #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) - , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void - #endif - - #if !defined(USE_STATIC_OPTIONS) - const uint8_t Options - #endif - ) -{ - #if !defined(USE_STATIC_OPTIONS) - USB_Options = Options; - #endif - - if (!(USB_Options & USB_OPT_REG_DISABLED)) - USB_REG_On(); - else - USB_REG_Off(); - - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - { - #if defined(USB_SERIES_4_AVR) - PLLFRQ = (1 << PDIV2); - #endif - } - - #if defined(USB_CAN_BE_BOTH) - if (Mode == USB_MODE_UID) - { - UHWCON |= (1 << UIDE); - USB_INT_Enable(USB_INT_IDTI); - USB_CurrentMode = USB_GetUSBModeFromUID(); - } - else - { - UHWCON &= ~(1 << UIDE); - USB_CurrentMode = Mode; - } - #endif - - USB_IsInitialized = true; - - USB_ResetInterface(); -} - -void USB_Disable(void) -{ - USB_INT_DisableAllInterrupts(); - USB_INT_ClearAllInterrupts(); - - USB_Detach(); - USB_Controller_Disable(); - - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - USB_PLL_Off(); - - USB_REG_Off(); - - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - USB_OTGPAD_Off(); - #endif - - #if defined(USB_CAN_BE_BOTH) - USB_CurrentMode = USB_MODE_None; - #endif - - USB_IsInitialized = false; -} - -void USB_ResetInterface(void) -{ - #if defined(USB_CAN_BE_BOTH) - bool UIDModeSelectEnabled = ((UHWCON & (1 << UIDE)) != 0); - #endif - - USB_INT_DisableAllInterrupts(); - USB_INT_ClearAllInterrupts(); - - USB_Controller_Reset(); - - #if defined(USB_CAN_BE_BOTH) - if (UIDModeSelectEnabled) - USB_INT_Enable(USB_INT_IDTI); - #endif - - USB_CLK_Unfreeze(); - - if (USB_CurrentMode == USB_MODE_Device) - { - #if defined(USB_CAN_BE_DEVICE) - #if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - UHWCON |= (1 << UIMOD); - #endif - - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - { - #if defined(USB_SERIES_2_AVR) - USB_PLL_On(); - while (!(USB_PLL_IsReady())); - #else - USB_PLL_Off(); - #endif - } - - USB_Init_Device(); - #endif - } - else if (USB_CurrentMode == USB_MODE_Host) - { - #if defined(USB_CAN_BE_HOST) - UHWCON &= ~(1 << UIMOD); - - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - { - #if defined(USB_CAN_BE_HOST) - USB_PLL_On(); - while (!(USB_PLL_IsReady())); - #endif - } - - USB_Init_Host(); - #endif - } - - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - USB_OTGPAD_On(); - #endif -} - -#if defined(USB_CAN_BE_DEVICE) -static void USB_Init_Device(void) -{ - USB_DeviceState = DEVICE_STATE_Unattached; - USB_Device_ConfigurationNumber = 0; - - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - USB_Device_RemoteWakeupEnabled = false; - #endif - - #if !defined(NO_DEVICE_SELF_POWER) - USB_Device_CurrentlySelfPowered = false; - #endif - - #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) - USB_Descriptor_Device_t* DeviceDescriptorPtr; - - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ - !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) - uint8_t DescriptorAddressSpace; - - if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr, &DescriptorAddressSpace) != NO_DESCRIPTOR) - { - if (DescriptorAddressSpace == MEMSPACE_FLASH) - USB_Device_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - else if (DescriptorAddressSpace == MEMSPACE_EEPROM) - USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - else - USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; - } - #else - if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) - { - #if defined(USE_RAM_DESCRIPTORS) - USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; - #elif defined(USE_EEPROM_DESCRIPTORS) - USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - #else - USB_Device_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - #endif - } - #endif - #endif - - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - if (USB_Options & USB_DEVICE_OPT_LOWSPEED) - USB_Device_SetLowSpeed(); - else - USB_Device_SetFullSpeed(); - - USB_INT_Enable(USB_INT_VBUSTI); - #endif - - Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - USB_Device_ControlEndpointSize, 1); - - USB_INT_Clear(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_EORSTI); - - USB_Attach(); -} -#endif - -#if defined(USB_CAN_BE_HOST) -static void USB_Init_Host(void) -{ - USB_HostState = HOST_STATE_Unattached; - USB_Host_ConfigurationNumber = 0; - USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; - - USB_Host_HostMode_On(); - - USB_Host_VBUS_Auto_Off(); - USB_Host_VBUS_Manual_Enable(); - USB_Host_VBUS_Manual_On(); - - USB_INT_Enable(USB_INT_SRPI); - USB_INT_Enable(USB_INT_BCERRI); - - USB_Attach(); -} -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h deleted file mode 100644 index e479d7a1ad..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h +++ /dev/null @@ -1,436 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Controller definitions for the AVR8 microcontrollers. - * \copydetails Group_USBManagement_AVR8 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USBManagement - * \defgroup Group_USBManagement_AVR8 USB Interface Management (AVR8) - * \brief USB Controller definitions for the AVR8 microcontrollers. - * - * Functions, macros, variables, enums and types related to the setup and management of the USB interface. - * - * @{ - */ - -#ifndef __USBCONTROLLER_AVR8_H__ -#define __USBCONTROLLER_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../Events.h" - #include "../USBTask.h" - #include "../USBInterrupt.h" - - #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__) - #include "../Host.h" - #include "../OTG.h" - #include "../Pipe.h" - #include "../HostStandardReq.h" - #include "../PipeStream.h" - #endif - - #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) - #include "../Device.h" - #include "../Endpoint.h" - #include "../DeviceStandardReq.h" - #include "../EndpointStream.h" - #endif - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks and Defines: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - #if !defined(F_USB) - #error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile. - #endif - - #if (F_USB == 8000000) - #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \ - defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || \ - defined(__AVR_ATmega32U2__)) - #define USB_PLL_PSC 0 - #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) - #define USB_PLL_PSC 0 - #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) || defined(__AVR_ATmega32U6__)) - #define USB_PLL_PSC ((1 << PLLP1) | (1 << PLLP0)) - #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__)) - #define USB_PLL_PSC ((1 << PLLP1) | (1 << PLLP0)) - #endif - #elif (F_USB == 16000000) - #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \ - defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || \ - defined(__AVR_ATmega32U2__)) - #define USB_PLL_PSC (1 << PLLP0) - #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) - #define USB_PLL_PSC (1 << PINDIV) - #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__)) - #define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP1)) - #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)) - #define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP0)) - #endif - #endif - - #if !defined(USB_PLL_PSC) - #error No PLL prescale value available for chosen F_USB value and AVR model. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name USB Controller Option Masks */ - //@{ - /** Regulator disable option mask for \ref USB_Init(). This indicates that the internal 3.3V USB data pad - * regulator should be disabled and the AVR's VCC level used for the data pads. - * - * \note See USB AVR data sheet for more information on the internal pad regulator. - */ - #define USB_OPT_REG_DISABLED (1 << 1) - - /** Regulator enable option mask for \ref USB_Init(). This indicates that the internal 3.3V USB data pad - * regulator should be enabled to regulate the data pin voltages from the VBUS level down to a level within - * the range allowable by the USB standard. - * - * \note See USB AVR data sheet for more information on the internal pad regulator. - */ - #define USB_OPT_REG_ENABLED (0 << 1) - - /** Manual PLL control option mask for \ref USB_Init(). This indicates to the library that the user application - * will take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock - * that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations. - */ - #define USB_OPT_MANUAL_PLL (1 << 2) - - /** Automatic PLL control option mask for \ref USB_Init(). This indicates to the library that the library should - * take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock - * that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations. - */ - #define USB_OPT_AUTO_PLL (0 << 2) - //@} - - #if !defined(USB_STREAM_TIMEOUT_MS) || defined(__DOXYGEN__) - /** Constant for the maximum software timeout period of the USB data stream transfer functions - * (both control and standard) when in either device or host mode. If the next packet of a stream - * is not received or acknowledged within this time period, the stream function will fail. - * - * This value may be overridden in the user project makefile as the value of the - * \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch. - */ - #define USB_STREAM_TIMEOUT_MS 100 - #endif - - /* Inline Functions: */ - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__) - /** Determines if the VBUS line is currently high (i.e. the USB host is supplying power). - * - * \note This function is not available on some AVR models which do not support hardware VBUS monitoring. - * - * \return Boolean \c true if the VBUS line is currently detecting power from a host, \c false otherwise. - */ - static inline bool USB_VBUS_GetStatus(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_VBUS_GetStatus(void) - { - return ((USBSTA & (1 << VBUS)) ? true : false); - } - #endif - - /** Detaches the device from the USB bus. This has the effect of removing the device from any - * attached host, ceasing USB communications. If no host is present, this prevents any host from - * enumerating the device once attached until \ref USB_Attach() is called. - */ - static inline void USB_Detach(void) ATTR_ALWAYS_INLINE; - static inline void USB_Detach(void) - { - UDCON |= (1 << DETACH); - } - - /** Attaches the device to the USB bus. This announces the device's presence to any attached - * USB host, starting the enumeration process. If no host is present, attaching the device - * will allow for enumeration once a host is connected to the device. - * - * This is inexplicably also required for proper operation while in host mode, to enable the - * attachment of a device to the host. This is despite the bit being located in the device-mode - * register and despite the datasheet making no mention of its requirement in host mode. - */ - static inline void USB_Attach(void) ATTR_ALWAYS_INLINE; - static inline void USB_Attach(void) - { - UDCON &= ~(1 << DETACH); - } - - /* Function Prototypes: */ - /** Main function to initialize and start the USB interface. Once active, the USB interface will - * allow for device connection to a host when in device mode, or for device enumeration while in - * host mode. - * - * As the USB library relies on interrupts for the device and host mode enumeration processes, - * the user must enable global interrupts before or shortly after this function is called. In - * device mode, interrupts must be enabled within 500ms of this function being called to ensure - * that the host does not time out whilst enumerating the device. In host mode, interrupts may be - * enabled at the application's leisure however enumeration will not begin of an attached device - * until after this has occurred. - * - * Calling this function when the USB interface is already initialized will cause a complete USB - * interface reset and re-enumeration. - * - * \param[in] Mode This is a mask indicating what mode the USB interface is to be initialized to, a value - * from the \ref USB_Modes_t enum. - * - * \param[in] Options Mask indicating the options which should be used when initializing the USB - * interface to control the USB interface's behavior. This should be comprised of - * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the - * PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device - * mode speed. - * - * \note To reduce the FLASH requirements of the library if only device or host mode is required, - * the mode can be statically set in the project makefile by defining the token \c USB_DEVICE_ONLY - * (for device mode) or \c USB_HOST_ONLY (for host mode), passing the token to the compiler - * via the -D switch. If the mode is statically set, this parameter does not exist in the - * function prototype. - * \n\n - * - * \note To reduce the FLASH requirements of the library if only fixed settings are required, - * the options may be set statically in the same manner as the mode (see the Mode parameter of - * this function). To statically set the USB options, pass in the \c USE_STATIC_OPTIONS token, - * defined to the appropriate options masks. When the options are statically set, this - * parameter does not exist in the function prototype. - * \n\n - * - * \note The mode parameter does not exist on devices where only one mode is possible, such as USB - * AVR models which only implement the USB device mode in hardware. - * - * \see \ref Group_Device for the \c USB_DEVICE_OPT_* masks. - */ - void USB_Init( - #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) - const uint8_t Mode - #endif - - #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) || defined(__DOXYGEN__) - , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void - #endif - - #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) - const uint8_t Options - #endif - ); - - /** Shuts down the USB interface. This turns off the USB interface after deallocating all USB FIFO - * memory, endpoints and pipes. When turned off, no USB functionality can be used until the interface - * is restarted with the \ref USB_Init() function. - */ - void USB_Disable(void); - - /** Resets the interface, when already initialized. This will re-enumerate the device if already connected - * to a host, or re-enumerate an already attached device when in host mode. - */ - void USB_ResetInterface(void); - - /* Global Variables: */ - #if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) || defined(__DOXYGEN__) - /** Indicates the mode that the USB interface is currently initialized to, a value from the - * \ref USB_Modes_t enum. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \note When the controller is initialized into UID auto-detection mode, this variable will hold the - * currently selected USB mode (i.e. \ref USB_MODE_Device or \ref USB_MODE_Host). If the controller - * is fixed into a specific mode (either through the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY compile time - * options, or a limitation of the USB controller in the chosen device model) this will evaluate to - * a constant of the appropriate value and will never evaluate to \ref USB_MODE_None even when the - * USB interface is not initialized. - */ - extern volatile uint8_t USB_CurrentMode; - #elif defined(USB_HOST_ONLY) - #define USB_CurrentMode USB_MODE_Host - #elif defined(USB_DEVICE_ONLY) - #define USB_CurrentMode USB_MODE_Device - #endif - - #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) - /** Indicates the current USB options that the USB interface was initialized with when \ref USB_Init() - * was called. This value will be one of the \c USB_MODE_* masks defined elsewhere in this module. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - extern volatile uint8_t USB_Options; - #elif defined(USE_STATIC_OPTIONS) - #define USB_Options USE_STATIC_OPTIONS - #endif - - /* Enums: */ - /** Enum for the possible USB controller modes, for initialization via \ref USB_Init() and indication back to the - * user application via \ref USB_CurrentMode. - */ - enum USB_Modes_t - { - USB_MODE_None = 0, /**< Indicates that the controller is currently not initialized in any specific USB mode. */ - USB_MODE_Device = 1, /**< Indicates that the controller is currently initialized in USB Device mode. */ - USB_MODE_Host = 2, /**< Indicates that the controller is currently initialized in USB Host mode. */ - USB_MODE_UID = 3, /**< Indicates that the controller should determine the USB mode from the UID pin of the - * USB connector. - */ - }; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_USB_CONTROLLER_C) - #if defined(USB_CAN_BE_DEVICE) - static void USB_Init_Device(void); - #endif - - #if defined(USB_CAN_BE_HOST) - static void USB_Init_Host(void); - #endif - #endif - - /* Inline Functions: */ - static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_PLL_On(void) - { - PLLCSR = USB_PLL_PSC; - PLLCSR = (USB_PLL_PSC | (1 << PLLE)); - } - - static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_PLL_Off(void) - { - PLLCSR = 0; - } - - static inline bool USB_PLL_IsReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_PLL_IsReady(void) - { - return ((PLLCSR & (1 << PLOCK)) ? true : false); - } - - static inline void USB_REG_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_REG_On(void) - { - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - UHWCON |= (1 << UVREGE); - #else - REGCR &= ~(1 << REGDIS); - #endif - } - - static inline void USB_REG_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_REG_Off(void) - { - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - UHWCON &= ~(1 << UVREGE); - #else - REGCR |= (1 << REGDIS); - #endif - } - - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - static inline void USB_OTGPAD_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTGPAD_On(void) - { - USBCON |= (1 << OTGPADE); - } - - static inline void USB_OTGPAD_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTGPAD_Off(void) - { - USBCON &= ~(1 << OTGPADE); - } - #endif - - static inline void USB_CLK_Freeze(void) ATTR_ALWAYS_INLINE; - static inline void USB_CLK_Freeze(void) - { - USBCON |= (1 << FRZCLK); - } - - static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE; - static inline void USB_CLK_Unfreeze(void) - { - USBCON &= ~(1 << FRZCLK); - } - - static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Enable(void) - { - USBCON |= (1 << USBE); - } - - static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Disable(void) - { - USBCON &= ~(1 << USBE); - } - - static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Reset(void) - { - USBCON &= ~(1 << USBE); - USBCON |= (1 << USBE); - } - - #if defined(USB_CAN_BE_BOTH) - static inline uint8_t USB_GetUSBModeFromUID(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t USB_GetUSBModeFromUID(void) - { - if (USBSTA & (1 << ID)) - return USB_MODE_Device; - else - return USB_MODE_Host; - } - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c deleted file mode 100644 index 3bff19f2e2..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_AVR8) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBInterrupt.h" - -void USB_INT_DisableAllInterrupts(void) -{ - #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - USBCON &= ~((1 << VBUSTE) | (1 << IDTE)); - #elif defined(USB_SERIES_4_AVR) - USBCON &= ~(1 << VBUSTE); - #endif - - #if defined(USB_CAN_BE_BOTH) - OTGIEN = 0; - #endif - - #if defined(USB_CAN_BE_HOST) - UHIEN = 0; - #endif - - #if defined(USB_CAN_BE_DEVICE) - UDIEN = 0; - #endif -} - -void USB_INT_ClearAllInterrupts(void) -{ - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - USBINT = 0; - #endif - - #if defined(USB_CAN_BE_BOTH) - OTGINT = 0; - #endif - - #if defined(USB_CAN_BE_HOST) - UHINT = 0; - #endif - - #if defined(USB_CAN_BE_DEVICE) - UDINT = 0; - #endif -} - -ISR(USB_GEN_vect, ISR_BLOCK) -{ - #if defined(USB_CAN_BE_DEVICE) - #if !defined(NO_SOF_EVENTS) - if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) - { - USB_INT_Clear(USB_INT_SOFI); - - EVENT_USB_Device_StartOfFrame(); - } - #endif - - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - if (USB_INT_HasOccurred(USB_INT_VBUSTI) && USB_INT_IsEnabled(USB_INT_VBUSTI)) - { - USB_INT_Clear(USB_INT_VBUSTI); - - if (USB_VBUS_GetStatus()) - { - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - { - USB_PLL_On(); - while (!(USB_PLL_IsReady())); - } - - USB_DeviceState = DEVICE_STATE_Powered; - EVENT_USB_Device_Connect(); - } - else - { - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - USB_PLL_Off(); - - USB_DeviceState = DEVICE_STATE_Unattached; - EVENT_USB_Device_Disconnect(); - } - } - #endif - - if (USB_INT_HasOccurred(USB_INT_SUSPI) && USB_INT_IsEnabled(USB_INT_SUSPI)) - { - USB_INT_Disable(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_WAKEUPI); - - USB_CLK_Freeze(); - - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - USB_PLL_Off(); - - #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) - USB_DeviceState = DEVICE_STATE_Unattached; - EVENT_USB_Device_Disconnect(); - #else - USB_DeviceState = DEVICE_STATE_Suspended; - EVENT_USB_Device_Suspend(); - #endif - } - - if (USB_INT_HasOccurred(USB_INT_WAKEUPI) && USB_INT_IsEnabled(USB_INT_WAKEUPI)) - { - if (!(USB_Options & USB_OPT_MANUAL_PLL)) - { - USB_PLL_On(); - while (!(USB_PLL_IsReady())); - } - - USB_CLK_Unfreeze(); - - USB_INT_Clear(USB_INT_WAKEUPI); - - USB_INT_Disable(USB_INT_WAKEUPI); - USB_INT_Enable(USB_INT_SUSPI); - - if (USB_Device_ConfigurationNumber) - USB_DeviceState = DEVICE_STATE_Configured; - else - USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; - - #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) - EVENT_USB_Device_Connect(); - #else - EVENT_USB_Device_WakeUp(); - #endif - } - - if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI)) - { - USB_INT_Clear(USB_INT_EORSTI); - - USB_DeviceState = DEVICE_STATE_Default; - USB_Device_ConfigurationNumber = 0; - - USB_INT_Clear(USB_INT_SUSPI); - USB_INT_Disable(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_WAKEUPI); - - Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - USB_Device_ControlEndpointSize, 1); - - #if defined(INTERRUPT_CONTROL_ENDPOINT) - USB_INT_Enable(USB_INT_RXSTPI); - #endif - - EVENT_USB_Device_Reset(); - } - #endif - - #if defined(USB_CAN_BE_HOST) - #if !defined(NO_SOF_EVENTS) - if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI)) - { - USB_INT_Clear(USB_INT_HSOFI); - - EVENT_USB_Host_StartOfFrame(); - } - #endif - - if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI)) - { - USB_INT_Clear(USB_INT_DDISCI); - USB_INT_Clear(USB_INT_DCONNI); - USB_INT_Disable(USB_INT_DDISCI); - - EVENT_USB_Host_DeviceUnattached(); - - USB_ResetInterface(); - } - - if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI)) - { - USB_INT_Clear(USB_INT_VBERRI); - - USB_Host_VBUS_Manual_Off(); - USB_Host_VBUS_Auto_Off(); - - EVENT_USB_Host_HostError(HOST_ERROR_VBusVoltageDip); - EVENT_USB_Host_DeviceUnattached(); - - USB_HostState = HOST_STATE_Unattached; - } - - if (USB_INT_HasOccurred(USB_INT_SRPI) && USB_INT_IsEnabled(USB_INT_SRPI)) - { - USB_INT_Clear(USB_INT_SRPI); - USB_INT_Disable(USB_INT_SRPI); - - EVENT_USB_Host_DeviceAttached(); - - USB_INT_Enable(USB_INT_DDISCI); - - USB_HostState = HOST_STATE_Powered; - } - - if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI)) - { - USB_INT_Clear(USB_INT_BCERRI); - - EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0); - EVENT_USB_Host_DeviceUnattached(); - - USB_ResetInterface(); - } - #endif - - #if defined(USB_CAN_BE_BOTH) - if (USB_INT_HasOccurred(USB_INT_IDTI) && USB_INT_IsEnabled(USB_INT_IDTI)) - { - USB_INT_Clear(USB_INT_IDTI); - - if (USB_DeviceState != DEVICE_STATE_Unattached) - EVENT_USB_Device_Disconnect(); - - if (USB_HostState != HOST_STATE_Unattached) - EVENT_USB_Host_DeviceUnattached(); - - USB_CurrentMode = USB_GetUSBModeFromUID(); - USB_ResetInterface(); - - EVENT_USB_UIDChange(); - } - #endif -} - -#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE) -ISR(USB_COM_vect, ISR_BLOCK) -{ - uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint(); - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - USB_INT_Disable(USB_INT_RXSTPI); - - GlobalInterruptEnable(); - - USB_Device_ProcessControlRequest(); - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - USB_INT_Enable(USB_INT_RXSTPI); - Endpoint_SelectEndpoint(PrevSelectedEndpoint); -} -#endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h deleted file mode 100644 index 9e9210ec2e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h +++ /dev/null @@ -1,369 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Controller Interrupt definitions for the AVR8 microcontrollers. - * - * This file contains definitions required for the correct handling of low level USB service routine interrupts - * from the USB controller. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __USBINTERRUPT_AVR8_H__ -#define __USBINTERRUPT_AVR8_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Enums: */ - enum USB_Interrupts_t - { - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)) - USB_INT_VBUSTI = 0, - #endif - #if (defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)) - USB_INT_IDTI = 1, - #endif - #if (defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)) - USB_INT_WAKEUPI = 2, - USB_INT_SUSPI = 3, - USB_INT_EORSTI = 4, - USB_INT_SOFI = 5, - USB_INT_RXSTPI = 6, - #endif - #if (defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)) - USB_INT_HSOFI = 7, - USB_INT_DCONNI = 8, - USB_INT_DDISCI = 9, - USB_INT_RSTI = 10, - USB_INT_BCERRI = 11, - USB_INT_VBERRI = 12, - USB_INT_SRPI = 13, - #endif - }; - - /* Inline Functions: */ - static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Enable(const uint8_t Interrupt) - { - switch (Interrupt) - { - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - case USB_INT_VBUSTI: - USBCON |= (1 << VBUSTE); - break; - #endif - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - USBCON |= (1 << IDTE); - break; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - UDIEN |= (1 << WAKEUPE); - break; - case USB_INT_SUSPI: - UDIEN |= (1 << SUSPE); - break; - case USB_INT_EORSTI: - UDIEN |= (1 << EORSTE); - break; - case USB_INT_SOFI: - UDIEN |= (1 << SOFE); - break; - case USB_INT_RXSTPI: - UEIENX |= (1 << RXSTPE); - break; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - UHIEN |= (1 << HSOFE); - break; - case USB_INT_DCONNI: - UHIEN |= (1 << DCONNE); - break; - case USB_INT_DDISCI: - UHIEN |= (1 << DDISCE); - break; - case USB_INT_RSTI: - UHIEN |= (1 << RSTE); - break; - case USB_INT_BCERRI: - OTGIEN |= (1 << BCERRE); - break; - case USB_INT_VBERRI: - OTGIEN |= (1 << VBERRE); - break; - case USB_INT_SRPI: - OTGIEN |= (1 << SRPE); - break; - #endif - } - } - - static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Disable(const uint8_t Interrupt) - { - switch (Interrupt) - { - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - case USB_INT_VBUSTI: - USBCON &= ~(1 << VBUSTE); - break; - #endif - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - USBCON &= ~(1 << IDTE); - break; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - UDIEN &= ~(1 << WAKEUPE); - break; - case USB_INT_SUSPI: - UDIEN &= ~(1 << SUSPE); - break; - case USB_INT_EORSTI: - UDIEN &= ~(1 << EORSTE); - break; - case USB_INT_SOFI: - UDIEN &= ~(1 << SOFE); - break; - case USB_INT_RXSTPI: - UEIENX &= ~(1 << RXSTPE); - break; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - UHIEN &= ~(1 << HSOFE); - break; - case USB_INT_DCONNI: - UHIEN &= ~(1 << DCONNE); - break; - case USB_INT_DDISCI: - UHIEN &= ~(1 << DDISCE); - break; - case USB_INT_RSTI: - UHIEN &= ~(1 << RSTE); - break; - case USB_INT_BCERRI: - OTGIEN &= ~(1 << BCERRE); - break; - case USB_INT_VBERRI: - OTGIEN &= ~(1 << VBERRE); - break; - case USB_INT_SRPI: - OTGIEN &= ~(1 << SRPE); - break; - #endif - } - } - - static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Clear(const uint8_t Interrupt) - { - switch (Interrupt) - { - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - case USB_INT_VBUSTI: - USBINT &= ~(1 << VBUSTI); - break; - #endif - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - USBINT &= ~(1 << IDTI); - break; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - UDINT &= ~(1 << WAKEUPI); - break; - case USB_INT_SUSPI: - UDINT &= ~(1 << SUSPI); - break; - case USB_INT_EORSTI: - UDINT &= ~(1 << EORSTI); - break; - case USB_INT_SOFI: - UDINT &= ~(1 << SOFI); - break; - case USB_INT_RXSTPI: - UEINTX &= ~(1 << RXSTPI); - break; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - UHINT &= ~(1 << HSOFI); - break; - case USB_INT_DCONNI: - UHINT &= ~(1 << DCONNI); - break; - case USB_INT_DDISCI: - UHINT &= ~(1 << DDISCI); - break; - case USB_INT_RSTI: - UHINT &= ~(1 << RSTI); - break; - case USB_INT_BCERRI: - OTGINT &= ~(1 << BCERRI); - break; - case USB_INT_VBERRI: - OTGINT &= ~(1 << VBERRI); - break; - case USB_INT_SRPI: - OTGINT &= ~(1 << SRPI); - break; - #endif - } - } - - static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) - { - switch (Interrupt) - { - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - case USB_INT_VBUSTI: - return (USBCON & (1 << VBUSTE)); - #endif - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - return (USBCON & (1 << IDTE)); - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - return (UDIEN & (1 << WAKEUPE)); - case USB_INT_SUSPI: - return (UDIEN & (1 << SUSPE)); - case USB_INT_EORSTI: - return (UDIEN & (1 << EORSTE)); - case USB_INT_SOFI: - return (UDIEN & (1 << SOFE)); - case USB_INT_RXSTPI: - return (UEIENX & (1 << RXSTPE)); - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - return (UHIEN & (1 << HSOFE)); - case USB_INT_DCONNI: - return (UHIEN & (1 << DCONNE)); - case USB_INT_DDISCI: - return (UHIEN & (1 << DDISCE)); - case USB_INT_RSTI: - return (UHIEN & (1 << RSTE)); - case USB_INT_BCERRI: - return (OTGIEN & (1 << BCERRE)); - case USB_INT_VBERRI: - return (OTGIEN & (1 << VBERRE)); - case USB_INT_SRPI: - return (OTGIEN & (1 << SRPE)); - #endif - } - - return false; - } - - static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) - { - switch (Interrupt) - { - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) - case USB_INT_VBUSTI: - return (USBINT & (1 << VBUSTI)); - #endif - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - return (USBINT & (1 << IDTI)); - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - return (UDINT & (1 << WAKEUPI)); - case USB_INT_SUSPI: - return (UDINT & (1 << SUSPI)); - case USB_INT_EORSTI: - return (UDINT & (1 << EORSTI)); - case USB_INT_SOFI: - return (UDINT & (1 << SOFI)); - case USB_INT_RXSTPI: - return (UEINTX & (1 << RXSTPI)); - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - return (UHINT & (1 << HSOFI)); - case USB_INT_DCONNI: - return (UHINT & (1 << DCONNI)); - case USB_INT_DDISCI: - return (UHINT & (1 << DDISCI)); - case USB_INT_RSTI: - return (UHINT & (1 << RSTI)); - case USB_INT_BCERRI: - return (OTGINT & (1 << BCERRI)); - case USB_INT_VBERRI: - return (OTGINT & (1 << VBERRI)); - case USB_INT_SRPI: - return (OTGINT & (1 << SRPI)); - #endif - } - - return false; - } - - /* Includes: */ - #include "../USBMode.h" - #include "../Events.h" - #include "../USBController.h" - - /* Function Prototypes: */ - void USB_INT_ClearAllInterrupts(void); - void USB_INT_DisableAllInterrupts(void); - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c deleted file mode 100644 index 71cced874e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "ConfigDescriptors.h" - -#if defined(USB_CAN_BE_HOST) -uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber, - uint16_t* const ConfigSizePtr, - void* const BufferPtr, - const uint16_t BufferSize) -{ - uint8_t ErrorCode; - uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)]; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetDescriptor, - .wValue = ((DTYPE_Configuration << 8) | (ConfigNumber - 1)), - .wIndex = 0, - .wLength = sizeof(USB_Descriptor_Configuration_Header_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - *ConfigSizePtr = le16_to_cpu(DESCRIPTOR_PCAST(ConfigHeader, USB_Descriptor_Configuration_Header_t)->TotalConfigurationSize); - - if (*ConfigSizePtr > BufferSize) - return HOST_GETCONFIG_BuffOverflow; - - USB_ControlRequest.wLength = *ConfigSizePtr; - - if ((ErrorCode = USB_Host_SendControlRequest(BufferPtr)) != HOST_SENDCONTROL_Successful) - return ErrorCode; - - if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration) - return HOST_GETCONFIG_InvalidData; - - return HOST_GETCONFIG_Successful; -} -#endif - -void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, - void** const CurrConfigLoc, - const uint8_t Type) -{ - while (*BytesRem) - { - USB_GetNextDescriptor(BytesRem, CurrConfigLoc); - - if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type) - return; - } -} - -void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, - void** const CurrConfigLoc, - const uint8_t Type, - const uint8_t BeforeType) -{ - while (*BytesRem) - { - USB_GetNextDescriptor(BytesRem, CurrConfigLoc); - - if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type) - { - return; - } - else if (DESCRIPTOR_TYPE(*CurrConfigLoc) == BeforeType) - { - *BytesRem = 0; - return; - } - } -} - -void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, - void** const CurrConfigLoc, - const uint8_t Type, - const uint8_t AfterType) -{ - USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, AfterType); - - if (*BytesRem) - USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type); -} - -uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, - void** const CurrConfigLoc, - ConfigComparatorPtr_t const ComparatorRoutine) -{ - uint8_t ErrorCode; - - while (*BytesRem) - { - uint8_t* PrevDescLoc = *CurrConfigLoc; - uint16_t PrevBytesRem = *BytesRem; - - USB_GetNextDescriptor(BytesRem, CurrConfigLoc); - - if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound) - { - if (ErrorCode == DESCRIPTOR_SEARCH_Fail) - { - *CurrConfigLoc = PrevDescLoc; - *BytesRem = PrevBytesRem; - } - - return ErrorCode; - } - } - - return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor; -} - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h deleted file mode 100644 index 0de5982303..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Configuration Descriptor definitions. - * \copydetails Group_ConfigDescriptorParser - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_StdDescriptors - * \defgroup Group_ConfigDescriptorParser Configuration Descriptor Parser - * \brief USB Configuration Descriptor definitions. - * - * This section of the library gives a friendly API which can be used in host applications to easily - * parse an attached device's configuration descriptor so that endpoint, interface and other descriptor - * data can be extracted and used as needed. - * - * @{ - */ - -#ifndef __CONFIGDESCRIPTOR_H__ -#define __CONFIGDESCRIPTOR_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - #include "HostStandardReq.h" - #include "StdDescriptors.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Casts a pointer to a descriptor inside the configuration descriptor into a pointer to the given - * descriptor type. - * - * Usage Example: - * \code - * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header - * USB_Descriptor_Configuration_Header_t* ConfigHeaderPtr = DESCRIPTOR_PCAST(CurrDescriptor, - * USB_Descriptor_Configuration_Header_t); - * - * // Can now access elements of the configuration header struct using the -> indirection operator - * \endcode - */ - #define DESCRIPTOR_PCAST(DescriptorPtr, Type) ((Type*)(DescriptorPtr)) - - /** Casts a pointer to a descriptor inside the configuration descriptor into the given descriptor - * type (as an actual struct instance rather than a pointer to a struct). - * - * Usage Example: - * \code - * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header - * USB_Descriptor_Configuration_Header_t ConfigHeader = DESCRIPTOR_CAST(CurrDescriptor, - * USB_Descriptor_Configuration_Header_t); - * - * // Can now access elements of the configuration header struct using the . operator - * \endcode - */ - #define DESCRIPTOR_CAST(DescriptorPtr, Type) (*DESCRIPTOR_PCAST(DescriptorPtr, Type)) - - /** Returns the descriptor's type, expressed as the 8-bit type value in the header of the descriptor. - * This value's meaning depends on the descriptor's placement in the descriptor, but standard type - * values can be accessed in the \ref USB_DescriptorTypes_t enum. - */ - #define DESCRIPTOR_TYPE(DescriptorPtr) DESCRIPTOR_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Type - - /** Returns the descriptor's size, expressed as the 8-bit value indicating the number of bytes. */ - #define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Size - - /* Type Defines: */ - /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array - * of type void, returning a uint8_t value). - * - * \see \ref USB_GetNextDescriptorComp function for more details. - */ - typedef uint8_t (* ConfigComparatorPtr_t)(void*); - - /* Enums: */ - /** Enum for the possible return codes of the \ref USB_Host_GetDeviceConfigDescriptor() function. */ - enum USB_Host_GetConfigDescriptor_ErrorCodes_t - { - HOST_GETCONFIG_Successful = 0, /**< No error occurred while retrieving the configuration descriptor. */ - HOST_GETCONFIG_DeviceDisconnect = 1, /**< The attached device was disconnected while retrieving the configuration - * descriptor. - */ - HOST_GETCONFIG_PipeError = 2, /**< An error occurred in the pipe while sending the request. */ - HOST_GETCONFIG_SetupStalled = 3, /**< The attached device stalled the request to retrieve the configuration - * descriptor. - */ - HOST_GETCONFIG_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */ - HOST_GETCONFIG_BuffOverflow = 5, /**< The device's configuration descriptor is too large to fit into the allocated - * buffer. - */ - HOST_GETCONFIG_InvalidData = 6, /**< The device returned invalid configuration descriptor data. */ - }; - - /** Enum for return values of a descriptor comparator function. */ - enum DSearch_Return_ErrorCodes_t - { - DESCRIPTOR_SEARCH_Found = 0, /**< Current descriptor matches comparator criteria. */ - DESCRIPTOR_SEARCH_Fail = 1, /**< No further descriptor could possibly match criteria, fail the search. */ - DESCRIPTOR_SEARCH_NotFound = 2, /**< Current descriptor does not match comparator criteria. */ - }; - - /** Enum for return values of \ref USB_GetNextDescriptorComp(). */ - enum DSearch_Comp_Return_ErrorCodes_t - { - DESCRIPTOR_SEARCH_COMP_Found = 0, /**< Configuration descriptor now points to descriptor which matches - * search criteria of the given comparator function. */ - DESCRIPTOR_SEARCH_COMP_Fail = 1, /**< Comparator function returned \ref DESCRIPTOR_SEARCH_Fail. */ - DESCRIPTOR_SEARCH_COMP_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */ - }; - - /* Function Prototypes: */ - /** Retrieves the configuration descriptor data from an attached device via a standard request into a buffer, - * including validity and size checking to prevent a buffer overflow. - * - * \param[in] ConfigNumber Device configuration descriptor number to fetch from the device (usually set to 1 for - * single configuration devices). - * \param[in,out] ConfigSizePtr Pointer to a location for storing the retrieved configuration descriptor size. - * \param[out] BufferPtr Pointer to the buffer for storing the configuration descriptor data. - * \param[out] BufferSize Size of the allocated buffer where the configuration descriptor is to be stored. - * - * \return A value from the \ref USB_Host_GetConfigDescriptor_ErrorCodes_t enum. - */ - uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber, - uint16_t* const ConfigSizePtr, - void* const BufferPtr, - const uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); - - /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value. - * The bytes remaining value is automatically decremented. - * - * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. - * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. - * \param[in] Type Descriptor type value to search for. - */ - void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, - void** const CurrConfigLoc, - const uint8_t Type) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value, - * which must come before a descriptor of the second given type value. If the BeforeType type - * descriptor is reached first, the number of bytes remaining to process is set to zero and the - * function exits. The bytes remaining value is automatically decremented. - * - * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. - * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. - * \param[in] Type Descriptor type value to search for. - * \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor. - */ - void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, - void** const CurrConfigLoc, - const uint8_t Type, - const uint8_t BeforeType) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value, - * which must come after a descriptor of the second given type value. The bytes remaining value is - * automatically decremented. - * - * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. - * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. - * \param[in] Type Descriptor type value to search for. - * \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor. - */ - void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, - void** const CurrConfigLoc, - const uint8_t Type, - const uint8_t AfterType) - ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - - /** Searches for the next descriptor in the given configuration descriptor using a pre-made comparator - * function. The routine updates the position and remaining configuration descriptor bytes values - * automatically. If a comparator routine fails a search, the descriptor pointer is retreated back - * so that the next descriptor search invocation will start from the descriptor which first caused the - * original search to fail. This behavior allows for one comparator to be used immediately after another - * has failed, starting the second search from the descriptor which failed the first. - * - * Comparator functions should be standard functions which accept a pointer to the header of the current - * descriptor inside the configuration descriptor which is being compared, and should return a value from - * the \ref DSearch_Return_ErrorCodes_t enum as a uint8_t value. - * - * \note This function is available in USB Host mode only. - * - * \param[in,out] BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor. - * \param[in,out] CurrConfigLoc Pointer to the current position in the configuration descriptor. - * \param[in] ComparatorRoutine Name of the comparator search function to use on the configuration descriptor. - * - * \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum. - * - * Usage Example: - * \code - * uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype - * - * uint8_t EndpointSearcher(void* CurrentDescriptor) - * { - * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) - * return DESCRIPTOR_SEARCH_Found; - * else - * return DESCRIPTOR_SEARCH_NotFound; - * } - * - * //... - * - * // After retrieving configuration descriptor: - * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &CurrentConfigLoc, EndpointSearcher) == - * Descriptor_Search_Comp_Found) - * { - * // Do something with the endpoint descriptor - * } - * \endcode - */ - uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, - void** const CurrConfigLoc, - ConfigComparatorPtr_t const ComparatorRoutine); - - /* Inline Functions: */ - /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then - points to the next sub-descriptor. The bytes remaining value is automatically decremented. - * - * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. - * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. - */ - static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, - void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); - static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, - void** CurrConfigLoc) - { - uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size; - - if (*BytesRem < CurrDescriptorSize) - CurrDescriptorSize = *BytesRem; - - *CurrConfigLoc = (void*)((uintptr_t)*CurrConfigLoc + CurrDescriptorSize); - *BytesRem -= CurrDescriptorSize; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h deleted file mode 100644 index 995b9208e8..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common USB Device definitions for all architectures. - * \copydetails Group_Device - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_Device Device Management - * \brief USB Device management definitions for USB device mode. - * - * USB Device mode related definitions common to all architectures. This module contains definitions which - * are used when the USB controller is initialized in device mode. - * - * @{ - */ - -#ifndef __USBDEVICE_H__ -#define __USBDEVICE_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - #include "StdDescriptors.h" - #include "USBInterrupt.h" - #include "Endpoint.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Enums: */ - /** Enum for the various states of the USB Device state machine. Only some states are - * implemented in the LUFA library - other states are left to the user to implement. - * - * For information on each possible USB device state, refer to the USB 2.0 specification. - * - * \see \ref USB_DeviceState, which stores the current device state machine state. - */ - enum USB_Device_States_t - { - DEVICE_STATE_Unattached = 0, /**< Internally implemented by the library. This state indicates - * that the device is not currently connected to a host. - */ - DEVICE_STATE_Powered = 1, /**< Internally implemented by the library. This state indicates - * that the device is connected to a host, but enumeration has not - * yet begun. - */ - DEVICE_STATE_Default = 2, /**< Internally implemented by the library. This state indicates - * that the device's USB bus has been reset by the host and it is - * now waiting for the host to begin the enumeration process. - */ - DEVICE_STATE_Addressed = 3, /**< Internally implemented by the library. This state indicates - * that the device has been addressed by the USB Host, but is not - * yet configured. - */ - DEVICE_STATE_Configured = 4, /**< May be implemented by the user project. This state indicates - * that the device has been enumerated by the host and is ready - * for USB communications to begin. - */ - DEVICE_STATE_Suspended = 5, /**< May be implemented by the user project. This state indicates - * that the USB bus has been suspended by the host, and the device - * should power down to a minimal power level until the bus is - * resumed. - */ - }; - - /* Function Prototypes: */ - /** Function to retrieve a given descriptor's size and memory location from the given descriptor type value, - * index and language ID. This function MUST be overridden in the user application (added with full, identical - * prototype and name so that the library can call it to retrieve descriptor data. - * - * \param[in] wValue The type of the descriptor to retrieve in the upper byte, and the index in the - * lower byte (when more than one descriptor of the given type exists, such as the - * case of string descriptors). The type may be one of the standard types defined - * in the DescriptorTypes_t enum, or may be a class-specific descriptor type value. - * \param[in] wIndex The language ID of the string to return if the \c wValue type indicates - * \ref DTYPE_String, otherwise zero for standard descriptors, or as defined in a - * class-specific standards. - * \param[out] DescriptorAddress Pointer to the descriptor in memory. This should be set by the routine to - * the address of the descriptor. - * \param[out] DescriptorMemorySpace A value from the \ref USB_DescriptorMemorySpaces_t enum to indicate the memory - * space in which the descriptor is stored. This parameter does not exist when one - * of the \c USE_*_DESCRIPTORS compile time options is used, or on architectures which - * use a unified address space. - * - * \note By default, the library expects all descriptors to be located in flash memory via the \c PROGMEM attribute. - * If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to - * allow the descriptors to be changed dynamically at runtime) either the \c USE_RAM_DESCRIPTORS or the - * \c USE_EEPROM_DESCRIPTORS tokens may be defined in the project makefile and passed to the compiler by the -D - * switch. - * - * \return Size in bytes of the descriptor if it exists, zero or \ref NO_DESCRIPTOR otherwise. - */ - uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint8_t wIndex, - const void** const DescriptorAddress - #if (defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__)) && \ - !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) - , uint8_t* const DescriptorMemorySpace - #endif - ) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/Device_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/Device_UC3.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/Device_XMEGA.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c deleted file mode 100644 index c4ae647129..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#define __INCLUDE_FROM_DEVICESTDREQ_C -#include "DeviceStandardReq.h" - -uint8_t USB_Device_ConfigurationNumber; - -#if !defined(NO_DEVICE_SELF_POWER) -bool USB_Device_CurrentlySelfPowered; -#endif - -#if !defined(NO_DEVICE_REMOTE_WAKEUP) -bool USB_Device_RemoteWakeupEnabled; -#endif - -void USB_Device_ProcessControlRequest(void) -{ - #if defined(ARCH_BIG_ENDIAN) - USB_ControlRequest.bmRequestType = Endpoint_Read_8(); - USB_ControlRequest.bRequest = Endpoint_Read_8(); - USB_ControlRequest.wValue = Endpoint_Read_16_LE(); - USB_ControlRequest.wIndex = Endpoint_Read_16_LE(); - USB_ControlRequest.wLength = Endpoint_Read_16_LE(); - #else - uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; - - for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++) - *(RequestHeader++) = Endpoint_Read_8(); - #endif - - EVENT_USB_Device_ControlRequest(); - - if (Endpoint_IsSETUPReceived()) - { - uint8_t bmRequestType = USB_ControlRequest.bmRequestType; - - switch (USB_ControlRequest.bRequest) - { - case REQ_GetStatus: - if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) || - (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT))) - { - USB_Device_GetStatus(); - } - - break; - case REQ_ClearFeature: - case REQ_SetFeature: - if ((bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) || - (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT))) - { - USB_Device_ClearSetFeature(); - } - - break; - case REQ_SetAddress: - if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) - USB_Device_SetAddress(); - - break; - case REQ_GetDescriptor: - if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) || - (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE))) - { - USB_Device_GetDescriptor(); - } - - break; - case REQ_GetConfiguration: - if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) - USB_Device_GetConfiguration(); - - break; - case REQ_SetConfiguration: - if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) - USB_Device_SetConfiguration(); - - break; - } - } - - if (Endpoint_IsSETUPReceived()) - { - Endpoint_StallTransaction(); - Endpoint_ClearSETUP(); - } -} - -static void USB_Device_SetAddress(void) -{ - uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - Endpoint_ClearSETUP(); - - Endpoint_ClearStatusStage(); - - while (!(Endpoint_IsINReady())); - - USB_Device_SetDeviceAddress(DeviceAddress); - USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default; - - SetGlobalInterruptMask(CurrentGlobalInt); -} - -static void USB_Device_SetConfiguration(void) -{ - #if defined(FIXED_NUM_CONFIGURATIONS) - if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS) - return; - #else - USB_Descriptor_Device_t* DevDescriptorPtr; - - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) - #if defined(USE_FLASH_DESCRIPTORS) - #define MemoryAddressSpace MEMSPACE_FLASH - #elif defined(USE_EEPROM_DESCRIPTORS) - #define MemoryAddressSpace MEMSPACE_EEPROM - #elif defined(USE_SRAM_DESCRIPTORS) - #define MemoryAddressSpace MEMSPACE_SRAM - #else - uint8_t MemoryAddressSpace; - #endif - #endif - - if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ - !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) - , &MemoryAddressSpace - #endif - ) == NO_DESCRIPTOR) - { - return; - } - - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) - if (MemoryAddressSpace == MEMSPACE_FLASH) - { - if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte(&DevDescriptorPtr->NumberOfConfigurations))) - return; - } - else if (MemoryAddressSpace == MEMSPACE_EEPROM) - { - if (((uint8_t)USB_ControlRequest.wValue > eeprom_read_byte(&DevDescriptorPtr->NumberOfConfigurations))) - return; - } - else - { - if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations) - return; - } - #else - if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations) - return; - #endif - #endif - - Endpoint_ClearSETUP(); - - USB_Device_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue; - - Endpoint_ClearStatusStage(); - - if (USB_Device_ConfigurationNumber) - USB_DeviceState = DEVICE_STATE_Configured; - else - USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; - - EVENT_USB_Device_ConfigurationChanged(); -} - -static void USB_Device_GetConfiguration(void) -{ - Endpoint_ClearSETUP(); - - Endpoint_Write_8(USB_Device_ConfigurationNumber); - Endpoint_ClearIN(); - - Endpoint_ClearStatusStage(); -} - -#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) -static void USB_Device_GetInternalSerialDescriptor(void) -{ - struct - { - USB_Descriptor_Header_t Header; - uint16_t UnicodeString[INTERNAL_SERIAL_LENGTH_BITS / 4]; - } SignatureDescriptor; - - SignatureDescriptor.Header.Type = DTYPE_String; - SignatureDescriptor.Header.Size = USB_STRING_LEN(INTERNAL_SERIAL_LENGTH_BITS / 4); - - USB_Device_GetSerialString(SignatureDescriptor.UnicodeString); - - Endpoint_ClearSETUP(); - - Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor)); - Endpoint_ClearOUT(); -} -#endif - -static void USB_Device_GetDescriptor(void) -{ - const void* DescriptorPointer; - uint16_t DescriptorSize; - - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ - !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) - uint8_t DescriptorAddressSpace; - #endif - - #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) - if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL)) - { - USB_Device_GetInternalSerialDescriptor(); - return; - } - #endif - - if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex, - &DescriptorPointer - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ - !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) - , &DescriptorAddressSpace - #endif - )) == NO_DESCRIPTOR) - { - return; - } - - Endpoint_ClearSETUP(); - - #if defined(USE_RAM_DESCRIPTORS) || !defined(ARCH_HAS_MULTI_ADDRESS_SPACE) - Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize); - #elif defined(USE_EEPROM_DESCRIPTORS) - Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize); - #elif defined(USE_FLASH_DESCRIPTORS) - Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize); - #else - if (DescriptorAddressSpace == MEMSPACE_FLASH) - Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize); - else if (DescriptorAddressSpace == MEMSPACE_EEPROM) - Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize); - else - Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize); - #endif - - Endpoint_ClearOUT(); -} - -static void USB_Device_GetStatus(void) -{ - uint8_t CurrentStatus = 0; - - switch (USB_ControlRequest.bmRequestType) - { - case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE): - #if !defined(NO_DEVICE_SELF_POWER) - if (USB_Device_CurrentlySelfPowered) - CurrentStatus |= FEATURE_SELFPOWERED_ENABLED; - #endif - - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - if (USB_Device_RemoteWakeupEnabled) - CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED; - #endif - break; - case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT): - #if !defined(CONTROL_ONLY_DEVICE) - Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); - - CurrentStatus = Endpoint_IsStalled(); - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - #endif - - break; - default: - return; - } - - Endpoint_ClearSETUP(); - - Endpoint_Write_16_LE(CurrentStatus); - Endpoint_ClearIN(); - - Endpoint_ClearStatusStage(); -} - -static void USB_Device_ClearSetFeature(void) -{ - switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) - { - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - case REQREC_DEVICE: - if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup) - USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature); - else - return; - - break; - #endif - #if !defined(CONTROL_ONLY_DEVICE) - case REQREC_ENDPOINT: - if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt) - { - uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); - - if (EndpointIndex == ENDPOINT_CONTROLEP) - return; - - Endpoint_SelectEndpoint(EndpointIndex); - - if (Endpoint_IsEnabled()) - { - if (USB_ControlRequest.bRequest == REQ_SetFeature) - { - Endpoint_StallTransaction(); - } - else - { - Endpoint_ClearStall(); - Endpoint_ResetEndpoint(EndpointIndex); - Endpoint_ResetDataToggle(); - } - } - } - - break; - #endif - default: - return; - } - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - - Endpoint_ClearSETUP(); - - Endpoint_ClearStatusStage(); -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h deleted file mode 100644 index dfaa1662e9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB device standard request management. - * - * This file contains the function prototypes necessary for the processing of incoming standard control requests - * when the library is in USB device mode. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __DEVICESTDREQ_H__ -#define __DEVICESTDREQ_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - #include "StdDescriptors.h" - #include "Events.h" - #include "StdRequestType.h" - #include "USBTask.h" - #include "USBController.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Enums: */ - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__) - /** Enum for the possible descriptor memory spaces, for the \c MemoryAddressSpace parameter of the - * \ref CALLBACK_USB_GetDescriptor() function. This can be used when none of the \c USE_*_DESCRIPTORS - * compile time options are used, to indicate in which memory space the descriptor is stored. - * - * \ingroup Group_Device - */ - enum USB_DescriptorMemorySpaces_t - { - #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) || defined(__DOXYGEN__) - MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory. */ - #endif - #if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) || defined(__DOXYGEN__) - MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory. */ - #endif - MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */ - }; - #endif - - /* Global Variables: */ - /** Indicates the currently set configuration number of the device. USB devices may have several - * different configurations which the host can select between; this indicates the currently selected - * value, or 0 if no configuration has been selected. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \ingroup Group_Device - */ - extern uint8_t USB_Device_ConfigurationNumber; - - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - /** Indicates if the host is currently allowing the device to issue remote wakeup events. If this - * flag is cleared, the device should not issue remote wakeup events to the host. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported, - * this global and the underlying management code can be disabled by defining the - * \c NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via - * the -D switch. - * - * \ingroup Group_Device - */ - extern bool USB_Device_RemoteWakeupEnabled; - #endif - - #if !defined(NO_DEVICE_SELF_POWER) - /** Indicates if the device is currently being powered by its own power supply, rather than being - * powered by the host's USB supply. This flag should remain cleared if the device does not - * support self powered mode, as indicated in the device descriptors. - * - * \ingroup Group_Device - */ - extern bool USB_Device_CurrentlySelfPowered; - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) - #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. - #elif defined(USE_RAM_DESCRIPTORS) && defined(USE_FLASH_DESCRIPTORS) - #error USE_RAM_DESCRIPTORS and USE_FLASH_DESCRIPTORS are mutually exclusive. - #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) - #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. - #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS) - #error Only one of the USE_*_DESCRIPTORS modes should be selected. - #endif - - /* Function Prototypes: */ - void USB_Device_ProcessControlRequest(void); - - #if defined(__INCLUDE_FROM_DEVICESTDREQ_C) - static void USB_Device_SetAddress(void); - static void USB_Device_SetConfiguration(void); - static void USB_Device_GetConfiguration(void); - static void USB_Device_GetDescriptor(void); - static void USB_Device_GetStatus(void); - static void USB_Device_ClearSetFeature(void); - - #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) - static void USB_Device_GetInternalSerialDescriptor(void); - #endif - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h deleted file mode 100644 index a6ca64dd2b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Endpoint definitions for all architectures. - * \copydetails Group_EndpointManagement - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointManagement - * \defgroup Group_EndpointRW Endpoint Data Reading and Writing - * \brief Endpoint data read/write definitions. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. - */ - -/** \ingroup Group_EndpointRW - * \defgroup Group_EndpointPrimitiveRW Read/Write of Primitive Data Types - * \brief Endpoint data primitive read/write definitions. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to endpoints. - */ - -/** \ingroup Group_EndpointManagement - * \defgroup Group_EndpointPacketManagement Endpoint Packet Management - * \brief USB Endpoint package management definitions. - * - * Functions, macros, variables, enums and types related to packet management of endpoints. - */ - -/** \ingroup Group_USB - * \defgroup Group_EndpointManagement Endpoint Management - * \brief Endpoint management definitions. - * - * Functions, macros and enums related to endpoint management when in USB Device mode. This - * module contains the endpoint management macros, as well as endpoint interrupt and data - * send/receive functions for various data types. - * - * @{ - */ - -#ifndef __ENDPOINT_H__ -#define __ENDPOINT_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** Type define for a endpoint table entry, used to configure endpoints in groups via - * \ref Endpoint_ConfigureEndpointTable(). - */ - typedef struct - { - uint8_t Address; /**< Address of the endpoint to configure, or zero if the table entry is to be unused. */ - uint16_t Size; /**< Size of the endpoint bank, in bytes. */ - uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */ - uint8_t Banks; /**< Number of hardware banks to use for the endpoint. */ - } USB_Endpoint_Table_t; - - /* Macros: */ - /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's - * numerical address in the device. - */ - #define ENDPOINT_EPNUM_MASK 0x0F - - /** Endpoint address for the default control endpoint, which always resides in address 0. This is - * defined for convenience to give more readable code when used with the endpoint macros. - */ - #define ENDPOINT_CONTROLEP 0 - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/Endpoint_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/Endpoint_UC3.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/Endpoint_XMEGA.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h deleted file mode 100644 index 89df381ae9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management. - * \copydetails Group_EndpointStreamRW - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointRW - * \defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams - * \brief Endpoint data stream transmission and reception management. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_H__ -#define __ENDPOINT_STREAM_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Enums: */ - /** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */ - enum Endpoint_Stream_RW_ErrorCodes_t - { - ENDPOINT_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ - ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream - * transfer by the host or device. - */ - ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during - * the transfer. - */ - ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and - * no USB endpoint traffic can occur until the bus - * has resumed. - */ - ENDPOINT_RWSTREAM_Timeout = 4, /**< The host failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - ENDPOINT_RWSTREAM_IncompleteTransfer = 5, /**< Indicates that the endpoint bank became full or empty before - * the complete contents of the current stream could be - * transferred. The endpoint stream function should be called - * again to process the next chunk of data in the transfer. - */ - }; - - /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */ - enum Endpoint_ControlStream_RW_ErrorCodes_t - { - ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */ - ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */ - ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during - * the transfer. - */ - ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and - * no USB endpoint traffic can occur until the bus - * has resumed. - */ - }; - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/EndpointStream_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/EndpointStream_UC3.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/EndpointStream_XMEGA.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c deleted file mode 100644 index 5f50430607..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_EVENTS_C -#define __INCLUDE_FROM_USB_DRIVER -#include "Events.h" - -// cppcheck-suppress unusedFunction -void USB_Event_Stub(void) -{ - -} - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h deleted file mode 100644 index 33db543d45..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Event management definitions. - * \copydetails Group_Events - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_Events USB Events - * \brief USB Event management definitions. - * - * This module contains macros and functions relating to the management of library events, which are small - * pieces of code similar to ISRs which are run when a given condition is met. Each event can be fired from - * multiple places in the user or library code, which may or may not be inside an ISR, thus each handler - * should be written to be as small and fast as possible to prevent possible problems. - * - * Events can be hooked by the user application by declaring a handler function with the same name and parameters - * listed here. If an event with no user-associated handler is fired within the library, it by default maps to an - * internal empty stub function. - * - * Each event must only have one associated event handler, but can be raised by multiple sources by calling the - * event handler function (with any required event parameters). - * - * @{ - */ - -#ifndef __USBEVENTS_H__ -#define __USBEVENTS_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Pseudo-Functions for Doxygen: */ - #if !defined(__INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__) - /** Event for USB mode pin level change. This event fires when the USB interface is set to dual role - * mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires - * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Device_Disconnect - * event has fired (if disconnected before the role change). - * - * \note This event only exists on microcontrollers that support dual role USB modes. - * \n\n - * - * \note This event does not exist if the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY tokens have been supplied - * to the compiler (see \ref Group_USBManagement documentation). - */ - void EVENT_USB_UIDChange(void); - - /** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB - * interface is in host mode. - * - * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t. - * - * \note This event only exists on microcontrollers that supports USB host mode. - * \n\n - * - * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_Host_HostError(const uint8_t ErrorCode); - - /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and - * a USB device has been connected to the USB interface. This is interrupt driven, thus fires before - * the standard \ref EVENT_USB_Device_Connect() event and so can be used to programmatically start the USB - * management task to reduce CPU consumption. - * - * \note This event only exists on microcontrollers that supports USB host mode. - * \n\n - * - * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - * - * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. - */ - void EVENT_USB_Host_DeviceAttached(void); - - /** Event for USB device removal. This event fires when a the USB interface is in host mode, and - * a USB device has been removed the USB interface whether or not it has been enumerated. This - * can be used to programmatically stop the USB management task to reduce CPU consumption. - * - * \note This event only exists on microcontrollers that supports USB host mode. - * \n\n - * - * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - * - * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. - */ - void EVENT_USB_Host_DeviceUnattached(void); - - /** Event for USB device enumeration failure. This event fires when a the USB interface is - * in host mode, and an attached USB device has failed to enumerate completely. - * - * \param[in] ErrorCode Error code indicating the failure reason, a value in - * \ref USB_Host_EnumerationErrorCodes_t. - * - * \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the - * ErrorCode parameter indicates a control error, this will give the error - * code returned by the \ref USB_Host_SendControlRequest() function. - * - * \note This event only exists on microcontrollers that supports USB host mode. - * \n\n - * - * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, - const uint8_t SubErrorCode); - - /** Event for USB device enumeration completion. This event fires when a the USB interface is - * in host mode and an attached USB device has been completely enumerated and is ready to be - * controlled by the user application. - * - * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around - * 1 second) when a transaction is waiting to be processed by the device will prevent break communications - * and cause the host to reset the USB bus. - */ - void EVENT_USB_Host_DeviceEnumerationComplete(void); - - /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB - * frame, once per millisecond, and is synchronized to the USB bus. This can be used as an accurate - * millisecond timer source when the USB bus is not suspended while in host mode. - * - * This event is time-critical; it is run once per millisecond and thus long handlers will significantly - * degrade device performance. This event should only be enabled when needed to reduce device wake-ups. - * - * \note This event is not normally active - it must be manually enabled and disabled via the - * \ref USB_Host_EnableSOFEvents() and \ref USB_Host_DisableSOFEvents() commands after enumeration of - * a USB device. - * \n\n - * - * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_Host_StartOfFrame(void); - - /** Event for USB device connection. This event fires when the microcontroller is in USB Device mode - * and the device is connected to a USB host, beginning the enumeration process measured by a rising - * level on the microcontroller's VBUS sense pin. - * - * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around - * two seconds) will prevent the device from enumerating correctly. - * - * \attention This event may fire multiple times during device enumeration on the microcontrollers with limited USB controllers - * if \c NO_LIMITED_CONTROLLER_CONNECT is not defined. - * - * \note For the microcontrollers with limited USB controller functionality, VBUS sensing is not available. - * this means that the current connection state is derived from the bus suspension and wake up events by default, - * which is not always accurate (host may suspend the bus while still connected). If the actual connection state - * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behavior turned off by - * passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection - * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. - * \n\n - * - * \see \ref Group_USBManagement for more information on the USB management task and reducing CPU usage. - */ - void EVENT_USB_Device_Connect(void); - - /** Event for USB device disconnection. This event fires when the microcontroller is in USB Device mode and the device is - * disconnected from a host, measured by a falling level on the microcontroller's VBUS sense pin. - * - * \attention This event may fire multiple times during device enumeration on the microcontrollers with limited USB controllers - * if \c NO_LIMITED_CONTROLLER_CONNECT is not defined. - * - * \note For the microcontrollers with limited USB controllers, VBUS sense is not available to the USB controller. - * this means that the current connection state is derived from the bus suspension and wake up events by default, - * which is not always accurate (host may suspend the bus while still connected). If the actual connection state - * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behavior turned off by - * passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection - * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. - * \n\n - * - * \see \ref Group_USBManagement for more information on the USB management task and reducing CPU usage. - */ - void EVENT_USB_Device_Disconnect(void); - - /** Event for control requests. This event fires when a the USB host issues a control request - * to the mandatory device control endpoint (of address 0). This may either be a standard - * request that the library may have a handler code for internally, or a class specific request - * issued to the device which must be handled appropriately. If a request is not processed in the - * user application via this event, it will be passed to the library for processing internally - * if a suitable handler exists. - * - * This event is time-critical; each packet within the request transaction must be acknowledged or - * sent within 50ms or the host will abort the transfer. - * - * The library internally handles all standard control requests with the exceptions of SYNC FRAME, - * SET DESCRIPTOR and SET INTERFACE. These and all other non-standard control requests will be left - * for the user to process via this event if desired. If not handled in the user application or by - * the library internally, unknown requests are automatically STALLed. - * - * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - * \n\n - * - * \note Requests should be handled in the same manner as described in the USB 2.0 Specification, - * or appropriate class specification. In all instances, the library has already read the - * request SETUP parameters into the \ref USB_ControlRequest structure which should then be used - * by the application to determine how to handle the issued request. - */ - void EVENT_USB_Device_ControlRequest(void); - - /** Event for USB configuration number changed. This event fires when a the USB host changes the - * selected configuration number while in device mode. This event should be hooked in device - * applications to create the endpoints and configure the device for the selected configuration. - * - * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around - * one second) will prevent the device from enumerating correctly. - * - * This event fires after the value of \ref USB_Device_ConfigurationNumber has been changed. - * - * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_Device_ConfigurationChanged(void); - - /** Event for USB suspend. This event fires when a the USB host suspends the device by halting its - * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move - * the device over to a low power state until the host wakes up the device. If the USB interface is - * enumerated with the \ref USB_OPT_AUTO_PLL option set, the library will automatically suspend the - * USB PLL before the event is fired to save power. - * - * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - * \n\n - * - * \note This event does not exist on the microcontrollers with limited USB VBUS sensing abilities - * when the \c NO_LIMITED_CONTROLLER_CONNECT compile time token is not set - see - * \ref EVENT_USB_Device_Disconnect. - * - * \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event. - */ - void EVENT_USB_Device_Suspend(void); - - /** Event for USB wake up. This event fires when a the USB interface is suspended while in device - * mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally - * hooked to pull the user application out of a low power state and back into normal operating - * mode. If the USB interface is enumerated with the \ref USB_OPT_AUTO_PLL option set, the library - * will automatically restart the USB PLL before the event is fired. - * - * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - * \n\n - * - * \note This event does not exist on the microcontrollers with limited USB VBUS sensing abilities - * when the \c NO_LIMITED_CONTROLLER_CONNECT compile time token is not set - see - * \ref EVENT_USB_Device_Disconnect. - * - * \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event. - */ - void EVENT_USB_Device_WakeUp(void); - - /** Event for USB interface reset. This event fires when the USB interface is in device mode, and - * a the USB host requests that the device reset its interface. This event fires after the control - * endpoint has been automatically configured by the library. - * - * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around - * two seconds) will prevent the device from enumerating correctly. - * - * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_Device_Reset(void); - - /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB - * frame, once per millisecond, and is synchronized to the USB bus. This can be used as an accurate - * millisecond timer source when the USB bus is enumerated in device mode to a USB host. - * - * This event is time-critical; it is run once per millisecond and thus long handlers will significantly - * degrade device performance. This event should only be enabled when needed to reduce device wake-ups. - * - * \pre This event is not normally active - it must be manually enabled and disabled via the - * \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration. - * \n\n - * - * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_Device_StartOfFrame(void); - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_EVENTS_C) - void USB_Event_Stub(void) ATTR_CONST; - - #if defined(USB_CAN_BE_BOTH) - void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - #endif - - #if defined(USB_CAN_BE_HOST) - void EVENT_USB_Host_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Host_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Host_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Host_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, - const uint8_t SubErrorCode) - ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Host_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - #endif - - #if defined(USB_CAN_BE_DEVICE) - void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_ControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_Device_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - #endif - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h deleted file mode 100644 index bf2225f31e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common USB Host definitions for all architectures. - * \copydetails Group_Host - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_Host Host Management - * \brief USB Host management definitions for USB host mode. - * - * USB Host mode related macros and enums. This module contains macros and enums which are used when - * the USB controller is initialized in host mode. - * - * @{ - */ - -#ifndef __USBHOST_H__ -#define __USBHOST_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Enums: */ - /** Enum for the various states of the USB Host state machine. - * - * For information on each possible USB host state, refer to the USB 2.0 specification. - * Several of the USB host states are broken up further into multiple smaller sub-states, - * so that they can be internally implemented inside the library in an efficient manner. - * - * \see \ref USB_HostState, which stores the current host state machine state. - */ - enum USB_Host_States_t - { - HOST_STATE_WaitForDevice = 0, /**< This state indicates that the stack is waiting for an interval - * to elapse before continuing with the next step of the device - * enumeration process. - */ - HOST_STATE_Unattached = 1, /**< This state indicates that the host state machine is waiting for - * a device to be attached so that it can start the enumeration process. - */ - HOST_STATE_Powered = 2, /**< This state indicates that a device has been attached, and the - * library's internals are being configured to begin the enumeration - * process. - */ - HOST_STATE_Powered_WaitForDeviceSettle = 3, /**< This state indicates that the stack is waiting for the initial - * settling period to elapse before beginning the enumeration process. - */ - HOST_STATE_Powered_WaitForConnect = 4, /**< This state indicates that the stack is waiting for a connection event - * from the USB controller to indicate a valid USB device has been attached - * to the bus and is ready to be enumerated. - */ - HOST_STATE_Powered_DoReset = 5, /**< This state indicates that a valid USB device has been attached, and that - * it will now be reset to ensure it is ready for enumeration. - */ - HOST_STATE_Powered_ConfigPipe = 6, /**< This state indicates that the attached device is currently powered and - * reset, and that the control pipe is now being configured by the stack. - */ - HOST_STATE_Default = 7, /**< This state indicates that the stack is currently retrieving the control - * endpoint's size from the device, so that the control pipe can be altered - * to match. - */ - HOST_STATE_Default_PostReset = 8, /**< This state indicates that the control pipe is being reconfigured to match - * the retrieved control endpoint size from the device, and the device's USB - * bus address is being set. - */ - HOST_STATE_Default_PostAddressSet = 9, /**< This state indicates that the device's address has now been set, and the - * stack is has now completed the device enumeration process. This state causes - * the stack to change the current USB device address to that set for the - * connected device, before progressing to the \ref HOST_STATE_Addressed state - * ready for use in the user application. - */ - HOST_STATE_Addressed = 10, /**< Indicates that the device has been enumerated and addressed, and is now waiting - * for the user application to configure the device ready for use. - */ - HOST_STATE_Configured = 11, /**< Indicates that the device has been configured into a valid device configuration, - * ready for general use by the user application. - */ - }; - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/Host_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/Host_UC3.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c deleted file mode 100644 index 3242822f76..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_HOSTSTDREQ_C -#include "HostStandardReq.h" - -uint8_t USB_Host_ConfigurationNumber; - -static uint8_t USB_Host_SendControlRequest_PRV(void* const BufferPtr) -{ - uint8_t* DataStream = (uint8_t*)BufferPtr; - uint8_t ReturnStatus = HOST_SENDCONTROL_Successful; - uint16_t DataLen = USB_ControlRequest.wLength; - - USB_Host_ResumeBus(); - - if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) - return ReturnStatus; - - Pipe_SetPipeToken(PIPE_TOKEN_SETUP); - Pipe_ClearError(); - - Pipe_Unfreeze(); - - #if defined(ARCH_BIG_ENDIAN) - Pipe_Write_8(USB_ControlRequest.bmRequestType); - Pipe_Write_8(USB_ControlRequest.bRequest); - Pipe_Write_16_LE(USB_ControlRequest.wValue); - Pipe_Write_16_LE(USB_ControlRequest.wIndex); - Pipe_Write_16_LE(USB_ControlRequest.wLength); - #else - uint8_t* HeaderStream = (uint8_t*)&USB_ControlRequest; - - for (uint8_t HeaderByte = 0; HeaderByte < sizeof(USB_Request_Header_t); HeaderByte++) - Pipe_Write_8(*(HeaderStream++)); - #endif - - Pipe_ClearSETUP(); - - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - - Pipe_Freeze(); - - if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) - return ReturnStatus; - - if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) == REQDIR_DEVICETOHOST) - { - Pipe_SetPipeToken(PIPE_TOKEN_IN); - - if (DataStream != NULL) - { - while (DataLen) - { - Pipe_Unfreeze(); - - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - - if (!(Pipe_BytesInPipe())) - DataLen = 0; - - while (Pipe_BytesInPipe() && DataLen) - { - *(DataStream++) = Pipe_Read_8(); - DataLen--; - } - - Pipe_Freeze(); - Pipe_ClearIN(); - } - } - - Pipe_SetPipeToken(PIPE_TOKEN_OUT); - Pipe_Unfreeze(); - - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - - Pipe_ClearOUT(); - - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - } - else - { - if (DataStream != NULL) - { - Pipe_SetPipeToken(PIPE_TOKEN_OUT); - Pipe_Unfreeze(); - - while (DataLen) - { - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - - while (DataLen && (Pipe_BytesInPipe() < USB_Host_ControlPipeSize)) - { - Pipe_Write_8(*(DataStream++)); - DataLen--; - } - - Pipe_ClearOUT(); - } - - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - - Pipe_Freeze(); - } - - Pipe_SetPipeToken(PIPE_TOKEN_IN); - Pipe_Unfreeze(); - - if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful) - return ReturnStatus; - - Pipe_ClearIN(); - } - - return ReturnStatus; -} - -static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType) -{ - #if (USB_HOST_TIMEOUT_MS < 0xFF) - uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS; - #else - uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS; - #endif - - while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) || - ((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) || - ((WaitType == USB_HOST_WAITFOR_OutReady) && Pipe_IsOUTReady()))) - { - uint8_t ErrorCode; - - if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) - return ErrorCode; - - if (!(TimeoutCounter--)) - return HOST_SENDCONTROL_SoftwareTimeOut; - } - - return HOST_SENDCONTROL_Successful; -} - -uint8_t USB_Host_SendControlRequest(void* const BufferPtr) -{ - bool BusSuspended = USB_Host_IsBusSuspended(); - uint8_t ReturnStatus = USB_Host_SendControlRequest_PRV(BufferPtr); - - Pipe_Freeze(); - - if (BusSuspended) - USB_Host_SuspendBus(); - - Pipe_ResetPipe(PIPE_CONTROLPIPE); - - return ReturnStatus; -} - -uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber) -{ - uint8_t ErrorCode; - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_SetConfiguration, - .wValue = ConfigNumber, - .wIndex = 0, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - if ((ErrorCode = USB_Host_SendControlRequest(NULL)) == HOST_SENDCONTROL_Successful) - { - USB_Host_ConfigurationNumber = ConfigNumber; - USB_HostState = (ConfigNumber) ? HOST_STATE_Configured : HOST_STATE_Addressed; - } - - return ErrorCode; -} - -uint8_t USB_Host_GetDeviceConfiguration(uint8_t* const ConfigNumber) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetConfiguration, - .wValue = 0, - .wIndex = 0, - .wLength = sizeof(uint8_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(ConfigNumber); -} - -uint8_t USB_Host_GetDescriptor(const uint8_t Type, - const uint8_t Index, - void* const Buffer, - const uint8_t BufferLength) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetDescriptor, - .wValue = (((uint16_t)Type << 8) | Index), - .wIndex = 0, - .wLength = BufferLength, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(Buffer); -} - -uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetStatus, - .wValue = 0, - .wIndex = 0, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(FeatureStatus); -} - -uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT), - .bRequest = REQ_ClearFeature, - .wValue = FEATURE_SEL_EndpointHalt, - .wIndex = EndpointAddress, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(NULL); -} - -uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex, - const uint8_t AltSetting) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE), - .bRequest = REQ_SetInterface, - .wValue = AltSetting, - .wIndex = InterfaceIndex, - .wLength = 0, - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(NULL); -} - -uint8_t USB_Host_GetInterfaceAltSetting(const uint8_t InterfaceIndex, - uint8_t* const AltSetting) -{ - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE), - .bRequest = REQ_GetInterface, - .wValue = 0, - .wIndex = InterfaceIndex, - .wLength = sizeof(uint8_t), - }; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - return USB_Host_SendControlRequest(AltSetting); -} - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h deleted file mode 100644 index cdfb35470e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB host standard request management. - * - * This file contains the function prototypes necessary for the issuing of outgoing standard control requests - * when the library is in USB host mode. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __HOSTSTDREQ_H__ -#define __HOSTSTDREQ_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - #include "StdRequestType.h" - #include "USBController.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__) - /** Constant for the maximum software timeout period of sent USB control transactions to an attached - * device. If a device fails to respond to a sent control request within this period, the - * library will return a timeout error code. - * - * This value may be overridden in the user project makefile as the value of the - * \ref USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch. - */ - #define USB_HOST_TIMEOUT_MS 1000 - #endif - - /* Enums: */ - /** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error - * if the transfer of the request is unsuccessful. - * - * \ingroup Group_PipeControlReq - */ - enum USB_Host_SendControlErrorCodes_t - { - HOST_SENDCONTROL_Successful = 0, /**< No error occurred in the request transfer. */ - HOST_SENDCONTROL_DeviceDisconnected = 1, /**< The attached device was disconnected during the - * request transfer. - */ - HOST_SENDCONTROL_PipeError = 2, /**< An error occurred in the pipe while sending the request. */ - HOST_SENDCONTROL_SetupStalled = 3, /**< The attached device stalled the request, usually - * indicating that the request is unsupported on the device. - */ - HOST_SENDCONTROL_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */ - }; - - /* Global Variables: */ - /** Indicates the currently set configuration number of the attached device. This indicates the currently - * selected configuration value if one has been set successfully, or 0 if no configuration has been selected. - * - * To set a device configuration, call the \ref USB_Host_SetDeviceConfiguration() function. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \ingroup Group_Host - */ - extern uint8_t USB_Host_ConfigurationNumber; - - /* Function Prototypes: */ - /** Sends the request stored in the \ref USB_ControlRequest global structure to the attached device, - * and transfers the data stored in the buffer to the device, or from the device to the buffer - * as requested. The transfer is made on the currently selected pipe. - * - * \ingroup Group_PipeControlReq - * - * \param[in] BufferPtr Pointer to the start of the data buffer if the request has a data stage, or - * \c NULL if the request transfers no data to or from the device. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_SendControlRequest(void* const BufferPtr); - - /** Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index. - * - * This routine will automatically update the \ref USB_HostState and \ref USB_Host_ConfigurationNumber - * state variables according to the given function parameters and the result of the request. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[in] ConfigNumber Configuration index to send to the device. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber); - - /** Sends a GET CONFIGURATION standard request to the attached device, to retrieve the currently selected - * device configuration index. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[out] ConfigNumber Pointer to a location where the retrieved configuration index should be stored. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_GetDeviceConfiguration(uint8_t* const ConfigNumber) ATTR_NON_NULL_PTR_ARG(1); - - /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the descriptor of the - * specified type and index. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[in] Type Type of descriptor to retrieve, a value from the \ref USB_DescriptorTypes_t enum. - * \param[in] Index Index of the descriptor to retrieve. - * \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is to be stored. - * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_GetDescriptor(const uint8_t Type, - const uint8_t Index, - void* const Buffer, - const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(3); - - /** Retrieves the current feature status of the attached device, via a GET STATUS standard request. The - * retrieved feature status can then be examined by masking the retrieved value with the various - * \c FEATURE_* masks for bus/self power information and remote wakeup support. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[out] FeatureStatus Location where the retrieved feature status should be stored. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) ATTR_NON_NULL_PTR_ARG(1); - - /** Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[in] EndpointAddress Address of the endpoint to clear, including the endpoint's direction. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress); - - /** Selects a given alternative setting for the specified interface, via a SET INTERFACE standard request to - * the attached device. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[in] InterfaceIndex Index of the interface whose alternative setting is to be altered. - * \param[in] AltSetting Index of the interface's alternative setting which is to be selected. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex, - const uint8_t AltSetting); - - - /** Retrieves the current alternative setting for the specified interface, via a GET INTERFACE standard request to - * the attached device. - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[in] InterfaceIndex Index of the interface whose alternative setting is to be altered. - * \param[out] AltSetting Pointer to a location where the retrieved alternative setting value should be stored. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - uint8_t USB_Host_GetInterfaceAltSetting(const uint8_t InterfaceIndex, - uint8_t* const AltSetting) ATTR_NON_NULL_PTR_ARG(2); - - /* Inline Functions: */ - /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the device descriptor. - * This can be used to easily retrieve information about the device such as its VID, PID and power - * requirements. This is a convenience wrapper for \ref USB_Host_GetDescriptor(). - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where - * the read data is to be stored. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - static inline uint8_t USB_Host_GetDeviceDescriptor(USB_Descriptor_Device_t* const DeviceDescriptorPtr) ATTR_NON_NULL_PTR_ARG(1); - static inline uint8_t USB_Host_GetDeviceDescriptor(USB_Descriptor_Device_t* const DeviceDescriptorPtr) - { - return USB_Host_GetDescriptor(DTYPE_Device, 0, DeviceDescriptorPtr, sizeof(USB_Descriptor_Device_t)); - } - - /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the string descriptor - * of the specified index. This can be used to easily retrieve string descriptors from the device by - * index, after the index is obtained from the Device or Configuration descriptors. This is a convenience - * wrapper for \ref USB_Host_GetDescriptor(). - * - * \note After this routine returns, the control pipe will be selected. - * - * \ingroup Group_PipeControlReq - * - * \param[in] Index Index of the string descriptor to retrieve. - * \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is - * to be stored. - * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer. - * - * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ - static inline uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, - void* const Buffer, - const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(2); - static inline uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, - void* const Buffer, - const uint8_t BufferLength) - { - return USB_Host_GetDescriptor(DTYPE_String, Index, Buffer, BufferLength); - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Enums: */ - enum USB_WaitForTypes_t - { - USB_HOST_WAITFOR_SetupSent, - USB_HOST_WAITFOR_InReceived, - USB_HOST_WAITFOR_OutReady, - }; - - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_HOSTSTDREQ_C) - static uint8_t USB_Host_SendControlRequest_PRV(void* const BufferPtr); - static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h deleted file mode 100644 index ccd7cc1be4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common USB OTG definitions for all architectures. - * \copydetails Group_OTG - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_OTG USB On The Go (OTG) Management - * \brief USB OTG management definitions. - * - * This module contains macros for embedded USB hosts with dual role On The Go capabilities, for managing role - * exchange. OTG is a way for two USB dual role devices to talk to one another directly without fixed device/host - * roles. - * - * @{ - */ - -#ifndef __USBOTG_H__ -#define __USBOTG_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/OTG_AVR8.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h deleted file mode 100644 index ce2be5492a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common USB Pipe definitions for all architectures. - * \copydetails Group_PipeManagement - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeManagement - * \defgroup Group_PipeRW Pipe Data Reading and Writing - * \brief Pipe data read/write definitions. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to pipes. - */ - -/** \ingroup Group_PipeRW - * \defgroup Group_PipePrimitiveRW Read/Write of Primitive Data Types - * \brief Pipe data primitive read/write definitions. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to pipes. - */ - -/** \ingroup Group_PipeManagement - * \defgroup Group_PipePacketManagement Pipe Packet Management - * \brief Pipe packet management definitions. - * - * Functions, macros, variables, enums and types related to packet management of pipes. - */ - -/** \ingroup Group_PipeManagement - * \defgroup Group_PipeControlReq Pipe Control Request Management - * \brief Pipe control request definitions. - * - * Module for host mode request processing. This module allows for the transmission of standard, class and - * vendor control requests to the default control endpoint of an attached device while in host mode. - * - * \see Chapter 9 of the USB 2.0 specification. - */ - -/** \ingroup Group_USB - * \defgroup Group_PipeManagement Pipe Management - * \brief Pipe management definitions. - * - * This module contains functions, macros and enums related to pipe management when in USB Host mode. This - * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions - * for various data types. - * - * @{ - */ - -#ifndef __PIPE_H__ -#define __PIPE_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Type Defines: */ - /** Type define for a pipe table entry, used to configure pipes in groups via - * \ref Pipe_ConfigurePipeTable(). - */ - typedef struct - { - uint8_t Address; /**< Address of the pipe to configure, or zero if the table entry is to be unused. */ - uint16_t Size; /**< Size of the pipe bank, in bytes. */ - uint8_t EndpointAddress; /** Address of the endpoint in the connected device. */ - uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */ - uint8_t Banks; /**< Number of hardware banks to use for the pipe. */ - } USB_Pipe_Table_t; - - /* Macros: */ - /** Pipe address for the default control pipe, which always resides in address 0. This is - * defined for convenience to give more readable code when used with the pipe macros. - */ - #define PIPE_CONTROLPIPE 0 - - /** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address - * in the device. - */ - #define PIPE_PIPENUM_MASK 0x0F - - /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's - * numerical address in the attached device. - */ - #define PIPE_EPNUM_MASK 0x0F - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/Pipe_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/Pipe_UC3.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h deleted file mode 100644 index 002d6ff1ee..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Pipe data stream transmission and reception management. - * \copydetails Group_PipeStreamRW - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeRW - * \defgroup Group_PipeStreamRW Read/Write of Multi-Byte Streams - * \brief Pipe data stream transmission and reception management. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to pipes. - * - * @{ - */ - -#ifndef __PIPE_STREAM_H__ -#define __PIPE_STREAM_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Enums: */ - /** Enum for the possible error return codes of the Pipe_*_Stream_* functions. */ - enum Pipe_Stream_RW_ErrorCodes_t - { - PIPE_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ - PIPE_RWSTREAM_PipeStalled = 1, /**< The device stalled the pipe during the transfer. */ - PIPE_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during - * the transfer. - */ - PIPE_RWSTREAM_Timeout = 3, /**< The device failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - PIPE_RWSTREAM_IncompleteTransfer = 4, /**< Indicates that the pipe bank became full/empty before the - * complete contents of the stream could be transferred. - */ - }; - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/PipeStream_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/PipeStream_UC3.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h deleted file mode 100644 index 012399e966..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h +++ /dev/null @@ -1,739 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common standard USB Descriptor definitions for all architectures. - * \copydetails Group_StdDescriptors - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_StdDescriptors USB Descriptors - * \brief Standard USB Descriptor definitions. - * - * Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains - * structures and macros for the easy creation of standard USB descriptors in USB device projects. - * - * @{ - */ - -#ifndef __USBDESCRIPTORS_H__ -#define __USBDESCRIPTORS_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - #include "Events.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors - * for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified - * descriptor does not exist. - */ - #define NO_DESCRIPTOR 0 - - /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. - * - * \param[in] mA Maximum number of milliamps the device consumes when the given configuration is selected. - */ - #define USB_CONFIG_POWER_MA(mA) ((mA) >> 1) - - /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. - * Should be used in string descriptor's headers for giving the string descriptor's byte length. - * - * \param[in] UnicodeChars Number of Unicode characters in the string text. - */ - #define USB_STRING_LEN(UnicodeChars) (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 1)) - - /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded - * Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the - * standard device descriptor. - * - * \note This value is automatically converted into Little Endian, suitable for direct use inside device - * descriptors on all architectures without endianness conversion macros. - * - * \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number. - */ - #define VERSION_BCD(x) CPU_TO_LE16((VERSION_TENS(x) << 12) | (VERSION_ONES(x) << 8) | \ - (VERSION_TENTHS(x) << 4) | (VERSION_HUNDREDTHS(x) << 0) ) - - /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors - * to indicate that the English language is supported by the device in its string descriptors. - */ - #define LANGUAGE_ID_ENG 0x0409 - - /** \name USB Configuration Descriptor Attribute Masks */ - //@{ - /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be set on all - * devices for historical purposes. - */ - #define USB_CONFIG_ATTR_RESERVED 0x80 - - /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t - * descriptor's \c ConfigAttributes value to indicate that the specified configuration can draw its power - * from the device's own power source. - */ - #define USB_CONFIG_ATTR_SELFPOWERED 0x40 - - /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t - * descriptor's \c ConfigAttributes value to indicate that the specified configuration supports the - * remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon - * request. - */ - #define USB_CONFIG_ATTR_REMOTEWAKEUP 0x20 - //@} - - /** \name Endpoint Descriptor Attribute Masks */ - //@{ - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is not synchronized. - * - * \see The USB specification for more details on the possible Endpoint attributes. - */ - #define ENDPOINT_ATTR_NO_SYNC (0 << 2) - - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is asynchronous. - * - * \see The USB specification for more details on the possible Endpoint attributes. - */ - #define ENDPOINT_ATTR_ASYNC (1 << 2) - - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is adaptive. - * - * \see The USB specification for more details on the possible Endpoint attributes. - */ - #define ENDPOINT_ATTR_ADAPTIVE (2 << 2) - - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is synchronized. - * - * \see The USB specification for more details on the possible Endpoint attributes. - */ - #define ENDPOINT_ATTR_SYNC (3 << 2) - //@} - - /** \name Endpoint Descriptor Usage Masks */ - //@{ - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is used for data transfers. - * - * \see The USB specification for more details on the possible Endpoint usage attributes. - */ - #define ENDPOINT_USAGE_DATA (0 << 4) - - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is used for feedback. - * - * \see The USB specification for more details on the possible Endpoint usage attributes. - */ - #define ENDPOINT_USAGE_FEEDBACK (1 << 4) - - /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's - * \c Attributes value to indicate that the specified endpoint is used for implicit feedback. - * - * \see The USB specification for more details on the possible Endpoint usage attributes. - */ - #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4) - //@} - - /* Enums: */ - /** Enum for the possible standard descriptor types, as given in each descriptor's header. */ - enum USB_DescriptorTypes_t - { - DTYPE_Device = 0x01, /**< Indicates that the descriptor is a device descriptor. */ - DTYPE_Configuration = 0x02, /**< Indicates that the descriptor is a configuration descriptor. */ - DTYPE_String = 0x03, /**< Indicates that the descriptor is a string descriptor. */ - DTYPE_Interface = 0x04, /**< Indicates that the descriptor is an interface descriptor. */ - DTYPE_Endpoint = 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */ - DTYPE_DeviceQualifier = 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */ - DTYPE_Other = 0x07, /**< Indicates that the descriptor is of other type. */ - DTYPE_InterfacePower = 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ - DTYPE_InterfaceAssociation = 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ - DTYPE_CSInterface = 0x24, /**< Indicates that the descriptor is a class specific interface descriptor. */ - DTYPE_CSEndpoint = 0x25, /**< Indicates that the descriptor is a class specific endpoint descriptor. */ - }; - - /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors. */ - enum USB_Descriptor_ClassSubclassProtocol_t - { - USB_CSCP_NoDeviceClass = 0x00, /**< Descriptor Class value indicating that the device does not belong - * to a particular class at the device level. - */ - USB_CSCP_NoDeviceSubclass = 0x00, /**< Descriptor Subclass value indicating that the device does not belong - * to a particular subclass at the device level. - */ - USB_CSCP_NoDeviceProtocol = 0x00, /**< Descriptor Protocol value indicating that the device does not belong - * to a particular protocol at the device level. - */ - USB_CSCP_VendorSpecificClass = 0xFF, /**< Descriptor Class value indicating that the device/interface belongs - * to a vendor specific class. - */ - USB_CSCP_VendorSpecificSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device/interface belongs - * to a vendor specific subclass. - */ - USB_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Protocol value indicating that the device/interface belongs - * to a vendor specific protocol. - */ - USB_CSCP_IADDeviceClass = 0xEF, /**< Descriptor Class value indicating that the device belongs to the - * Interface Association Descriptor class. - */ - USB_CSCP_IADDeviceSubclass = 0x02, /**< Descriptor Subclass value indicating that the device belongs to the - * Interface Association Descriptor subclass. - */ - USB_CSCP_IADDeviceProtocol = 0x01, /**< Descriptor Protocol value indicating that the device belongs to the - * Interface Association Descriptor protocol. - */ - }; - - /* Type Defines: */ - /** \brief Standard USB Descriptor Header (LUFA naming conventions). - * - * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure - * uses LUFA-specific element names to make each element's purpose clearer. - * - * \see \ref USB_StdDescriptor_Header_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t Size; /**< Size of the descriptor, in bytes. */ - uint8_t Type; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - } ATTR_PACKED USB_Descriptor_Header_t; - - /** \brief Standard USB Descriptor Header (USB-IF naming conventions). - * - * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure - * uses the relevant standard's given element names to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_Header_t for the version of this type with non-standard LUFA specific element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - } ATTR_PACKED USB_StdDescriptor_Header_t; - - /** \brief Standard USB Device Descriptor (LUFA naming conventions). - * - * Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each - * element's purpose clearer. - * - * \see \ref USB_StdDescriptor_Device_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - uint16_t USBSpecification; /**< BCD of the supported USB specification. */ - uint8_t Class; /**< USB device class. */ - uint8_t SubClass; /**< USB device subclass. */ - uint8_t Protocol; /**< USB device protocol. */ - - uint8_t Endpoint0Size; /**< Size of the control (address 0) endpoint's bank in bytes. */ - - uint16_t VendorID; /**< Vendor ID for the USB product. */ - uint16_t ProductID; /**< Unique product ID for the USB product. */ - uint16_t ReleaseNumber; /**< Product release (version) number. */ - - uint8_t ManufacturerStrIndex; /**< String index for the manufacturer's name. The - * host will request this string via a separate - * control request for the string descriptor. - * - * \note If no string supplied, use \ref NO_DESCRIPTOR. - */ - uint8_t ProductStrIndex; /**< String index for the product name/details. - * - * \see ManufacturerStrIndex structure entry. - */ - uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal - * serial number, in uppercase Unicode ASCII. - * - * \note On some microcontroller models, there is an embedded serial number - * in the chip which can be used for the device serial number. - * To use this serial number, set this to USE_INTERNAL_SERIAL. - * On unsupported devices, this will evaluate to 0 and will cause - * the host to generate a pseudo-unique value for the device upon - * insertion. - * - * \see ManufacturerStrIndex structure entry. - */ - uint8_t NumberOfConfigurations; /**< Total number of configurations supported by - * the device. - */ - } ATTR_PACKED USB_Descriptor_Device_t; - - /** \brief Standard USB Device Descriptor (USB-IF naming conventions). - * - * Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names - * to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint16_t bcdUSB; /**< BCD of the supported USB specification. */ - uint8_t bDeviceClass; /**< USB device class. */ - uint8_t bDeviceSubClass; /**< USB device subclass. */ - uint8_t bDeviceProtocol; /**< USB device protocol. */ - uint8_t bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */ - uint16_t idVendor; /**< Vendor ID for the USB product. */ - uint16_t idProduct; /**< Unique product ID for the USB product. */ - uint16_t bcdDevice; /**< Product release (version) number. */ - uint8_t iManufacturer; /**< String index for the manufacturer's name. The - * host will request this string via a separate - * control request for the string descriptor. - * - * \note If no string supplied, use \ref NO_DESCRIPTOR. - */ - uint8_t iProduct; /**< String index for the product name/details. - * - * \see ManufacturerStrIndex structure entry. - */ - uint8_t iSerialNumber; /**< String index for the product's globally unique hexadecimal - * serial number, in uppercase Unicode ASCII. - * - * \note On some microcontroller models, there is an embedded serial number - * in the chip which can be used for the device serial number. - * To use this serial number, set this to USE_INTERNAL_SERIAL. - * On unsupported devices, this will evaluate to 0 and will cause - * the host to generate a pseudo-unique value for the device upon - * insertion. - * - * \see ManufacturerStrIndex structure entry. - */ - uint8_t bNumConfigurations; /**< Total number of configurations supported by - * the device. - */ - } ATTR_PACKED USB_StdDescriptor_Device_t; - - /** \brief Standard USB Device Qualifier Descriptor (LUFA naming conventions). - * - * Type define for a standard Device Qualifier Descriptor. This structure uses LUFA-specific element names - * to make each element's purpose clearer. - * - * \see \ref USB_StdDescriptor_DeviceQualifier_t for the version of this type with standard element names. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - uint16_t USBSpecification; /**< BCD of the supported USB specification. */ - uint8_t Class; /**< USB device class. */ - uint8_t SubClass; /**< USB device subclass. */ - uint8_t Protocol; /**< USB device protocol. */ - - uint8_t Endpoint0Size; /**< Size of the control (address 0) endpoint's bank in bytes. */ - uint8_t NumberOfConfigurations; /**< Total number of configurations supported by - * the device. - */ - uint8_t Reserved; /**< Reserved for future use, must be 0. */ - } ATTR_PACKED USB_Descriptor_DeviceQualifier_t; - - /** \brief Standard USB Device Qualifier Descriptor (USB-IF naming conventions). - * - * Type define for a standard Device Qualifier Descriptor. This structure uses the relevant standard's given element names - * to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_DeviceQualifier_t for the version of this type with non-standard LUFA specific element names. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint16_t bcdUSB; /**< BCD of the supported USB specification. */ - uint8_t bDeviceClass; /**< USB device class. */ - uint8_t bDeviceSubClass; /**< USB device subclass. */ - uint8_t bDeviceProtocol; /**< USB device protocol. */ - uint8_t bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */ - uint8_t bNumConfigurations; /**< Total number of configurations supported by - * the device. - */ - uint8_t bReserved; /**< Reserved for future use, must be 0. */ - } ATTR_PACKED USB_StdDescriptor_DeviceQualifier_t; - - /** \brief Standard USB Configuration Descriptor (LUFA naming conventions). - * - * Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names - * to make each element's purpose clearer. - * - * \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - uint16_t TotalConfigurationSize; /**< Size of the configuration descriptor header, - * and all sub descriptors inside the configuration. - */ - uint8_t TotalInterfaces; /**< Total number of interfaces in the configuration. */ - - uint8_t ConfigurationNumber; /**< Configuration index of the current configuration. */ - uint8_t ConfigurationStrIndex; /**< Index of a string descriptor describing the configuration. */ - - uint8_t ConfigAttributes; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks. - * On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. - */ - - uint8_t MaxPowerConsumption; /**< Maximum power consumption of the device while in the - * current configuration, calculated by the \ref USB_CONFIG_POWER_MA() - * macro. - */ - } ATTR_PACKED USB_Descriptor_Configuration_Header_t; - - /** \brief Standard USB Configuration Descriptor (USB-IF naming conventions). - * - * Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names - * to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint16_t wTotalLength; /**< Size of the configuration descriptor header, - * and all sub descriptors inside the configuration. - */ - uint8_t bNumInterfaces; /**< Total number of interfaces in the configuration. */ - uint8_t bConfigurationValue; /**< Configuration index of the current configuration. */ - uint8_t iConfiguration; /**< Index of a string descriptor describing the configuration. */ - uint8_t bmAttributes; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks. - * On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. - */ - uint8_t bMaxPower; /**< Maximum power consumption of the device while in the - * current configuration, calculated by the \ref USB_CONFIG_POWER_MA() - * macro. - */ - } ATTR_PACKED USB_StdDescriptor_Configuration_Header_t; - - /** \brief Standard USB Interface Descriptor (LUFA naming conventions). - * - * Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names - * to make each element's purpose clearer. - * - * \see \ref USB_StdDescriptor_Interface_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - uint8_t InterfaceNumber; /**< Index of the interface in the current configuration. */ - uint8_t AlternateSetting; /**< Alternate setting for the interface number. The same - * interface number can have multiple alternate settings - * with different endpoint configurations, which can be - * selected by the host. - */ - uint8_t TotalEndpoints; /**< Total number of endpoints in the interface. */ - - uint8_t Class; /**< Interface class ID. */ - uint8_t SubClass; /**< Interface subclass ID. */ - uint8_t Protocol; /**< Interface protocol ID. */ - - uint8_t InterfaceStrIndex; /**< Index of the string descriptor describing the interface. */ - } ATTR_PACKED USB_Descriptor_Interface_t; - - /** \brief Standard USB Interface Descriptor (USB-IF naming conventions). - * - * Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names - * to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_Interface_t for the version of this type with non-standard LUFA specific element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint8_t bInterfaceNumber; /**< Index of the interface in the current configuration. */ - uint8_t bAlternateSetting; /**< Alternate setting for the interface number. The same - * interface number can have multiple alternate settings - * with different endpoint configurations, which can be - * selected by the host. - */ - uint8_t bNumEndpoints; /**< Total number of endpoints in the interface. */ - uint8_t bInterfaceClass; /**< Interface class ID. */ - uint8_t bInterfaceSubClass; /**< Interface subclass ID. */ - uint8_t bInterfaceProtocol; /**< Interface protocol ID. */ - uint8_t iInterface; /**< Index of the string descriptor describing the - * interface. - */ - } ATTR_PACKED USB_StdDescriptor_Interface_t; - - /** \brief Standard USB Interface Association Descriptor (LUFA naming conventions). - * - * Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names - * to make each element's purpose clearer. - * - * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at - * http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf. It allows composite - * devices with multiple interfaces related to the same function to have the multiple interfaces bound - * together at the point of enumeration, loading one generic driver for all the interfaces in the single - * function. Read the ECN for more information. - * - * \see \ref USB_StdDescriptor_Interface_Association_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - uint8_t FirstInterfaceIndex; /**< Index of the first associated interface. */ - uint8_t TotalInterfaces; /**< Total number of associated interfaces. */ - - uint8_t Class; /**< Interface class ID. */ - uint8_t SubClass; /**< Interface subclass ID. */ - uint8_t Protocol; /**< Interface protocol ID. */ - - uint8_t IADStrIndex; /**< Index of the string descriptor describing the - * interface association. - */ - } ATTR_PACKED USB_Descriptor_Interface_Association_t; - - /** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions). - * - * Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given - * element names to ensure compatibility with the standard. - * - * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at - * http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf. It allows composite - * devices with multiple interfaces related to the same function to have the multiple interfaces bound - * together at the point of enumeration, loading one generic driver for all the interfaces in the single - * function. Read the ECN for more information. - * - * \see \ref USB_Descriptor_Interface_Association_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value - * given by the specific class. - */ - uint8_t bFirstInterface; /**< Index of the first associated interface. */ - uint8_t bInterfaceCount; /**< Total number of associated interfaces. */ - uint8_t bFunctionClass; /**< Interface class ID. */ - uint8_t bFunctionSubClass; /**< Interface subclass ID. */ - uint8_t bFunctionProtocol; /**< Interface protocol ID. */ - uint8_t iFunction; /**< Index of the string descriptor describing the - * interface association. - */ - } ATTR_PACKED USB_StdDescriptor_Interface_Association_t; - - /** \brief Standard USB Endpoint Descriptor (LUFA naming conventions). - * - * Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names - * to make each element's purpose clearer. - * - * \see \ref USB_StdDescriptor_Endpoint_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - uint8_t EndpointAddress; /**< Logical address of the endpoint within the device for the current - * configuration, including direction mask. - */ - uint8_t Attributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) - * and attributes (ENDPOINT_ATTR_*) masks. - */ - uint16_t EndpointSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet - * size that the endpoint can receive at a time. - */ - uint8_t PollingIntervalMS; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT - * or ISOCHRONOUS type. - */ - } ATTR_PACKED USB_Descriptor_Endpoint_t; - - /** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions). - * - * Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given - * element names to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_Endpoint_t for the version of this type with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a - * value given by the specific class. - */ - uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current - * configuration, including direction mask. - */ - uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) - * and attributes (ENDPOINT_ATTR_*) masks. - */ - uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size - * that the endpoint can receive at a time. - */ - uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or - * ISOCHRONOUS type. - */ - } ATTR_PACKED USB_StdDescriptor_Endpoint_t; - - /** \brief Standard USB String Descriptor (LUFA naming conventions). - * - * Type define for a standard string descriptor. Unlike other standard descriptors, the length - * of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() - * macro rather than by the size of the descriptor structure, as the length is not fixed. - * - * This structure should also be used for string index 0, which contains the supported language IDs for - * the device as an array. - * - * This structure uses LUFA-specific element names to make each element's purpose clearer. - * - * \see \ref USB_StdDescriptor_String_t for the version of this type with standard element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - - #if (((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) && !defined(__DOXYGEN__)) - wchar_t UnicodeString[]; - #else - uint16_t UnicodeString[]; /**< String data, as unicode characters (alternatively, - * string language IDs). If normal ASCII characters are - * to be used, they must be added as an array of characters - * rather than a normal C string so that they are widened to - * Unicode size. - * - * Under GCC, strings prefixed with the "L" character (before - * the opening string quotation mark) are considered to be - * Unicode strings, and may be used instead of an explicit - * array of ASCII characters on little endian devices with - * UTF-16-LE \c wchar_t encoding. - */ - #endif - } ATTR_PACKED USB_Descriptor_String_t; - - /** \brief Standard USB String Descriptor (USB-IF naming conventions). - * - * Type define for a standard string descriptor. Unlike other standard descriptors, the length - * of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() - * macro rather than by the size of the descriptor structure, as the length is not fixed. - * - * This structure should also be used for string index 0, which contains the supported language IDs for - * the device as an array. - * - * This structure uses the relevant standard's given element names to ensure compatibility with the standard. - * - * \see \ref USB_Descriptor_String_t for the version of this type with with non-standard LUFA specific - * element names. - * - * \note Regardless of CPU architecture, these values should be stored as little endian. - */ - typedef struct - { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t - * or a value given by the specific class. - */ - uint16_t bString[]; /**< String data, as unicode characters (alternatively, string language IDs). - * If normal ASCII characters are to be used, they must be added as an array - * of characters rather than a normal C string so that they are widened to - * Unicode size. - * - * Under GCC, strings prefixed with the "L" character (before the opening string - * quotation mark) are considered to be Unicode strings, and may be used instead - * of an explicit array of ASCII characters. - */ - } ATTR_PACKED USB_StdDescriptor_String_t; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define VERSION_TENS(x) (int)((int)(x) / 10) - #define VERSION_ONES(x) (int)((int)(x) % 10) - #define VERSION_TENTHS(x) (int)(((x * 1) - ((int)(x * 1))) * 10) - #define VERSION_HUNDREDTHS(x) (int)(((x * 10) - ((int)(x * 10))) * 10) - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h deleted file mode 100644 index a841f8f3ad..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB control endpoint request definitions. - * \copydetails Group_StdRequest - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_StdRequest Standard USB Requests - * \brief USB control endpoint request definitions. - * - * This module contains definitions for the various control request parameters, so that the request - * details (such as data direction, request recipient, etc.) can be extracted via masking. - * - * @{ - */ - -#ifndef __STDREQTYPE_H__ -#define __STDREQTYPE_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Mask for the request type parameter, to indicate the direction of the request data (Host to Device - * or Device to Host). The result of this mask should then be compared to the request direction masks. - * - * \see \c REQDIR_* macros for masks indicating the request data direction. - */ - #define CONTROL_REQTYPE_DIRECTION 0x80 - - /** Mask for the request type parameter, to indicate the type of request (Device, Class or Vendor - * Specific). The result of this mask should then be compared to the request type masks. - * - * \see \c REQTYPE_* macros for masks indicating the request type. - */ - #define CONTROL_REQTYPE_TYPE 0x60 - - /** Mask for the request type parameter, to indicate the recipient of the request (Device, Interface - * Endpoint or Other). The result of this mask should then be compared to the request recipient - * masks. - * - * \see \c REQREC_* macros for masks indicating the request recipient. - */ - #define CONTROL_REQTYPE_RECIPIENT 0x1F - - /** \name Control Request Data Direction Masks */ - //@{ - /** Request data direction mask, indicating that the request data will flow from host to device. - * - * \see \ref CONTROL_REQTYPE_DIRECTION macro. - */ - #define REQDIR_HOSTTODEVICE (0 << 7) - - /** Request data direction mask, indicating that the request data will flow from device to host. - * - * \see \ref CONTROL_REQTYPE_DIRECTION macro. - */ - #define REQDIR_DEVICETOHOST (1 << 7) - //@} - - /** \name Control Request Type Masks */ - //@{ - /** Request type mask, indicating that the request is a standard request. - * - * \see \ref CONTROL_REQTYPE_TYPE macro. - */ - #define REQTYPE_STANDARD (0 << 5) - - /** Request type mask, indicating that the request is a class-specific request. - * - * \see \ref CONTROL_REQTYPE_TYPE macro. - */ - #define REQTYPE_CLASS (1 << 5) - - /** Request type mask, indicating that the request is a vendor specific request. - * - * \see \ref CONTROL_REQTYPE_TYPE macro. - */ - #define REQTYPE_VENDOR (2 << 5) - //@} - - /** \name Control Request Recipient Masks */ - //@{ - /** Request recipient mask, indicating that the request is to be issued to the device as a whole. - * - * \see \ref CONTROL_REQTYPE_RECIPIENT macro. - */ - #define REQREC_DEVICE (0 << 0) - - /** Request recipient mask, indicating that the request is to be issued to an interface in the - * currently selected configuration. - * - * \see \ref CONTROL_REQTYPE_RECIPIENT macro. - */ - #define REQREC_INTERFACE (1 << 0) - - /** Request recipient mask, indicating that the request is to be issued to an endpoint in the - * currently selected configuration. - * - * \see \ref CONTROL_REQTYPE_RECIPIENT macro. - */ - #define REQREC_ENDPOINT (2 << 0) - - /** Request recipient mask, indicating that the request is to be issued to an unspecified element - * in the currently selected configuration. - * - * \see \ref CONTROL_REQTYPE_RECIPIENT macro. - */ - #define REQREC_OTHER (3 << 0) - //@} - - /* Type Defines: */ - /** \brief Standard USB Control Request - * - * Type define for a standard USB control request. - * - * \see The USB 2.0 specification for more information on standard control requests. - */ - typedef struct - { - uint8_t bmRequestType; /**< Type of the request. */ - uint8_t bRequest; /**< Request command code. */ - uint16_t wValue; /**< wValue parameter of the request. */ - uint16_t wIndex; /**< wIndex parameter of the request. */ - uint16_t wLength; /**< Length of the data to transfer in bytes. */ - } ATTR_PACKED USB_Request_Header_t; - - /* Enums: */ - /** Enumeration for the various standard request commands. These commands are applicable when the - * request type is \ref REQTYPE_STANDARD (with the exception of \ref REQ_GetDescriptor, which is always - * handled regardless of the request type value). - * - * \see Chapter 9 of the USB 2.0 Specification. - */ - enum USB_Control_Request_t - { - REQ_GetStatus = 0, /**< Implemented in the library for device and endpoint recipients. Passed - * to the user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_ClearFeature = 1, /**< Implemented in the library for device and endpoint recipients. Passed - * to the user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_SetFeature = 3, /**< Implemented in the library for device and endpoint recipients. Passed - * to the user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed - * to the user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_GetDescriptor = 6, /**< Implemented in the library for device and interface recipients. Passed to the - * user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed - * to the user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed - * to the user application for other recipients via the - * \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application - * via the \ref EVENT_USB_Device_ControlRequest() event when received in - * device mode. */ - }; - - /** Feature Selector values for Set Feature and Clear Feature standard control requests directed to the device, interface - * and endpoint recipients. - */ - enum USB_Feature_Selectors_t - { - FEATURE_SEL_EndpointHalt = 0x00, /**< Feature selector for Clear Feature or Set Feature commands. When - * used in a Set Feature or Clear Feature request this indicates that an - * endpoint (whose address is given elsewhere in the request) should have - * its stall condition changed. - */ - FEATURE_SEL_DeviceRemoteWakeup = 0x01, /**< Feature selector for Device level Remote Wakeup enable set or clear. - * This feature can be controlled by the host on devices which indicate - * remote wakeup support in their descriptors to selectively disable or - * enable remote wakeup. - */ - FEATURE_SEL_TestMode = 0x02, /**< Feature selector for Test Mode features, used to test the USB controller - * to check for incorrect operation. - */ - }; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define FEATURE_SELFPOWERED_ENABLED (1 << 0) - #define FEATURE_REMOTE_WAKEUP_ENABLED (1 << 1) - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c deleted file mode 100644 index b7c186e80d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "../Device.h" - -void USB_Device_SendRemoteWakeup(void) -{ - USB_CLK_Unfreeze(); - - AVR32_USBB.UDCON.rmwkup = true; - while (AVR32_USBB.UDCON.rmwkup); -} - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h deleted file mode 100644 index 7139d51f08..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ /dev/null @@ -1,260 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Device definitions for the AVR32 UC3 microcontrollers. - * \copydetails Group_Device_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_Device - * \defgroup Group_Device_UC3 Device Management (UC3) - * \brief USB Device definitions for the AVR32 UC3 microcontrollers. - * - * Architecture specific USB Device definitions for the Atmel 32-bit UC3 AVR microcontrollers. - * - * @{ - */ - -#ifndef __USBDEVICE_UC3_H__ -#define __USBDEVICE_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBController.h" - #include "../StdDescriptors.h" - #include "../USBInterrupt.h" - #include "../Endpoint.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name USB Device Mode Option Masks */ - //@{ - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in low speed (1.5Mb/s) mode. - * - * \note Restrictions apply on the number, size and type of endpoints which can be used - * when running in low speed mode - please refer to the USB 2.0 specification. - */ - #define USB_DEVICE_OPT_LOWSPEED (1 << 0) - - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in full speed (12Mb/s) mode. - */ - #define USB_DEVICE_OPT_FULLSPEED (0 << 0) - - #if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) || defined(__DOXYGEN__) - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in high speed (480Mb/s) mode. - */ - #define USB_DEVICE_OPT_HIGHSPEED (1 << 1) - #endif - //@} - - #if (!defined(NO_INTERNAL_SERIAL) && \ - (defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) || \ - defined(__DOXYGEN__))) - /** String descriptor index for the device's unique serial number string descriptor within the device. - * This unique serial number is used by the host to associate resources to the device (such as drivers or COM port - * number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers contain - * a unique serial number internally, and setting the device descriptors serial number string index to this value - * will cause it to use the internal serial number. - * - * On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR and so will force the host to create a pseudo-serial - * number for the device. - */ - #define USE_INTERNAL_SERIAL 0xDC - - /** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller - * model. - */ - #define INTERNAL_SERIAL_LENGTH_BITS 120 - - /** Start address of the internal serial number, in the appropriate address space, if present on the selected microcontroller - * model. - */ - #define INTERNAL_SERIAL_START_ADDRESS 0x80800204 - #else - #define USE_INTERNAL_SERIAL NO_DESCRIPTOR - - #define INTERNAL_SERIAL_LENGTH_BITS 0 - #define INTERNAL_SERIAL_START_ADDRESS 0 - #endif - - /* Function Prototypes: */ - /** Sends a Remote Wakeup request to the host. This signals to the host that the device should - * be taken out of suspended mode, and communications should resume. - * - * Typically, this is implemented so that HID devices (mice, keyboards, etc.) can wake up the - * host computer when the host has suspended all USB devices to enter a low power state. - * - * \note This function should only be used if the device has indicated to the host that it - * supports the Remote Wakeup feature in the device descriptors, and should only be - * issued if the host is currently allowing remote wakeup events from the device (i.e., - * the \ref USB_Device_RemoteWakeupEnabled flag is set). When the \c NO_DEVICE_REMOTE_WAKEUP - * compile time option is used, this function is unavailable. - * - * \note The USB clock must be running for this function to operate. If the stack is initialized with - * the \ref USB_OPT_MANUAL_PLL option enabled, the user must ensure that the PLL is running - * before attempting to call this function. - * - * \see \ref Group_StdDescriptors for more information on the RMWAKEUP feature and device descriptors. - */ - void USB_Device_SendRemoteWakeup(void); - - /* Inline Functions: */ - /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) - * the frame number is incremented by one. - * - * \return Current USB frame number from the USB controller. - */ - static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint16_t USB_Device_GetFrameNumber(void) - { - return AVR32_USBB.UDFNUM.fnum; - } - - #if !defined(NO_SOF_EVENTS) - /** Enables the device mode Start Of Frame events. When enabled, this causes the - * \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, - * at the start of each USB frame when enumerated in device mode. - * - * \note Not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_EnableSOFEvents(void) - { - USB_INT_Enable(USB_INT_SOFI); - } - - /** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the - * \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode. - * - * \note Not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_DisableSOFEvents(void) - { - USB_INT_Disable(USB_INT_SOFI); - } - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Inline Functions: */ - static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetLowSpeed(void) - { - AVR32_USBB.UDCON.ls = true; - } - - static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetFullSpeed(void) - { - AVR32_USBB.UDCON.ls = false; - #if defined(USB_DEVICE_OPT_HIGHSPEED) - AVR32_USBB.UDCON.spdconf = 3; - #endif - } - - #if defined(USB_DEVICE_OPT_HIGHSPEED) - static inline void USB_Device_SetHighSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetHighSpeed(void) - { - AVR32_USBB.UDCON.ls = false; - AVR32_USBB.UDCON.spdconf = 0; - } - #endif - - static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetDeviceAddress(const uint8_t Address) - { - AVR32_USBB.UDCON.uadd = Address; - AVR32_USBB.UDCON.adden = (Address ? true : false); - } - - static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_Device_IsAddressSet(void) - { - return AVR32_USBB.UDCON.adden; - } - - #if (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) - static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) ATTR_NON_NULL_PTR_ARG(1); - static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) - { - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - uint8_t* SigReadAddress = (uint8_t*)INTERNAL_SERIAL_START_ADDRESS; - - for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) - { - uint8_t SerialByte = *SigReadAddress; - - if (SerialCharNum & 0x01) - { - SerialByte >>= 4; - SigReadAddress++; - } - - SerialByte &= 0x0F; - - UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? - (('A' - 10) + SerialByte) : ('0' + SerialByte)); - } - - SetGlobalInterruptMask(CurrentGlobalInt); - } - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c deleted file mode 100644 index cc4206cae9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "EndpointStream_UC3.h" - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" -#endif - -#endif - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h deleted file mode 100644 index b360b4da40..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h +++ /dev/null @@ -1,434 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management for the AVR32 UC3 microcontrollers. - * \copydetails Group_EndpointStreamRW_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointStreamRW - * \defgroup Group_EndpointStreamRW_UC3 Read/Write of Multi-Byte Streams (UC3) - * \brief Endpoint data stream transmission and reception management for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_UC3_H__ -#define __ENDPOINT_STREAM_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the currently selected endpoint's bank, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of bytes to discard via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending - * full packets to the host as needed. The last packet is not automatically sent once the - * remaining bytes have been written; the user is responsible for manually sending the last - * packet to the host via the \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of zero bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the status OUT packet - * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the status OUT packet - * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c deleted file mode 100644 index 235ddde591..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "../Endpoint.h" - -#if !defined(FIXED_CONTROL_ENDPOINT_SIZE) -uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE; -#endif - -volatile uint32_t USB_Endpoint_SelectedEndpoint = ENDPOINT_CONTROLEP; -volatile uint8_t* USB_Endpoint_FIFOPos[ENDPOINT_TOTAL_ENDPOINTS]; - -bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, - const uint8_t Entries) -{ - for (uint8_t i = 0; i < Entries; i++) - { - if (!(Table[i].Address)) - continue; - - if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks))) - { - return false; - } - } - - return true; -} - -bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, - const uint32_t UECFG0Data) -{ - USB_Endpoint_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * ENDPOINT_HSB_ADDRESS_SPACE_SIZE]; - -#if defined(CONTROL_ONLY_DEVICE) || defined(ORDERED_EP_CONFIG) - Endpoint_SelectEndpoint(Number); - Endpoint_EnableEndpoint(); - - (&AVR32_USBB.uecfg0)[Number] = 0; - (&AVR32_USBB.uecfg0)[Number] = UECFG0Data; - - return Endpoint_IsConfigured(); -#else - for (uint8_t EPNum = Number; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) - { - uint32_t UECFG0Temp; - - Endpoint_SelectEndpoint(EPNum); - - if (EPNum == Number) - { - UECFG0Temp = UECFG0Data; - } - else - { - UECFG0Temp = (&AVR32_USBB.uecfg0)[EPNum]; - } - - if (!(UECFG0Temp & AVR32_USBB_ALLOC_MASK)) - continue; - - Endpoint_DisableEndpoint(); - (&AVR32_USBB.uecfg0)[EPNum] &= ~AVR32_USBB_ALLOC_MASK; - - Endpoint_EnableEndpoint(); - (&AVR32_USBB.uecfg0)[EPNum] = UECFG0Temp; - - if (!(Endpoint_IsConfigured())) - return false; - } - - Endpoint_SelectEndpoint(Number); - return true; -#endif -} - -void Endpoint_ClearEndpoints(void) -{ - for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) - { - Endpoint_SelectEndpoint(EPNum); - (&AVR32_USBB.uecfg0)[EPNum] = 0; - (&AVR32_USBB.uecon0clr)[EPNum] = -1; - USB_Endpoint_FIFOPos[EPNum] = &AVR32_USBB_SLAVE[EPNum * 0x10000]; - Endpoint_DisableEndpoint(); - } -} - -void Endpoint_ClearStatusStage(void) -{ - if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) - { - while (!(Endpoint_IsOUTReceived())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - Endpoint_ClearOUT(); - } - else - { - while (!(Endpoint_IsINReady())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - Endpoint_ClearIN(); - } -} - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_WaitUntilReady(void) -{ - #if (USB_STREAM_TIMEOUT_MS < 0xFF) - uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #else - uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #endif - - uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber(); - - for (;;) - { - if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) - { - if (Endpoint_IsINReady()) - return ENDPOINT_READYWAIT_NoError; - } - else - { - if (Endpoint_IsOUTReceived()) - return ENDPOINT_READYWAIT_NoError; - } - - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_READYWAIT_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_READYWAIT_BusSuspended; - else if (Endpoint_IsStalled()) - return ENDPOINT_READYWAIT_EndpointStalled; - - uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return ENDPOINT_READYWAIT_Timeout; - } - } -} -#endif - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h deleted file mode 100644 index 356c9c3cb9..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h +++ /dev/null @@ -1,795 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Endpoint definitions for the AVR32 UC3 microcontrollers. - * \copydetails Group_EndpointManagement_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointRW - * \defgroup Group_EndpointRW_UC3 Endpoint Data Reading and Writing (UC3) - * \brief Endpoint data read/write definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. - */ - -/** \ingroup Group_EndpointPrimitiveRW - * \defgroup Group_EndpointPrimitiveRW_UC3 Read/Write of Primitive Data Types (UC3) - * \brief Endpoint primitive read/write definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to endpoints. - */ - -/** \ingroup Group_EndpointPacketManagement - * \defgroup Group_EndpointPacketManagement_UC3 Endpoint Packet Management (UC3) - * \brief Endpoint packet management definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to packet management of endpoints. - */ - -/** \ingroup Group_EndpointManagement - * \defgroup Group_EndpointManagement_UC3 Endpoint Management (UC3) - * \brief Endpoint management definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros and enums related to endpoint management when in USB Device mode. This - * module contains the endpoint management macros, as well as endpoint interrupt and data - * send/receive functions for various data types. - * - * @{ - */ - -#ifndef __ENDPOINT_UC3_H__ -#define __ENDPOINT_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBTask.h" - #include "../USBInterrupt.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define ENDPOINT_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL) - - /* Inline Functions: */ - static inline uint32_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST - ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) - { - uint8_t MaskVal = 0; - uint16_t CheckBytes = 8; - - while (CheckBytes < Bytes) - { - MaskVal++; - CheckBytes <<= 1; - } - - return (MaskVal << AVR32_USBB_EPSIZE_OFFSET); - } - - /* Function Prototypes: */ - void Endpoint_ClearEndpoints(void); - bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, - const uint32_t UECFGXData); - - /* External Variables: */ - extern volatile uint32_t USB_Endpoint_SelectedEndpoint; - extern volatile uint8_t* USB_Endpoint_FIFOPos[]; - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) - /** Default size of the default control endpoint's bank, until altered by the control endpoint bank size - * value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined. - */ - #define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 - #endif - - #if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__) - #if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) - #define ENDPOINT_TOTAL_ENDPOINTS 8 - #else - /** Total number of endpoints (including the default control endpoint at address 0) which may - * be used in the device. Different AVR models support different amounts of endpoints, - * this value reflects the maximum number of endpoints for the currently selected AVR model. - */ - #define ENDPOINT_TOTAL_ENDPOINTS 7 - #endif - #else - #define ENDPOINT_TOTAL_ENDPOINTS 1 - #endif - - /* Enums: */ - /** Enum for the possible error return codes of the \ref Endpoint_WaitUntilReady() function. - * - * \ingroup Group_EndpointRW_UC3 - */ - enum Endpoint_WaitUntilReady_ErrorCodes_t - { - ENDPOINT_READYWAIT_NoError = 0, /**< Endpoint is ready for next packet, no error. */ - ENDPOINT_READYWAIT_EndpointStalled = 1, /**< The endpoint was stalled during the stream - * transfer by the host or device. - */ - ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while - * waiting for the endpoint to become ready. - */ - ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and - * no USB endpoint traffic can occur until the bus - * has resumed. - */ - ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - }; - - /* Inline Functions: */ - /** Configures the specified endpoint address with the given endpoint type, direction, bank size - * and banking mode. Once configured, the endpoint may be read from or written to, depending - * on its direction. - * - * \param[in] Address Endpoint address to configure. - * - * \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types - * are available on Low Speed USB devices - refer to the USB 2.0 specification. - * - * \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted - * to the USB host, or after they have been received from the USB host (depending on - * the endpoint's data direction). The bank size must indicate the maximum packet size - * that the endpoint can handle. - * - * \param[in] Banks Number of hardware banks to use for the endpoint being configured. - * - * \attention When the \c ORDERED_EP_CONFIG compile time option is used, Endpoints must be configured in - * ascending order, or bank corruption will occur. - * - * \note Different endpoints may have different maximum packet sizes based on the endpoint's index - refer to - * the chosen microcontroller model's datasheet to determine the maximum bank size for each endpoint. - * \n\n - * - * \note The default control endpoint should not be manually configured by the user application, as - * it is automatically configured by the library internally. - * \n\n - * - * \note This routine will automatically select the specified endpoint upon success. Upon failure, the endpoint - * which failed to reconfigure correctly will be selected. - * - * \return Boolean \c true if the configuration succeeded, \c false otherwise. - */ - static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, - const uint8_t Type, - const uint16_t Size, - const uint8_t Banks) ATTR_ALWAYS_INLINE; - static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, - const uint8_t Type, - const uint16_t Size, - const uint8_t Banks) - { - uint8_t Number = (Address & ENDPOINT_EPNUM_MASK); - - if (Number >= ENDPOINT_TOTAL_ENDPOINTS) - return false; - - return Endpoint_ConfigureEndpoint_Prv(Number, - (AVR32_USBB_ALLOC_MASK | - ((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) | - ((Address & ENDPOINT_DIR_IN) ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) | - ((Banks > 1) ? AVR32_USBB_UECFG0_EPBK_SINGLE : AVR32_USBB_UECFG0_EPBK_DOUBLE) | - Endpoint_BytesToEPSizeMask(Size))); - } - - /** Indicates the number of bytes currently stored in the current endpoint's selected bank. - * - * \ingroup Group_EndpointRW_UC3 - * - * \return Total number of bytes in the currently selected Endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_BytesInEndpoint(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].byct; - } - - /** Determines the currently selected endpoint's direction. - * - * \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask. - */ - static inline uint32_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_GetEndpointDirection(void) - { - return ((&AVR32_USBB.UECFG0)[USB_Endpoint_SelectedEndpoint].epdir ? ENDPOINT_DIR_IN : ENDPOINT_DIR_OUT); - } - - /** Get the endpoint address of the currently selected endpoint. This is typically used to save - * the currently selected endpoint so that it can be restored after another endpoint has been - * manipulated. - * - * \return Index of the currently selected endpoint. - */ - static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_GetCurrentEndpoint(void) - { - return (USB_Endpoint_SelectedEndpoint | Endpoint_GetEndpointDirection()); - } - - /** Selects the given endpoint address. - * - * Any endpoint operations which do not require the endpoint address to be indicated will operate on - * the currently selected endpoint. - * - * \param[in] Address Endpoint address to select. - */ - static inline void Endpoint_SelectEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Endpoint_SelectEndpoint(const uint8_t Address) - { - USB_Endpoint_SelectedEndpoint = (Address & ENDPOINT_EPNUM_MASK); - } - - /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's - * data In and Out pointers to the bank's contents. - * - * \param[in] Address Endpoint number whose FIFO buffers are to be reset. - */ - static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ResetEndpoint(const uint8_t Address) - { - uint32_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK); - - AVR32_USBB.uerst |= (AVR32_USBB_EPRST0_MASK << EndpointNumber); - AVR32_USBB.uerst &= ~(AVR32_USBB_EPRST0_MASK << EndpointNumber); - USB_Endpoint_FIFOPos[EndpointNumber] = &AVR32_USBB_SLAVE[EndpointNumber * ENDPOINT_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Enables the currently selected endpoint so that data can be sent and received through it to - * and from a host. - * - * \note Endpoints must first be configured properly via \ref Endpoint_ConfigureEndpoint(). - */ - static inline void Endpoint_EnableEndpoint(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_EnableEndpoint(void) - { - AVR32_USBB.uerst |= (AVR32_USBB_EPEN0_MASK << USB_Endpoint_SelectedEndpoint); - } - - /** Disables the currently selected endpoint so that data cannot be sent and received through it - * to and from a host. - */ - static inline void Endpoint_DisableEndpoint(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_DisableEndpoint(void) - { - AVR32_USBB.uerst &= ~(AVR32_USBB_EPEN0_MASK << USB_Endpoint_SelectedEndpoint); - } - - /** Determines if the currently selected endpoint is enabled, but not necessarily configured. - * - * \return Boolean \c true if the currently selected endpoint is enabled, \c false otherwise. - */ - static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsEnabled(void) - { - return ((AVR32_USBB.uerst & (AVR32_USBB_EPEN0_MASK << USB_Endpoint_SelectedEndpoint)) ? true : false); - } - - /** Retrieves the number of busy banks in the currently selected endpoint, which have been queued for - * transmission via the \ref Endpoint_ClearIN() command, or are awaiting acknowledgement via the - * \ref Endpoint_ClearOUT() command. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \return Total number of busy banks in the selected endpoint. - */ - static inline uint8_t Endpoint_GetBusyBanks(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Endpoint_GetBusyBanks(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].nbusybk; - } - - /** Aborts all pending IN transactions on the currently selected endpoint, once the bank - * has been queued for transmission to the host via \ref Endpoint_ClearIN(). This function - * will terminate all queued transactions, resetting the endpoint banks ready for a new - * packet. - * - * \ingroup Group_EndpointPacketManagement_UC3 - */ - static inline void Endpoint_AbortPendingIN(void) - { - while (Endpoint_GetBusyBanks() != 0) - { - (&AVR32_USBB.UECON0SET)[USB_Endpoint_SelectedEndpoint].killbks = true; - while ((&AVR32_USBB.UECON0)[USB_Endpoint_SelectedEndpoint].killbk); - } - } - - /** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint - * bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN - * direction). This function will return false if an error has occurred in the endpoint, if the endpoint - * is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN - * direction and the endpoint bank is full. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \return Boolean \c true if the currently selected endpoint may be read from or written to, depending - * on its direction. - */ - static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsReadWriteAllowed(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].rwall; - } - - /** Determines if the currently selected endpoint is configured. - * - * \return Boolean \c true if the currently selected endpoint has been configured, \c false otherwise. - */ - static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsConfigured(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].cfgok; - } - - /** Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their - * interrupt duration has elapsed. Which endpoints have interrupted can be determined by - * masking the return value against (1 << {Endpoint Number}). - * - * \return Mask whose bits indicate which endpoints have interrupted. - */ - static inline uint32_t Endpoint_GetEndpointInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_GetEndpointInterrupts(void) - { - return ((AVR32_USBB.udint & (AVR32_USBB_EP6INT_MASK | AVR32_USBB_EP5INT_MASK | - AVR32_USBB_EP4INT_MASK | AVR32_USBB_EP3INT_MASK | - AVR32_USBB_EP2INT_MASK | AVR32_USBB_EP1INT_MASK | - AVR32_USBB_EP0INT_MASK)) >> AVR32_USBB_EP0INT_OFFSET); - } - - /** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type - * endpoints). - * - * \param[in] Address Address of the endpoint whose interrupt flag should be tested. - * - * \return Boolean \c true if the specified endpoint has interrupted, \c false otherwise. - */ - static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_HasEndpointInterrupted(const uint8_t Address) - { - return ((Endpoint_GetEndpointInterrupts() & (AVR32_USBB_EP0INT_MASK << (Address & ENDPOINT_EPNUM_MASK))) ? true : false); - } - - /** Determines if the selected IN endpoint is ready for a new packet to be sent to the host. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \return Boolean \c true if the current endpoint is ready for an IN packet, \c false otherwise. - */ - static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsINReady(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].txini; - } - - /** Determines if the selected OUT endpoint has received new packet from the host. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \return Boolean \c true if current endpoint is has received an OUT packet, \c false otherwise. - */ - static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsOUTReceived(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].rxouti; - } - - /** Determines if the current CONTROL type endpoint has received a SETUP packet. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \return Boolean \c true if the selected endpoint has received a SETUP packet, \c false otherwise. - */ - static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsSETUPReceived(void) - { - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].rxstpi; - } - - /** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the - * endpoint for the next packet. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \note This is not applicable for non CONTROL type endpoints. - */ - static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearSETUP(void) - { - (&AVR32_USBB.UESTA0CLR)[USB_Endpoint_SelectedEndpoint].rxstpic = true; - USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_Endpoint_SelectedEndpoint * ENDPOINT_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the - * next packet and switching to the alternative endpoint bank if double banked. - * - * \ingroup Group_EndpointPacketManagement_UC3 - */ - static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearIN(void) - { - (&AVR32_USBB.UESTA0CLR)[USB_Endpoint_SelectedEndpoint].txinic = true; - (&AVR32_USBB.UECON0CLR)[USB_Endpoint_SelectedEndpoint].fifoconc = true; - USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_Endpoint_SelectedEndpoint * ENDPOINT_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint - * for the next packet and switching to the alternative endpoint bank if double banked. - * - * \ingroup Group_EndpointPacketManagement_UC3 - */ - static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearOUT(void) - { - (&AVR32_USBB.UESTA0CLR)[USB_Endpoint_SelectedEndpoint].rxoutic = true; - (&AVR32_USBB.UECON0CLR)[USB_Endpoint_SelectedEndpoint].fifoconc = true; - USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_Endpoint_SelectedEndpoint * ENDPOINT_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the - * indicated endpoint and that the current transfer sequence should be aborted. This provides a - * way for devices to indicate invalid commands to the host so that the current transfer can be - * aborted and the host can begin its own recovery sequence. - * - * The currently selected endpoint remains stalled until either the \ref Endpoint_ClearStall() macro - * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected - * endpoint. - * - * \ingroup Group_EndpointPacketManagement_UC3 - */ - static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_StallTransaction(void) - { - (&AVR32_USBB.UECON0SET)[USB_Endpoint_SelectedEndpoint].stallrqs = true; - } - - /** Clears the STALL condition on the currently selected endpoint. - * - * \ingroup Group_EndpointPacketManagement_UC3 - */ - static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearStall(void) - { - (&AVR32_USBB.UECON0CLR)[USB_Endpoint_SelectedEndpoint].stallrqc = true; - } - - /** Determines if the currently selected endpoint is stalled, false otherwise. - * - * \ingroup Group_EndpointPacketManagement_UC3 - * - * \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise. - */ - static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsStalled(void) - { - return (&AVR32_USBB.UECON0)[USB_Endpoint_SelectedEndpoint].stallrq; - } - - /** Resets the data toggle of the currently selected endpoint. */ - static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ResetDataToggle(void) - { - (&AVR32_USBB.UECON0SET)[USB_Endpoint_SelectedEndpoint].rstdts = true; - } - - /** Sets the direction of the currently selected endpoint. - * - * \param[in] DirectionMask New endpoint direction, as a \c ENDPOINT_DIR_* mask. - */ - static inline void Endpoint_SetEndpointDirection(const uint32_t DirectionMask) ATTR_ALWAYS_INLINE; - static inline void Endpoint_SetEndpointDirection(const uint32_t DirectionMask) - { - (&AVR32_USBB.UECFG0)[USB_Endpoint_SelectedEndpoint].epdir = (DirectionMask == ENDPOINT_DIR_IN); - } - - /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \return Next byte in the currently selected endpoint's FIFO buffer. - */ - static inline uint8_t Endpoint_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_Read_8(void) - { - return *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - } - - /** Writes one byte to the currently selected endpoint's bank, for IN direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \param[in] Data Data to write into the the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_8(const uint8_t Data) - { - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = Data; - } - - /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - */ - static inline void Endpoint_Discard_8(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_8(void) - { - uint8_t Dummy; - - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - (void)Dummy; - } - - /** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \return Next two bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_Read_16_LE(void) - { - uint16_t Byte0 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint16_t Byte1 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - return ((Byte1 << 8) | Byte0); - } - - /** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \return Next two bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_Read_16_BE(void) - { - uint16_t Byte0 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint16_t Byte1 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - return ((Byte0 << 8) | Byte1); - } - - /** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_16_LE(const uint16_t Data) - { - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8); - } - - /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_16_BE(const uint16_t Data) - { - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF); - } - - /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - */ - static inline void Endpoint_Discard_16(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_16(void) - { - uint8_t Dummy; - - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - (void)Dummy; - } - - /** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \return Next four bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_Read_32_LE(void) - { - uint32_t Byte0 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint32_t Byte1 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint32_t Byte2 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint32_t Byte3 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0); - } - - /** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \return Next four bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint32_t Endpoint_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_Read_32_BE(void) - { - uint32_t Byte0 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint32_t Byte1 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint32_t Byte2 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - uint32_t Byte3 = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - return ((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3); - } - - /** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_32_LE(const uint32_t Data) - { - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 16); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 24); - } - - /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_32_BE(const uint32_t Data) - { - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 24); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 16); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data >> 8); - *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++) = (Data & 0xFF); - } - - /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_UC3 - */ - static inline void Endpoint_Discard_32(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_32(void) - { - uint8_t Dummy; - - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - Dummy = *(USB_Endpoint_FIFOPos[USB_Endpoint_SelectedEndpoint]++); - - (void)Dummy; - } - - /* External Variables: */ - /** Global indicating the maximum packet size of the default control endpoint located at address - * 0 in the device. This value is set to the value indicated in the device descriptor in the user - * project once the USB interface is initialized into device mode. - * - * If space is an issue, it is possible to fix this to a static value by defining the control - * endpoint size in the \c FIXED_CONTROL_ENDPOINT_SIZE token passed to the compiler in the makefile - * via the -D switch. When a fixed control endpoint size is used, the size is no longer dynamically - * read from the descriptors at runtime and instead fixed to the given value. When used, it is - * important that the descriptor control endpoint size value matches the size given as the - * \c FIXED_CONTROL_ENDPOINT_SIZE token - it is recommended that the \c FIXED_CONTROL_ENDPOINT_SIZE token - * be used in the device descriptors to ensure this. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) - extern uint8_t USB_Device_ControlEndpointSize; - #else - #define USB_Device_ControlEndpointSize FIXED_CONTROL_ENDPOINT_SIZE - #endif - - /* Function Prototypes: */ - /** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple - * endpoints at the same time. - * - * \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the - * control endpoint. - * - * \param[in] Table Pointer to a table of endpoint descriptions. - * \param[in] Entries Number of entries in the endpoint table to configure. - * - * \return Boolean \c true if all endpoints configured successfully, \c false otherwise. - */ - bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, - const uint8_t Entries); - - /** Completes the status stage of a control transfer on a CONTROL type endpoint automatically, - * with respect to the data direction. This is a convenience function which can be used to - * simplify user control request handling. - * - * \note This routine should not be called on non CONTROL type endpoints. - */ - void Endpoint_ClearStatusStage(void); - - /** Spin-loops until the currently selected non-control endpoint is ready for the next packet of data - * to be read or written to it. - * - * \note This routine should not be called on CONTROL type endpoints. - * - * \ingroup Group_EndpointRW_UC3 - * - * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t Endpoint_WaitUntilReady(void); - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c deleted file mode 100644 index 24e2136e4f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#define __INCLUDE_FROM_HOST_C -#include "../Host.h" - -void USB_Host_ProcessNextHostState(void) -{ - uint8_t ErrorCode = HOST_ENUMERROR_NoError; - uint8_t SubErrorCode = HOST_ENUMERROR_NoError; - - static uint16_t WaitMSRemaining; - static uint8_t PostWaitState; - - switch (USB_HostState) - { - case HOST_STATE_WaitForDevice: - if (WaitMSRemaining) - { - if ((SubErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) - { - USB_HostState = PostWaitState; - ErrorCode = HOST_ENUMERROR_WaitStage; - break; - } - - if (!(--WaitMSRemaining)) - USB_HostState = PostWaitState; - } - - break; - case HOST_STATE_Powered: - WaitMSRemaining = HOST_DEVICE_SETTLE_DELAY_MS; - - USB_HostState = HOST_STATE_Powered_WaitForDeviceSettle; - break; - case HOST_STATE_Powered_WaitForDeviceSettle: - if (WaitMSRemaining--) - { - Delay_MS(1); - break; - } - else - { - USB_Host_VBUS_Manual_Off(); - - USB_OTGPAD_On(); - USB_Host_VBUS_Auto_Enable(); - USB_Host_VBUS_Auto_On(); - - #if defined(NO_AUTO_VBUS_MANAGEMENT) - USB_Host_VBUS_Manual_Enable(); - USB_Host_VBUS_Manual_On(); - #endif - - USB_HostState = HOST_STATE_Powered_WaitForConnect; - } - - break; - case HOST_STATE_Powered_WaitForConnect: - if (USB_INT_HasOccurred(USB_INT_DCONNI)) - { - USB_INT_Clear(USB_INT_DCONNI); - USB_INT_Clear(USB_INT_DDISCI); - - USB_INT_Clear(USB_INT_VBERRI); - USB_INT_Enable(USB_INT_VBERRI); - - USB_Host_ResumeBus(); - Pipe_ClearPipes(); - - HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Powered_DoReset); - } - - break; - case HOST_STATE_Powered_DoReset: - USB_Host_ResetDevice(); - - HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe); - break; - case HOST_STATE_Powered_ConfigPipe: - if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, PIPE_CONTROLPIPE_DEFAULT_SIZE, 1))) - { - ErrorCode = HOST_ENUMERROR_PipeConfigError; - SubErrorCode = 0; - break; - } - - USB_HostState = HOST_STATE_Default; - break; - case HOST_STATE_Default: - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_GetDescriptor, - .wValue = (DTYPE_Device << 8), - .wIndex = 0, - .wLength = 8, - }; - - uint8_t DataBuffer[8]; - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful) - { - ErrorCode = HOST_ENUMERROR_ControlError; - break; - } - - USB_Host_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, Endpoint0Size)]; - - USB_Host_ResetDevice(); - - HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset); - break; - case HOST_STATE_Default_PostReset: - if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL, ENDPOINT_CONTROLEP, USB_Host_ControlPipeSize, 1))) - { - ErrorCode = HOST_ENUMERROR_PipeConfigError; - SubErrorCode = 0; - break; - } - - USB_ControlRequest = (USB_Request_Header_t) - { - .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE), - .bRequest = REQ_SetAddress, - .wValue = USB_HOST_DEVICEADDRESS, - .wIndex = 0, - .wLength = 0, - }; - - if ((SubErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) - { - ErrorCode = HOST_ENUMERROR_ControlError; - break; - } - - HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Default_PostAddressSet); - break; - case HOST_STATE_Default_PostAddressSet: - USB_Host_SetDeviceAddress(USB_HOST_DEVICEADDRESS); - - USB_HostState = HOST_STATE_Addressed; - - EVENT_USB_Host_DeviceEnumerationComplete(); - break; - } - - if ((ErrorCode != HOST_ENUMERROR_NoError) && (USB_HostState != HOST_STATE_Unattached)) - { - EVENT_USB_Host_DeviceEnumerationFailed(ErrorCode, SubErrorCode); - - USB_Host_VBUS_Auto_Off(); - - EVENT_USB_Host_DeviceUnattached(); - - USB_ResetInterface(); - } -} - -uint8_t USB_Host_WaitMS(uint8_t MS) -{ - bool BusSuspended = USB_Host_IsBusSuspended(); - uint8_t ErrorCode = HOST_WAITERROR_Successful; - bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); - - USB_INT_Disable(USB_INT_HSOFI); - USB_INT_Clear(USB_INT_HSOFI); - - USB_Host_ResumeBus(); - - while (MS) - { - if (USB_INT_HasOccurred(USB_INT_HSOFI)) - { - USB_INT_Clear(USB_INT_HSOFI); - MS--; - } - - if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host)) - { - ErrorCode = HOST_WAITERROR_DeviceDisconnect; - - break; - } - - if (Pipe_IsError()) - { - Pipe_ClearError(); - ErrorCode = HOST_WAITERROR_PipeError; - - break; - } - - if (Pipe_IsStalled()) - { - Pipe_ClearStall(); - ErrorCode = HOST_WAITERROR_SetupStalled; - - break; - } - } - - if (BusSuspended) - USB_Host_SuspendBus(); - - if (HSOFIEnabled) - USB_INT_Enable(USB_INT_HSOFI); - - return ErrorCode; -} - -static void USB_Host_ResetDevice(void) -{ - bool BusSuspended = USB_Host_IsBusSuspended(); - - USB_INT_Disable(USB_INT_DDISCI); - - USB_Host_ResetBus(); - while (!(USB_Host_IsBusResetComplete())); - USB_Host_ResumeBus(); - - USB_Host_ConfigurationNumber = 0; - - bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI); - - USB_INT_Disable(USB_INT_HSOFI); - USB_INT_Clear(USB_INT_HSOFI); - - for (uint8_t MSRem = 10; MSRem != 0; MSRem--) - { - /* Workaround for powerless-pull-up devices. After a USB bus reset, - all disconnection interrupts are suppressed while a USB frame is - looked for - if it is found within 10ms, the device is still - present. */ - - if (USB_INT_HasOccurred(USB_INT_HSOFI)) - { - USB_INT_Clear(USB_INT_HSOFI); - USB_INT_Clear(USB_INT_DDISCI); - break; - } - - Delay_MS(1); - } - - if (HSOFIEnabled) - USB_INT_Enable(USB_INT_HSOFI); - - if (BusSuspended) - USB_Host_SuspendBus(); - - USB_INT_Enable(USB_INT_DDISCI); -} - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h deleted file mode 100644 index 07559cd3fc..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h +++ /dev/null @@ -1,363 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Host definitions for the AVR32 UC3B microcontrollers. - * \copydetails Group_Host_UC3B - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_Host - * \defgroup Group_Host_UC3B Host Management (UC3B) - * \brief USB Host definitions for the AVR32 UC3B microcontrollers. - * - * Architecture specific USB Host definitions for the Atmel 32-bit AVR UC3B microcontrollers. - * - * @{ - */ - -#ifndef __USBHOST_UC3B_H__ -#define __USBHOST_UC3B_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../StdDescriptors.h" - #include "../Pipe.h" - #include "../USBInterrupt.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Indicates the fixed USB device address which any attached device is enumerated to when in - * host mode. As only one USB device may be attached to the AVR in host mode at any one time - * and that the address used is not important (other than the fact that it is non-zero), a - * fixed value is specified by the library. - */ - #define USB_HOST_DEVICEADDRESS 1 - - #if !defined(HOST_DEVICE_SETTLE_DELAY_MS) || defined(__DOXYGEN__) - /** Constant for the delay in milliseconds after a device is connected before the library - * will start the enumeration process. Some devices require a delay of up to 5 seconds - * after connection before the enumeration process can start or incorrect operation will - * occur. - * - * The default delay value may be overridden in the user project makefile by defining the - * \c HOST_DEVICE_SETTLE_DELAY_MS token to the required delay in milliseconds, and passed to the - * compiler using the -D switch. - */ - #define HOST_DEVICE_SETTLE_DELAY_MS 1000 - #endif - - /* Enums: */ - /** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event. - * - * \see \ref Group_Events for more information on this event. - */ - enum USB_Host_ErrorCodes_t - { - HOST_ERROR_VBusVoltageDip = 0, /**< VBUS voltage dipped to an unacceptable level. This - * error may be the result of an attached device drawing - * too much current from the VBUS line, or due to the - * AVR's power source being unable to supply sufficient - * current. - */ - }; - - /** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event. - * - * \see \ref Group_Events for more information on this event. - */ - enum USB_Host_EnumerationErrorCodes_t - { - HOST_ENUMERROR_NoError = 0, /**< No error occurred. Used internally, this is not a valid - * ErrorCode parameter value for the \ref EVENT_USB_Host_DeviceEnumerationFailed() - * event. - */ - HOST_ENUMERROR_WaitStage = 1, /**< One of the delays between enumeration steps failed - * to complete successfully, due to a timeout or other - * error. - */ - HOST_ENUMERROR_NoDeviceDetected = 2, /**< No device was detected, despite the USB data lines - * indicating the attachment of a device. - */ - HOST_ENUMERROR_ControlError = 3, /**< One of the enumeration control requests failed to - * complete successfully. - */ - HOST_ENUMERROR_PipeConfigError = 4, /**< The default control pipe (address 0) failed to - * configure correctly. - */ - }; - - /* Inline Functions: */ - /** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended) - * the frame number is incremented by one. - * - * \return Current USB frame number from the USB controller. - */ - static inline uint16_t USB_Host_GetFrameNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t USB_Host_GetFrameNumber(void) - { - return AVR32_USBB_UHFNUM; - } - - #if !defined(NO_SOF_EVENTS) - /** Enables the host mode Start Of Frame events. When enabled, this causes the - * \ref EVENT_USB_Host_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, - * at the start of each USB frame when a device is enumerated while in host mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Host_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_EnableSOFEvents(void) - { - USB_INT_Enable(USB_INT_HSOFI); - } - - /** Disables the host mode Start Of Frame events. When disabled, this stops the firing of the - * \ref EVENT_USB_Host_StartOfFrame() event when enumerated in host mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Host_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_DisableSOFEvents(void) - { - USB_INT_Disable(USB_INT_HSOFI); - } - #endif - - /** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host. - * USB bus resets leave the default control pipe configured (if already configured). - * - * If the USB bus has been suspended prior to issuing a bus reset, the attached device will be - * woken up automatically and the bus resumed after the reset has been correctly issued. - */ - static inline void USB_Host_ResetBus(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ResetBus(void) - { - AVR32_USBB.UHCON.reset = true; - } - - /** Determines if a previously issued bus reset (via the \ref USB_Host_ResetBus() macro) has - * completed. - * - * \return Boolean \c true if no bus reset is currently being sent, \c false otherwise. - */ - static inline bool USB_Host_IsBusResetComplete(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsBusResetComplete(void) - { - return AVR32_USBB.UHCON.reset; - } - - /** Resumes USB communications with an attached and enumerated device, by resuming the transmission - * of the 1MS Start Of Frame messages to the device. When resumed, USB communications between the - * host and attached device may occur. - */ - static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ResumeBus(void) - { - AVR32_USBB.UHCON.sofe = true; - } - - /** Suspends the USB bus, preventing any communications from occurring between the host and attached - * device until the bus has been resumed. This stops the transmission of the 1MS Start Of Frame - * messages to the device. - * - * \note While the USB bus is suspended, all USB interrupt sources are also disabled; this means that - * some events (such as device disconnections) will not fire until the bus is resumed. - */ - static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_SuspendBus(void) - { - AVR32_USBB.UHCON.sofe = false; - } - - /** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro, - * false otherwise. While suspended, no USB communications can occur until the bus is resumed, - * except for the Remote Wakeup event from the device if supported. - * - * \return Boolean \c true if the bus is currently suspended, \c false otherwise. - */ - static inline bool USB_Host_IsBusSuspended(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsBusSuspended(void) - { - return AVR32_USBB.UHCON.sofe; - } - - /** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or - * false if the attached device is enumerated in Low Speed mode (1.5Mb/s). - * - * \return Boolean \c true if the attached device is enumerated in Full Speed mode, \c false otherwise. - */ - static inline bool USB_Host_IsDeviceFullSpeed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsDeviceFullSpeed(void) - { - return (AVR32_USBB.USBSTA.speed == AVR32_USBB_SPEED_FULL); - } - - /** Determines if the attached device is currently issuing a Remote Wakeup request, requesting - * that the host resume the USB bus and wake up the device, false otherwise. - * - * \return Boolean \c true if the attached device has sent a Remote Wakeup request, \c false otherwise. - */ - static inline bool USB_Host_IsRemoteWakeupSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsRemoteWakeupSent(void) - { - return AVR32_USBB.UHINT.rxrsmi; - } - - /** Clears the flag indicating that a Remote Wakeup request has been issued by an attached device. */ - static inline void USB_Host_ClearRemoteWakeupSent(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ClearRemoteWakeupSent(void) - { - AVR32_USBB.UHINTCLR.rxrsmic = true; - } - - /** Accepts a Remote Wakeup request from an attached device. This must be issued in response to - * a device's Remote Wakeup request within 2ms for the request to be accepted and the bus to - * be resumed. - */ - static inline void USB_Host_ResumeFromWakeupRequest(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_ResumeFromWakeupRequest(void) - { - AVR32_USBB.UHCON.resume = true; - } - - /** Determines if a resume from Remote Wakeup request is currently being sent to an attached - * device. - * - * \return Boolean \c true if no resume request is currently being sent, \c false otherwise. - */ - static inline bool USB_Host_IsResumeFromWakeupRequestSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_Host_IsResumeFromWakeupRequestSent(void) - { - return AVR32_USBB.UHCON.resume; - } - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - static inline void USB_Host_HostMode_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_HostMode_On(void) - { - // Not required for UC3B - } - - static inline void USB_Host_HostMode_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_HostMode_Off(void) - { - // Not required for UC3B - } - - static inline void USB_Host_VBUS_Auto_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Auto_Enable(void) - { - AVR32_USBB.USBCON.vbushwc = false; - } - - static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Manual_Enable(void) - { - AVR32_USBB.USBCON.vbushwc = true; - } - - static inline void USB_Host_VBUS_Auto_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Auto_On(void) - { - AVR32_USBB.USBSTASET.vbusrqs = true; - } - - static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Manual_On(void) - { - AVR32_USBB.USBSTASET.vbusrqs = true; - } - - static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Auto_Off(void) - { - AVR32_USBB.USBSTACLR.vbusrqc = true; - } - - static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_Host_VBUS_Manual_Off(void) - { - AVR32_USBB.USBSTACLR.vbusrqc = true; - } - - static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void USB_Host_SetDeviceAddress(const uint8_t Address) - { - AVR32_USBB.UHADDR1.uhaddr_p0 = Address; - AVR32_USBB.UHADDR1.uhaddr_p1 = Address; - AVR32_USBB.UHADDR1.uhaddr_p2 = Address; - AVR32_USBB.UHADDR1.uhaddr_p3 = Address; - AVR32_USBB.UHADDR2.uhaddr_p4 = Address; - AVR32_USBB.UHADDR2.uhaddr_p5 = Address; - AVR32_USBB.UHADDR2.uhaddr_p6 = Address; - } - - /* Enums: */ - enum USB_Host_WaitMSErrorCodes_t - { - HOST_WAITERROR_Successful = 0, - HOST_WAITERROR_DeviceDisconnect = 1, - HOST_WAITERROR_PipeError = 2, - HOST_WAITERROR_SetupStalled = 3, - }; - - /* Function Prototypes: */ - void USB_Host_ProcessNextHostState(void); - uint8_t USB_Host_WaitMS(uint8_t MS); - - #if defined(__INCLUDE_FROM_HOST_C) - static void USB_Host_ResetDevice(void); - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c deleted file mode 100644 index 20c8bf1e6d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#include "PipeStream_UC3.h" - -uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_IN); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - Pipe_SetPipeToken(PIPE_TOKEN_OUT); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - Pipe_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - USB_USBTask(); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - Pipe_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_TOKEN PIPE_TOKEN_OUT -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr) -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_TOKEN PIPE_TOKEN_IN -#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8() -#include "Template/Template_Pipe_RW.c" - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h deleted file mode 100644 index 34c82ad296..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Pipe data stream transmission and reception management for the AVR32 UC3 microcontrollers. - * \copydetails Group_PipeStreamRW_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeStreamRW - * \defgroup Group_PipeStreamRW_UC3 Read/Write of Multi-Byte Streams (UC3) - * \brief Pipe data stream transmission and reception management for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to pipes. - * - * @{ - */ - -#ifndef __PIPE_STREAM_UC3_H__ -#define __PIPE_STREAM_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host - * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes empty while there is still data - * to process (and after the current packet has been acknowledged) the BytesProcessed location will be updated with - * the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Discard_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Discard_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of bytes to discard via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the pipe, sending full pipe packets from the host to the device - * as needed. The last packet is not automatically sent once the remaining bytes has been written; the - * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, failing or - * succeeding as a single unit. If the BytesProcessed parameter points to a valid storage location, the transfer - * will instead be performed as a series of chunks. Each time the pipe bank becomes full while there is still data - * to process (and after the current packet transmission has been initiated) the BytesProcessed location will be - * updated with the total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed in the user code - to - * continue the transfer, call the function again with identical parameters and it will resume until the BytesProcessed - * value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Null_Stream(512, NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Null_Stream(512, &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Length Number of zero bytes to write via the currently selected pipe. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be processed at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the pipe from the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the pipe from the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in little endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the pipe bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref PIPE_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Pipe_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == PIPE_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != PIPE_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the pipe into the given buffer in big endian, - * sending full packets to the device as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is - * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers. - * - * \note The pipe token is set automatically, thus this can be used on bi-directional pipes directly without - * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken(). - * - * \param[out] Buffer Pointer to the source data buffer to write to. - * \param[in] Length Number of bytes to read for the currently selected pipe to read from. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes already processed should - * updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Pipe_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c deleted file mode 100644 index 6128869b04..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#include "../Pipe.h" - -uint8_t USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; - -volatile uint32_t USB_Pipe_SelectedPipe = PIPE_CONTROLPIPE; -volatile uint8_t* USB_Pipe_FIFOPos[PIPE_TOTAL_PIPES]; - -bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table, - const uint8_t Entries) -{ - for (uint8_t i = 0; i < Entries; i++) - { - if (!(Table[i].Address)) - continue; - - if (!(Pipe_ConfigurePipe(Table[i].Address, Table[i].Type, Table[i].EndpointAddress, Table[i].Size, Table[i].Banks))) - { - return false; - } - } - - return true; -} - -bool Pipe_ConfigurePipe(const uint8_t Address, - const uint8_t Type, - const uint8_t EndpointAddress, - const uint16_t Size, - const uint8_t Banks) -{ - uint8_t Number = (Address & PIPE_EPNUM_MASK); - uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT; - - if (Number >= PIPE_TOTAL_PIPES) - return false; - - if (Type == EP_TYPE_CONTROL) - Token = PIPE_TOKEN_SETUP; - - USB_Pipe_FIFOPos[Number] = &AVR32_USBB_SLAVE[Number * PIPE_HSB_ADDRESS_SPACE_SIZE]; - -#if defined(ORDERED_EP_CONFIG) - Pipe_SelectPipe(Number); - Pipe_EnablePipe(); - - (&AVR32_USBB.upcfg0)[Number] = 0; - (&AVR32_USBB.upcfg0)[Number] = (AVR32_USBB_ALLOC_MASK | - ((uint32_t)Type << AVR32_USBB_PTYPE_OFFSET) | - ((uint32_t)Token << AVR32_USBB_PTOKEN_OFFSET) | - ((Banks > 1) ? AVR32_USBB_PBK_MASK : 0) | - Pipe_BytesToEPSizeMask(Size) | - ((uint32_t)Number << AVR32_USBB_PEPNUM_OFFSET)); - - Pipe_SetInfiniteINRequests(); - - return Pipe_IsConfigured(); -#else - for (uint8_t PNum = Number; PNum < PIPE_TOTAL_PIPES; PNum++) - { - uint32_t UPCFG0Temp; - - Pipe_SelectPipe(PNum); - - if (PNum == Number) - { - UPCFG0Temp = (AVR32_USBB_ALLOC_MASK | - ((uint32_t)Type << AVR32_USBB_PTYPE_OFFSET) | - ((uint32_t)Token << AVR32_USBB_PTOKEN_OFFSET) | - ((Banks > 1) ? AVR32_USBB_PBK_MASK : 0) | - Pipe_BytesToEPSizeMask(Size) | - ((EndpointAddress & PIPE_EPNUM_MASK) << AVR32_USBB_PEPNUM_OFFSET)); - } - else - { - UPCFG0Temp = (&AVR32_USBB.upcfg0)[PNum]; - } - - if (!(UPCFG0Temp & AVR32_USBB_ALLOC_MASK)) - continue; - - Pipe_DisablePipe(); - (&AVR32_USBB.upcfg0)[PNum] &= ~AVR32_USBB_ALLOC_MASK; - - Pipe_EnablePipe(); - (&AVR32_USBB.upcfg0)[PNum] = UPCFG0Temp; - - Pipe_SetInfiniteINRequests(); - - if (!(Pipe_IsConfigured())) - return false; - } - - Pipe_SelectPipe(Number); - return true; -#endif -} - -void Pipe_ClearPipes(void) -{ - for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) - { - Pipe_SelectPipe(PNum); - (&AVR32_USBB.upcfg0)[PNum] = 0; - (&AVR32_USBB.upcon0clr)[PNum] = -1; - USB_Pipe_FIFOPos[PNum] = &AVR32_USBB_SLAVE[PNum * 0x10000]; - Pipe_DisablePipe(); - } -} - -bool Pipe_IsEndpointBound(const uint8_t EndpointAddress) -{ - uint8_t PrevPipeNumber = Pipe_GetCurrentPipe(); - - for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) - { - Pipe_SelectPipe(PNum); - - if (!(Pipe_IsConfigured())) - continue; - - if (Pipe_GetBoundEndpointAddress() == EndpointAddress) - return true; - } - - Pipe_SelectPipe(PrevPipeNumber); - return false; -} - -uint8_t Pipe_WaitUntilReady(void) -{ - #if (USB_STREAM_TIMEOUT_MS < 0xFF) - uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #else - uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #endif - - uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); - - for (;;) - { - if (Pipe_GetPipeToken() == PIPE_TOKEN_IN) - { - if (Pipe_IsINReceived()) - return PIPE_READYWAIT_NoError; - } - else - { - if (Pipe_IsOUTReady()) - return PIPE_READYWAIT_NoError; - } - - if (Pipe_IsStalled()) - return PIPE_READYWAIT_PipeStalled; - else if (USB_HostState == HOST_STATE_Unattached) - return PIPE_READYWAIT_DeviceDisconnected; - - uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return PIPE_READYWAIT_Timeout; - } - } -} - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h deleted file mode 100644 index 6de574e9c1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h +++ /dev/null @@ -1,924 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Pipe definitions for the AVR32 UC3 microcontrollers. - * \copydetails Group_PipeManagement_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_PipeRW - * \defgroup Group_PipeRW_UC3 Pipe Data Reading and Writing (UC3) - * \brief Pipe data read/write definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to pipes. - */ - -/** \ingroup Group_PipePrimitiveRW - * \defgroup Group_PipePrimitiveRW_UC3 Read/Write of Primitive Data Types (UC3) - * \brief Pipe primitive data read/write definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to pipes. - */ - -/** \ingroup Group_PipePacketManagement - * \defgroup Group_PipePacketManagement_UC3 Pipe Packet Management (UC3) - * \brief Pipe packet management definitions for the Atmel AVR32 UC3 architecture. - * - * Functions, macros, variables, enums and types related to packet management of pipes. - */ - -/** \ingroup Group_PipeControlReq - * \defgroup Group_PipeControlReq_UC3 Pipe Control Request Management (UC3) - * \brief Pipe control request management definitions for the Atmel AVR32 UC3 architecture. - * - * Module for host mode request processing. This module allows for the transmission of standard, class and - * vendor control requests to the default control endpoint of an attached device while in host mode. - * - * \see Chapter 9 of the USB 2.0 specification. - */ - -/** \ingroup Group_PipeManagement - * \defgroup Group_PipeManagement_UC3 Pipe Management (UC3) - * \brief Pipe management definitions for the Atmel AVR32 UC3 architecture. - * - * This module contains functions, macros and enums related to pipe management when in USB Host mode. This - * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions - * for various data types. - * - * @{ - */ - -#ifndef __PIPE_UC3_H__ -#define __PIPE_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #define PIPE_HSB_ADDRESS_SPACE_SIZE (64 * 1024UL) - - /* External Variables: */ - extern volatile uint32_t USB_Pipe_SelectedPipe; - extern volatile uint8_t* USB_Pipe_FIFOPos[]; - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name Pipe Error Flag Masks */ - //@{ - /** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */ - #define PIPE_ERRORFLAG_OVERFLOW (AVR32_USBB_UPSTA0_OVERFI_MASK << 8) - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a CRC error occurred in the pipe on the received data. */ - #define PIPE_ERRORFLAG_CRC16 AVR32_USBB_UPERR0_CRC16_MASK - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware timeout error occurred in the pipe. */ - #define PIPE_ERRORFLAG_TIMEOUT AVR32_USBB_UPERR0_TIMEOUT_MASK - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware PID error occurred in the pipe. */ - #define PIPE_ERRORFLAG_PID AVR32_USBB_UPERR0_PID_MASK - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data PID error occurred in the pipe. */ - #define PIPE_ERRORFLAG_DATAPID AVR32_USBB_UPERR0_DATAPID_MASK - - /** Mask for \ref Pipe_GetErrorFlags(), indicating that a hardware data toggle error occurred in the pipe. */ - #define PIPE_ERRORFLAG_DATATGL AVR32_USBB_UPERR0_DATATGL_MASK - //@} - - /** \name Pipe Token Masks */ - //@{ - /** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a SETUP token (for CONTROL type pipes), - * which will trigger a control request on the attached device when data is written to the pipe. - */ - #define PIPE_TOKEN_SETUP AVR32_USBB_UPCFG0_PTOKEN_SETUP - - /** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a IN token (for non-CONTROL type pipes), - * indicating that the pipe data will flow from device to host. - */ - #define PIPE_TOKEN_IN AVR32_USBB_UPCFG0_PTOKEN_IN - - /** Token mask for \ref Pipe_SetPipeToken() and \ref Pipe_GetPipeToken(). This sets the pipe as a OUT token (for non-CONTROL type pipes), - * indicating that the pipe data will flow from host to device. - */ - #define PIPE_TOKEN_OUT AVR32_USBB_UPCFG0_PTOKEN_OUT - //@} - - /** Default size of the default control pipe's bank, until altered by the Endpoint0Size value - * in the device descriptor of the attached device. - */ - #define PIPE_CONTROLPIPE_DEFAULT_SIZE 64 - - #if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) || defined(__DOXYGEN__) - /** Total number of pipes (including the default control pipe at address 0) which may be used in - * the device. - */ - #define PIPE_TOTAL_PIPES 8 - #else - #define PIPE_TOTAL_PIPES 7 - #endif - - /** Size in bytes of the largest pipe bank size possible in the device. Not all banks on each AVR - * model supports the largest bank size possible on the device; different pipe numbers support - * different maximum bank sizes. This value reflects the largest possible bank of any pipe on the - * currently selected UC3 AVR model. - */ - #define PIPE_MAX_SIZE 256 - - /* Enums: */ - /** Enum for the possible error return codes of the \ref Pipe_WaitUntilReady() function. - * - * \ingroup Group_PipeRW_UC3 - */ - enum Pipe_WaitUntilReady_ErrorCodes_t - { - PIPE_READYWAIT_NoError = 0, /**< Pipe ready for next packet, no error. */ - PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */ - PIPE_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while waiting. */ - PIPE_READYWAIT_Timeout = 3, /**< The device failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - }; - - /* Inline Functions: */ - /** Indicates the number of bytes currently stored in the current pipes's selected bank. - * - * \ingroup Group_PipeRW_UC3 - * - * \return Total number of bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint16_t Pipe_BytesInPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Pipe_BytesInPipe(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].pbyct; - } - - /** Determines the currently selected pipe's direction. - * - * \return The currently selected pipe's direction, as a \c PIPE_DIR_* mask. - */ - static inline uint8_t Pipe_GetPipeDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetPipeDirection(void) - { - return (((&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].ptoken == PIPE_TOKEN_OUT) ? PIPE_DIR_OUT : PIPE_DIR_IN); - } - - /** Returns the pipe address of the currently selected pipe. This is typically used to save the - * currently selected pipe number so that it can be restored after another pipe has been manipulated. - * - * \return Index of the currently selected pipe. - */ - static inline uint8_t Pipe_GetCurrentPipe(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetCurrentPipe(void) - { - return (USB_Pipe_SelectedPipe | Pipe_GetPipeDirection()); - } - - /** Selects the given pipe address. Any pipe operations which do not require the pipe address to be - * indicated will operate on the currently selected pipe. - * - * \param[in] Address Address of the pipe to select. - */ - static inline void Pipe_SelectPipe(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Pipe_SelectPipe(const uint8_t Address) - { - USB_Pipe_SelectedPipe = (Address & PIPE_EPNUM_MASK); - } - - /** Resets the desired pipe, including the pipe banks and flags. - * - * \param[in] Address Index of the pipe to reset. - */ - static inline void Pipe_ResetPipe(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Pipe_ResetPipe(const uint8_t Address) - { - uint32_t PipeNumber = (Address & PIPE_EPNUM_MASK); - - AVR32_USBB.uprst |= (AVR32_USBB_PRST0_MASK << PipeNumber); - AVR32_USBB.uprst &= ~(AVR32_USBB_PRST0_MASK << PipeNumber); - USB_Pipe_FIFOPos[PipeNumber] = &AVR32_USBB_SLAVE[PipeNumber * PIPE_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Enables the currently selected pipe so that data can be sent and received through it to and from - * an attached device. - * - * \pre The currently selected pipe must first be configured properly via \ref Pipe_ConfigurePipe(). - */ - static inline void Pipe_EnablePipe(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_EnablePipe(void) - { - AVR32_USBB.uprst |= (AVR32_USBB_PEN0_MASK << USB_Pipe_SelectedPipe); - } - - /** Disables the currently selected pipe so that data cannot be sent and received through it to and - * from an attached device. - */ - static inline void Pipe_DisablePipe(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_DisablePipe(void) - { - AVR32_USBB.uprst &= ~(AVR32_USBB_PEN0_MASK << USB_Pipe_SelectedPipe); - } - - /** Determines if the currently selected pipe is enabled, but not necessarily configured. - * - * \return Boolean \c true if the currently selected pipe is enabled, \c false otherwise. - */ - static inline bool Pipe_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsEnabled(void) - { - return ((AVR32_USBB.uprst & (AVR32_USBB_PEN0_MASK << USB_Pipe_SelectedPipe)) ? true : false); - } - - /** Gets the current pipe token, indicating the pipe's data direction and type. - * - * \return The current pipe token, as a \c PIPE_TOKEN_* mask. - */ - static inline uint8_t Pipe_GetPipeToken(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetPipeToken(void) - { - return (&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].ptoken; - } - - /** Sets the token for the currently selected pipe to one of the tokens specified by the \c PIPE_TOKEN_* - * masks. This can be used on CONTROL type pipes, to allow for bidirectional transfer of data during - * control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices - * which have two endpoints of opposite direction sharing the same endpoint address within the device. - * - * \param[in] Token New pipe token to set the selected pipe to, as a \c PIPE_TOKEN_* mask. - */ - static inline void Pipe_SetPipeToken(const uint8_t Token) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetPipeToken(const uint8_t Token) - { - (&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].ptoken = Token; - } - - /** Configures the currently selected pipe to allow for an unlimited number of IN requests. */ - static inline void Pipe_SetInfiniteINRequests(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetInfiniteINRequests(void) - { - (&AVR32_USBB.UPINRQ0)[USB_Pipe_SelectedPipe].inmode = true; - } - - /** Configures the currently selected pipe to only allow the specified number of IN requests to be - * accepted by the pipe before it is automatically frozen. - * - * \param[in] TotalINRequests Total number of IN requests that the pipe may receive before freezing. - */ - static inline void Pipe_SetFiniteINRequests(const uint8_t TotalINRequests) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetFiniteINRequests(const uint8_t TotalINRequests) - { - (&AVR32_USBB.UPINRQ0)[USB_Pipe_SelectedPipe].inmode = false; - (&AVR32_USBB.UPINRQ0)[USB_Pipe_SelectedPipe].inrq = TotalINRequests; - } - - /** Determines if the currently selected pipe is configured. - * - * \return Boolean \c true if the selected pipe is configured, \c false otherwise. - */ - static inline bool Pipe_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsConfigured(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].cfgok; - } - - /** Retrieves the endpoint address of the endpoint within the attached device that the currently selected - * pipe is bound to. - * - * \return Endpoint address the currently selected pipe is bound to. - */ - static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetBoundEndpointAddress(void) - { - return ((&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].pepnum | - ((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? PIPE_DIR_IN : PIPE_DIR_OUT)); - } - - /** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds. - * - * \param[in] Milliseconds Number of milliseconds between each pipe poll. - */ - static inline void Pipe_SetInterruptPeriod(const uint8_t Milliseconds) ATTR_ALWAYS_INLINE; - static inline void Pipe_SetInterruptPeriod(const uint8_t Milliseconds) - { - (&AVR32_USBB.UPCFG0)[USB_Pipe_SelectedPipe].intfrq = Milliseconds; - } - - /** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should - * be serviced. - * - * \return Mask whose bits indicate which pipes have interrupted. - */ - static inline uint8_t Pipe_GetPipeInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetPipeInterrupts(void) - { - return ((AVR32_USBB.uhint & (AVR32_USBB_P6INT_MASK | AVR32_USBB_P5INT_MASK | - AVR32_USBB_P4INT_MASK | AVR32_USBB_P3INT_MASK | - AVR32_USBB_P2INT_MASK | AVR32_USBB_P1INT_MASK | - AVR32_USBB_P0INT_MASK)) >> AVR32_USBB_P0INT_OFFSET); - } - - /** Determines if the specified pipe address has interrupted (valid only for INTERRUPT type - * pipes). - * - * \param[in] Address Address of the pipe whose interrupt flag should be tested. - * - * \return Boolean \c true if the specified pipe has interrupted, \c false otherwise. - */ - static inline bool Pipe_HasPipeInterrupted(const uint8_t Address) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_HasPipeInterrupted(const uint8_t Address) - { - return ((AVR32_USBB.uhint & (AVR32_USBB_P0INTES_MASK << (Address & PIPE_EPNUM_MASK))) ? true : false); - } - - /** Unfreezes the selected pipe, allowing it to communicate with an attached device. */ - static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Unfreeze(void) - { - (&AVR32_USBB.UPCON0CLR)[USB_Pipe_SelectedPipe].pfreezec = true; - } - - /** Freezes the selected pipe, preventing it from communicating with an attached device. */ - static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Freeze(void) - { - (&AVR32_USBB.UPCON0SET)[USB_Pipe_SelectedPipe].pfreezes = true; - } - - /** Determines if the currently selected pipe is frozen, and not able to accept data. - * - * \return Boolean \c true if the currently selected pipe is frozen, \c false otherwise. - */ - static inline bool Pipe_IsFrozen(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsFrozen(void) - { - return (((&AVR32_USBB.UPCON0)[USB_Pipe_SelectedPipe].pfreeze) ? true : false); - } - - /** Clears the error flags for the currently selected pipe. */ - static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearError(void) - { - (&AVR32_USBB.uperr0)[USB_Pipe_SelectedPipe] = 0; - (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].overfic = true; - } - - /** Determines if the master pipe error flag is set for the currently selected pipe, indicating that - * some sort of hardware error has occurred on the pipe. - * - * \see \ref Pipe_GetErrorFlags() macro for information on retrieving the exact error flag. - * - * \return Boolean \c true if an error has occurred on the selected pipe, \c false otherwise. - */ - static inline bool Pipe_IsError(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsError(void) - { - return (((&AVR32_USBB.upsta0)[USB_Pipe_SelectedPipe] & - (AVR32_USBB_PERRI_MASK | AVR32_USBB_OVERFI_MASK)) ? true : false); - } - - /** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This - * value can then be masked against the \c PIPE_ERRORFLAG_* masks to determine what error has occurred. - * - * \return Mask comprising of \c PIPE_ERRORFLAG_* bits indicating what error has occurred on the selected pipe. - */ - static inline uint8_t Pipe_GetErrorFlags(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetErrorFlags(void) - { - - return (((&AVR32_USBB.uperr0)[USB_Pipe_SelectedPipe] & - (PIPE_ERRORFLAG_CRC16 | PIPE_ERRORFLAG_TIMEOUT | - PIPE_ERRORFLAG_PID | PIPE_ERRORFLAG_DATAPID | - PIPE_ERRORFLAG_DATATGL)) | - (((&AVR32_USBB.upsta0)[USB_Pipe_SelectedPipe] << 8) & - PIPE_ERRORFLAG_OVERFLOW)); - } - - /** Retrieves the number of busy banks in the currently selected pipe, which have been queued for - * transmission via the \ref Pipe_ClearOUT() command, or are awaiting acknowledgement via the - * \ref Pipe_ClearIN() command. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Total number of busy banks in the selected pipe. - */ - static inline uint8_t Pipe_GetBusyBanks(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_GetBusyBanks(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].nbusybk; - } - - /** Determines if the currently selected pipe may be read from (if data is waiting in the pipe - * bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT - * direction). This function will return false if an error has occurred in the pipe, or if the pipe - * is an IN direction and no packet (or an empty packet) has been received, or if the pipe is an OUT - * direction and the pipe bank is full. - * - * \note This function is not valid on CONTROL type pipes. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Boolean \c true if the currently selected pipe may be read from or written to, depending - * on its direction. - */ - static inline bool Pipe_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsReadWriteAllowed(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].rwall; - } - - /** Determines if a packet has been received on the currently selected IN pipe from the attached device. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Boolean \c true if the current pipe has received an IN packet, \c false otherwise. - */ - static inline bool Pipe_IsINReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsINReceived(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].rxini; - } - - /** Determines if the currently selected OUT pipe is ready to send an OUT packet to the attached device. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Boolean \c true if the current pipe is ready for an OUT packet, \c false otherwise. - */ - static inline bool Pipe_IsOUTReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsOUTReady(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].txouti; - } - - /** Determines if no SETUP request is currently being sent to the attached device on the selected - * CONTROL type pipe. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Boolean \c true if the current pipe is ready for a SETUP packet, \c false otherwise. - */ - static inline bool Pipe_IsSETUPSent(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsSETUPSent(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].txstpi; - } - - /** Sends the currently selected CONTROL type pipe's contents to the device as a SETUP packet. - * - * \ingroup Group_PipePacketManagement_UC3 - */ - static inline void Pipe_ClearSETUP(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearSETUP(void) - { - (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].txstpic = true; - (&AVR32_USBB.UPCON0CLR)[USB_Pipe_SelectedPipe].fifoconc = true; - USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Acknowledges the reception of a setup IN request from the attached device on the currently selected - * pipe, freeing the bank ready for the next packet. - * - * \ingroup Group_PipePacketManagement_UC3 - */ - static inline void Pipe_ClearIN(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearIN(void) - { - (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].rxinic = true; - (&AVR32_USBB.UPCON0CLR)[USB_Pipe_SelectedPipe].fifoconc = true; - USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Sends the currently selected pipe's contents to the device as an OUT packet on the selected pipe, freeing - * the bank ready for the next packet. - * - * \ingroup Group_PipePacketManagement_UC3 - */ - static inline void Pipe_ClearOUT(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearOUT(void) - { - (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].txoutic = true; - (&AVR32_USBB.UPCON0CLR)[USB_Pipe_SelectedPipe].fifoconc = true; - USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Determines if the device sent a NAK (Negative Acknowledge) in response to the last sent packet on - * the currently selected pipe. This occurs when the host sends a packet to the device, but the device - * is not currently ready to handle the packet (i.e. its endpoint banks are full). Once a NAK has been - * received, it must be cleared using \ref Pipe_ClearNAKReceived() before the previous (or any other) packet - * can be re-sent. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Boolean \c true if an NAK has been received on the current pipe, \c false otherwise. - */ - static inline bool Pipe_IsNAKReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsNAKReceived(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].nakedi; - } - - /** Clears the NAK condition on the currently selected pipe. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \see \ref Pipe_IsNAKReceived() for more details. - */ - static inline void Pipe_ClearNAKReceived(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearNAKReceived(void) - { - (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].nakedic = true; - } - - /** Determines if the currently selected pipe has had the STALL condition set by the attached device. - * - * \ingroup Group_PipePacketManagement_UC3 - * - * \return Boolean \c true if the current pipe has been stalled by the attached device, \c false otherwise. - */ - static inline bool Pipe_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Pipe_IsStalled(void) - { - return (&AVR32_USBB.UPSTA0)[USB_Pipe_SelectedPipe].rxstalldi; - } - - /** Clears the STALL condition detection flag on the currently selected pipe, but does not clear the - * STALL condition itself (this must be done via a ClearFeature control request to the device). - * - * \ingroup Group_PipePacketManagement_UC3 - */ - static inline void Pipe_ClearStall(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_ClearStall(void) - { - (&AVR32_USBB.UPSTA0CLR)[USB_Pipe_SelectedPipe].rxstalldic = true; - USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe] = &AVR32_USBB_SLAVE[USB_Pipe_SelectedPipe * PIPE_HSB_ADDRESS_SPACE_SIZE]; - } - - /** Reads one byte from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \return Next byte in the currently selected pipe's FIFO buffer. - */ - static inline uint8_t Pipe_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_Read_8(void) - { - return *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - } - - /** Writes one byte to the currently selected pipe's bank, for IN direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \param[in] Data Data to write into the the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_8(const uint8_t Data) - { - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = Data; - } - - /** Discards one byte from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - */ - static inline void Pipe_Discard_8(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Discard_8(void) - { - uint8_t Dummy; - - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - (void)Dummy; - } - - /** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \return Next two bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint16_t Pipe_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Pipe_Read_16_LE(void) - { - uint16_t Byte0 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint16_t Byte1 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - return ((Byte1 << 8) | Byte0); - } - - /** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \return Next two bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint16_t Pipe_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Pipe_Read_16_BE(void) - { - uint16_t Byte0 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint16_t Byte1 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - return ((Byte0 << 8) | Byte1); - } - - /** Writes two bytes to the currently selected pipe's bank in little endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_16_LE(const uint16_t Data) - { - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8); - } - - /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_16_BE(const uint16_t Data) - { - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF); - } - - /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - */ - static inline void Pipe_Discard_16(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Discard_16(void) - { - uint8_t Dummy; - - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - (void)Dummy; - } - - /** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \return Next four bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint32_t Pipe_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Pipe_Read_32_LE(void) - { - uint32_t Byte0 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint32_t Byte1 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint32_t Byte2 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint32_t Byte3 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0); - } - - /** Reads four bytes from the currently selected pipe's bank in big endian format, for OUT - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \return Next four bytes in the currently selected pipe's FIFO buffer. - */ - static inline uint32_t Pipe_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Pipe_Read_32_BE(void) - { - uint32_t Byte0 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint32_t Byte1 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint32_t Byte2 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - uint32_t Byte3 = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - return ((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3); - } - - /** Writes four bytes to the currently selected pipe's bank in little endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_32_LE(const uint32_t Data) - { - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 16); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 24); - } - - /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN - * direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - * - * \param[in] Data Data to write to the currently selected pipe's FIFO buffer. - */ - static inline void Pipe_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Pipe_Write_32_BE(const uint32_t Data) - { - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 24); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 16); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data >> 8); - *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++) = (Data & 0xFF); - } - - /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. - * - * \ingroup Group_PipePrimitiveRW_UC3 - */ - static inline void Pipe_Discard_32(void) ATTR_ALWAYS_INLINE; - static inline void Pipe_Discard_32(void) - { - uint8_t Dummy; - - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - Dummy = *(USB_Pipe_FIFOPos[USB_Pipe_SelectedPipe]++); - - (void)Dummy; - } - - /* External Variables: */ - /** Global indicating the maximum packet size of the default control pipe located at address - * 0 in the device. This value is set to the value indicated in the attached device's device - * descriptor once the USB interface is initialized into host mode and a device is attached - * to the USB bus. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - extern uint8_t USB_Host_ControlPipeSize; - - /* Function Prototypes: */ - /** Configures a table of pipe descriptions, in sequence. This function can be used to configure multiple - * pipes at the same time. - * - * \note Pipe with a zero address will be ignored, thus this function cannot be used to configure the - * control pipe. - * - * \param[in] Table Pointer to a table of pipe descriptions. - * \param[in] Entries Number of entries in the pipe table to configure. - * - * \return Boolean \c true if all pipes configured successfully, \c false otherwise. - */ - bool Pipe_ConfigurePipeTable(const USB_Pipe_Table_t* const Table, - const uint8_t Entries); - - /** Configures the specified pipe address with the given pipe type, endpoint address within the attached device, bank size - * and number of hardware banks. - * - * A newly configured pipe is frozen by default, and must be unfrozen before use via the \ref Pipe_Unfreeze() - * before being used. Pipes should be kept frozen unless waiting for data from a device while in IN mode, or - * sending data to the device in OUT mode. IN type pipes are also automatically configured to accept infinite - * numbers of IN requests without automatic freezing - this can be overridden by a call to - * \ref Pipe_SetFiniteINRequests(). - * - * \param[in] Address Pipe address to configure. - * - * \param[in] Type Type of pipe to configure, an \c EP_TYPE_* mask. Not all pipe types are available on Low - * Speed USB devices - refer to the USB 2.0 specification. - * - * \param[in] EndpointAddress Endpoint address within the attached device that the pipe should interface to. - * - * \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to - * the USB device, or after they have been received from the USB device (depending on - * the pipe's data direction). The bank size must indicate the maximum packet size that - * the pipe can handle. - * - * \param[in] Banks Number of banks to use for the pipe being configured. - * - * \note When the \c ORDERED_EP_CONFIG compile time option is used, Pipes must be configured in ascending order, - * or bank corruption will occur. - * \n\n - * - * \note Certain microcontroller model's pipes may have different maximum packet sizes based on the pipe's - * index - refer to the chosen microcontroller's datasheet to determine the maximum bank size for each pipe. - * \n\n - * - * \note The default control pipe should not be manually configured by the user application, as it is - * automatically configured by the library internally. - * \n\n - * - * \note This routine will automatically select the specified pipe upon success. Upon failure, the pipe which - * failed to reconfigure correctly will be selected. - * - * \return Boolean \c true if the configuration succeeded, \c false otherwise. - */ - bool Pipe_ConfigurePipe(const uint8_t Address, - const uint8_t Type, - const uint8_t EndpointAddress, - const uint16_t Size, - const uint8_t Banks); - - /** Spin-loops until the currently selected non-control pipe is ready for the next packet of data to be read - * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect). - * - * \ingroup Group_PipeRW_UC3 - * - * \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t Pipe_WaitUntilReady(void); - - /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given - * endpoint is found, it is automatically selected. - * - * \param[in] EndpointAddress Address and direction mask of the endpoint within the attached device to check. - * - * \return Boolean \c true if a pipe bound to the given endpoint address of the specified direction is found, - * \c false otherwise. - */ - bool Pipe_IsEndpointBound(const uint8_t EndpointAddress) ATTR_WARN_UNUSED_RESULT; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #if !defined(ENDPOINT_CONTROLEP) - #define ENDPOINT_CONTROLEP 0 - #endif - - /* Inline Functions: */ - static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) - { - uint8_t MaskVal = 0; - uint16_t CheckBytes = 8; - - while ((CheckBytes < Bytes) && (CheckBytes < PIPE_MAX_SIZE)) - { - MaskVal++; - CheckBytes <<= 1; - } - - return (MaskVal << AVR32_USBB_PSIZE_OFFSET); - } - - /* Function Prototypes: */ - void Pipe_ClearPipes(void); - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c deleted file mode 100644 index ab69536b06..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (void* const Buffer, - uint16_t Length) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - - if (!(Length)) - Endpoint_ClearOUT(); - - while (Length) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - else if (Endpoint_IsSETUPReceived()) - return ENDPOINT_RWCSTREAM_HostAborted; - - if (Endpoint_IsOUTReceived()) - { - while (Length && Endpoint_BytesInEndpoint()) - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - } - - Endpoint_ClearOUT(); - } - } - - while (!(Endpoint_IsINReady())) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - } - - return ENDPOINT_RWCSTREAM_NoError; -} - -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c deleted file mode 100644 index c2d171db06..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, - uint16_t Length) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - bool LastPacketFull = false; - - if (Length > USB_ControlRequest.wLength) - Length = USB_ControlRequest.wLength; - else if (!(Length)) - Endpoint_ClearIN(); - - while (Length || LastPacketFull) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - else if (Endpoint_IsSETUPReceived()) - return ENDPOINT_RWCSTREAM_HostAborted; - else if (Endpoint_IsOUTReceived()) - break; - - if (Endpoint_IsINReady()) - { - uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); - - while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInEndpoint++; - } - - LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); - Endpoint_ClearIN(); - } - } - - while (!(Endpoint_IsOUTReceived())) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - } - - return ENDPOINT_RWCSTREAM_NoError; -} - -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c deleted file mode 100644 index 02ad97867e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - uint16_t BytesInTransfer = 0; - uint8_t ErrorCode; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - { - Length -= *BytesProcessed; - TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); - } - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - TEMPLATE_CLEAR_ENDPOINT(); - - #if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); - #endif - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_BUFFER_TYPE -#undef TEMPLATE_TRANSFER_BYTE -#undef TEMPLATE_CLEAR_ENDPOINT -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c deleted file mode 100644 index 05846bb614..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - uint16_t BytesInTransfer = 0; - uint8_t ErrorCode; - - Pipe_SetPipeToken(TEMPLATE_TOKEN); - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - { - Length -= *BytesProcessed; - TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); - } - - while (Length) - { - if (!(Pipe_IsReadWriteAllowed())) - { - TEMPLATE_CLEAR_PIPE(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return PIPE_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Pipe_WaitUntilReady())) - return ErrorCode; - } - else - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInTransfer++; - } - } - - return PIPE_RWSTREAM_NoError; -} - -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_BUFFER_TYPE -#undef TEMPLATE_TOKEN -#undef TEMPLATE_TRANSFER_BYTE -#undef TEMPLATE_CLEAR_PIPE -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c deleted file mode 100644 index 8ee63318f5..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#define __INCLUDE_FROM_USB_CONTROLLER_C -#include "../USBController.h" - -#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) -volatile uint8_t USB_CurrentMode = USB_MODE_None; -#endif - -#if !defined(USE_STATIC_OPTIONS) -volatile uint8_t USB_Options; -#endif - -void USB_Init( - #if defined(USB_CAN_BE_BOTH) - const uint8_t Mode - #endif - - #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) - , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void - #endif - - #if !defined(USE_STATIC_OPTIONS) - const uint8_t Options - #endif - ) -{ - #if !defined(USE_STATIC_OPTIONS) - USB_Options = Options; - #endif - - #if defined(USB_CAN_BE_BOTH) - if (Mode == USB_MODE_UID) - { - AVR32_USBB.USBCON.uide = true; - USB_INT_Enable(USB_INT_IDTI); - USB_CurrentMode = USB_GetUSBModeFromUID(); - } - else - { - AVR32_USBB.USBCON.uide = false; - USB_CurrentMode = Mode; - } - #else - AVR32_USBB.USBCON.uide = false; - #endif - - USB_IsInitialized = true; - - USB_ResetInterface(); -} - -void USB_Disable(void) -{ - USB_INT_DisableAllInterrupts(); - USB_INT_ClearAllInterrupts(); - - USB_Detach(); - USB_Controller_Disable(); - - USB_OTGPAD_Off(); - - #if defined(USB_CAN_BE_BOTH) - USB_CurrentMode = USB_MODE_None; - #endif - - AVR32_PM.GCCTRL[3].cen = false; - - USB_IsInitialized = false; -} - -void USB_ResetInterface(void) -{ - #if defined(USB_CAN_BE_BOTH) - bool UIDModeSelectEnabled = AVR32_USBB.USBCON.uide; - #endif - - AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC); - AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0); - AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].diven = (F_USB != USB_CLOCK_REQUIRED_FREQ); - AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].div = (F_USB == USB_CLOCK_REQUIRED_FREQ) ? 0 : (uint32_t)((F_USB / USB_CLOCK_REQUIRED_FREQ / 2) - 1); - AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].cen = true; - - USB_INT_DisableAllInterrupts(); - USB_INT_ClearAllInterrupts(); - - USB_Controller_Reset(); - - #if defined(USB_CAN_BE_BOTH) - if (UIDModeSelectEnabled) - USB_INT_Enable(USB_INT_IDTI); - #endif - - USB_CLK_Unfreeze(); - - if (USB_CurrentMode == USB_MODE_Device) - { - #if defined(USB_CAN_BE_DEVICE) - AVR32_USBB.USBCON.uimod = true; - - USB_Init_Device(); - #endif - } - else if (USB_CurrentMode == USB_MODE_Host) - { - #if defined(INVERTED_VBUS_ENABLE_LINE) - AVR32_USBB.USBCON.vbuspo = true; - #endif - - #if defined(USB_CAN_BE_HOST) - AVR32_USBB.USBCON.uimod = false; - - USB_Init_Host(); - #endif - } - - USB_OTGPAD_On(); -} - -#if defined(USB_CAN_BE_DEVICE) -static void USB_Init_Device(void) -{ - USB_DeviceState = DEVICE_STATE_Unattached; - USB_Device_ConfigurationNumber = 0; - - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - USB_Device_RemoteWakeupEnabled = false; - #endif - - #if !defined(NO_DEVICE_SELF_POWER) - USB_Device_CurrentlySelfPowered = false; - #endif - - #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) - USB_Descriptor_Device_t* DeviceDescriptorPtr; - - if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) - USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; - #endif - - if (USB_Options & USB_DEVICE_OPT_LOWSPEED) - { - USB_Device_SetLowSpeed(); - } - else - { - #if defined(USB_DEVICE_OPT_HIGHSPEED) - if (USB_Options & USB_DEVICE_OPT_HIGHSPEED) - USB_Device_SetHighSpeed(); - else - USB_Device_SetFullSpeed(); - #else - USB_Device_SetFullSpeed(); - #endif - } - - USB_INT_Enable(USB_INT_VBUSTI); - - Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - USB_Device_ControlEndpointSize, 1); - - USB_INT_Clear(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_EORSTI); - - USB_Attach(); -} -#endif - -#if defined(USB_CAN_BE_HOST) -static void USB_Init_Host(void) -{ - USB_HostState = HOST_STATE_Unattached; - USB_Host_ConfigurationNumber = 0; - USB_Host_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; - - USB_Host_HostMode_On(); - - USB_Host_VBUS_Auto_On(); - - USB_INT_Enable(USB_INT_DCONNI); - USB_INT_Enable(USB_INT_BCERRI); - - USB_Attach(); -} -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h deleted file mode 100644 index bcae49bd46..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Controller definitions for the AVR32 UC3 microcontrollers. - * \copydetails Group_USBManagement_UC3 - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USBManagement - * \defgroup Group_USBManagement_UC3 USB Interface Management (UC3) - * \brief USB Controller definitions for the AVR32 UC3 microcontrollers. - * - * Functions, macros, variables, enums and types related to the setup and management of the USB interface. - * - * @{ - */ - -#ifndef __USBCONTROLLER_UC3_H__ -#define __USBCONTROLLER_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../Events.h" - #include "../USBTask.h" - #include "../USBInterrupt.h" - - #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__) - #include "../Host.h" - #include "../OTG.h" - #include "../Pipe.h" - #include "../HostStandardReq.h" - #include "../PipeStream.h" - #endif - - #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) - #include "../Device.h" - #include "../Endpoint.h" - #include "../DeviceStandardReq.h" - #include "../EndpointStream.h" - #endif - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks and Defines: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - #if !defined(F_USB) - #error F_USB is not defined. You must define F_USB to the frequency of the clock input to the USB module. - #endif - - #if (defined(USB_SERIES_UC3A3_AVR) || defined(USB_SERIES_UC3A4_AVR)) - #if ((F_USB < 12000000) || (F_USB % 12000000)) - #error Invalid F_USB specified. F_USB must be a multiple of 12MHz for UC3A3 and UC3A4 devices. - #endif - #else - #if ((F_USB < 48000000) || (F_USB % 48000000)) - #error Invalid F_USB specified. F_USB must be a multiple of 48MHz for UC3A and UC3B devices. - #endif - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name USB Controller Option Masks */ - //@{ - /** Selects one of the system's main clock oscillators as the input clock to the USB Generic Clock source - * generation module. This indicates that an external oscillator should be used directly instead of an - * internal PLL clock source. - */ - #define USB_OPT_GCLK_SRC_OSC (1 << 2) - - /** Selects one of the system's PLL oscillators as the input clock to the USB Generic Clock source - * generation module. This indicates that one of the device's PLL outputs should be used instead of an - * external oscillator source. - */ - #define USB_OPT_GCLK_SRC_PLL (0 << 2) - - /** Selects PLL or External Oscillator 0 as the USB Generic Clock source module input clock. */ - #define USB_OPT_GCLK_CHANNEL_0 (1 << 3) - - /** Selects PLL or External Oscillator 1 as the USB Generic Clock source module input clock. */ - #define USB_OPT_GCLK_CHANNEL_1 (0 << 3) - //@} - - #if !defined(USB_STREAM_TIMEOUT_MS) || defined(__DOXYGEN__) - /** Constant for the maximum software timeout period of the USB data stream transfer functions - * (both control and standard) when in either device or host mode. If the next packet of a stream - * is not received or acknowledged within this time period, the stream function will fail. - * - * This value may be overridden in the user project makefile as the value of the - * \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch. - */ - #define USB_STREAM_TIMEOUT_MS 100 - #endif - - /* Inline Functions: */ - /** Determines if the VBUS line is currently high (i.e. the USB host is supplying power). - * - * \return Boolean \c true if the VBUS line is currently detecting power from a host, \c false otherwise. - */ - static inline bool USB_VBUS_GetStatus(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool USB_VBUS_GetStatus(void) - { - return AVR32_USBB.USBSTA.vbus; - } - - /** Detaches the device from the USB bus. This has the effect of removing the device from any - * attached host, ceasing USB communications. If no host is present, this prevents any host from - * enumerating the device once attached until \ref USB_Attach() is called. - */ - static inline void USB_Detach(void) ATTR_ALWAYS_INLINE; - static inline void USB_Detach(void) - { - AVR32_USBB.UDCON.detach = true; - } - - /** Attaches the device to the USB bus. This announces the device's presence to any attached - * USB host, starting the enumeration process. If no host is present, attaching the device - * will allow for enumeration once a host is connected to the device. - * - * This is inexplicably also required for proper operation while in host mode, to enable the - * attachment of a device to the host. This is despite the bit being located in the device-mode - * register and despite the datasheet making no mention of its requirement in host mode. - */ - static inline void USB_Attach(void) ATTR_ALWAYS_INLINE; - static inline void USB_Attach(void) - { - AVR32_USBB.UDCON.detach = false; - } - - /* Function Prototypes: */ - /** Main function to initialize and start the USB interface. Once active, the USB interface will - * allow for device connection to a host when in device mode, or for device enumeration while in - * host mode. - * - * As the USB library relies on interrupts for the device and host mode enumeration processes, - * the user must enable global interrupts before or shortly after this function is called. In - * device mode, interrupts must be enabled within 500ms of this function being called to ensure - * that the host does not time out whilst enumerating the device. In host mode, interrupts may be - * enabled at the application's leisure however enumeration will not begin of an attached device - * until after this has occurred. - * - * Calling this function when the USB interface is already initialized will cause a complete USB - * interface reset and re-enumeration. - * - * \param[in] Mode This is a mask indicating what mode the USB interface is to be initialized to, a value - * from the \ref USB_Modes_t enum. - * - * \param[in] Options Mask indicating the options which should be used when initializing the USB - * interface to control the USB interface's behavior. This should be comprised of - * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the - * PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device - * mode speed. - * - * \note To reduce the FLASH requirements of the library if only device or host mode is required, - * the mode can be statically set in the project makefile by defining the token \c USB_DEVICE_ONLY - * (for device mode) or \c USB_HOST_ONLY (for host mode), passing the token to the compiler - * via the -D switch. If the mode is statically set, this parameter does not exist in the - * function prototype. - * \n\n - * - * \note To reduce the FLASH requirements of the library if only fixed settings are required, - * the options may be set statically in the same manner as the mode (see the Mode parameter of - * this function). To statically set the USB options, pass in the \c USE_STATIC_OPTIONS token, - * defined to the appropriate options masks. When the options are statically set, this - * parameter does not exist in the function prototype. - * - * \see \ref Group_Device for the \c USB_DEVICE_OPT_* masks. - */ - void USB_Init( - #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) - const uint8_t Mode - #endif - - #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) || defined(__DOXYGEN__) - , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void - #endif - - #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) - const uint8_t Options - #endif - ); - - /** Shuts down the USB interface. This turns off the USB interface after deallocating all USB FIFO - * memory, endpoints and pipes. When turned off, no USB functionality can be used until the interface - * is restarted with the \ref USB_Init() function. - */ - void USB_Disable(void); - - /** Resets the interface, when already initialized. This will re-enumerate the device if already connected - * to a host, or re-enumerate an already attached device when in host mode. - */ - void USB_ResetInterface(void); - - /* Global Variables: */ - #if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) || defined(__DOXYGEN__) - /** Indicates the mode that the USB interface is currently initialized to, a value from the - * \ref USB_Modes_t enum. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \note When the controller is initialized into UID auto-detection mode, this variable will hold the - * currently selected USB mode (i.e. \ref USB_MODE_Device or \ref USB_MODE_Host). If the controller - * is fixed into a specific mode (either through the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY compile time - * options, or a limitation of the USB controller in the chosen device model) this will evaluate to - * a constant of the appropriate value and will never evaluate to \ref USB_MODE_None even when the - * USB interface is not initialized. - */ - extern volatile uint8_t USB_CurrentMode; - #elif defined(USB_HOST_ONLY) - #define USB_CurrentMode USB_MODE_Host - #elif defined(USB_DEVICE_ONLY) - #define USB_CurrentMode USB_MODE_Device - #endif - - #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) - /** Indicates the current USB options that the USB interface was initialized with when \ref USB_Init() - * was called. This value will be one of the \c USB_MODE_* masks defined elsewhere in this module. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - extern volatile uint8_t USB_Options; - #elif defined(USE_STATIC_OPTIONS) - #define USB_Options USE_STATIC_OPTIONS - #endif - - /* Enums: */ - /** Enum for the possible USB controller modes, for initialization via \ref USB_Init() and indication back to the - * user application via \ref USB_CurrentMode. - */ - enum USB_Modes_t - { - USB_MODE_None = 0, /**< Indicates that the controller is currently not initialized in any specific USB mode. */ - USB_MODE_Device = 1, /**< Indicates that the controller is currently initialized in USB Device mode. */ - USB_MODE_Host = 2, /**< Indicates that the controller is currently initialized in USB Host mode. */ - USB_MODE_UID = 3, /**< Indicates that the controller should determine the USB mode from the UID pin of the - * USB connector. - */ - }; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Macros: */ - #if defined(USB_SERIES_UC3A3_AVR32) || defined(USB_SERIES_UC3A4_AVR32) - #define USB_CLOCK_REQUIRED_FREQ 12000000UL - #else - #define USB_CLOCK_REQUIRED_FREQ 48000000UL - #endif - - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_USB_CONTROLLER_C) - #if defined(USB_CAN_BE_DEVICE) - static void USB_Init_Device(void); - #endif - - #if defined(USB_CAN_BE_HOST) - static void USB_Init_Host(void); - #endif - #endif - - /* Inline Functions: */ - static inline void USB_OTGPAD_On(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTGPAD_On(void) - { - AVR32_USBB.USBCON.otgpade = true; - } - - static inline void USB_OTGPAD_Off(void) ATTR_ALWAYS_INLINE; - static inline void USB_OTGPAD_Off(void) - { - AVR32_USBB.USBCON.otgpade = false; - } - - static inline void USB_CLK_Freeze(void) ATTR_ALWAYS_INLINE; - static inline void USB_CLK_Freeze(void) - { - AVR32_USBB.USBCON.frzclk = true; - } - - static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE; - static inline void USB_CLK_Unfreeze(void) - { - AVR32_USBB.USBCON.frzclk = false; - } - - static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Enable(void) - { - AVR32_USBB.USBCON.usbe = true; - } - - static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Disable(void) - { - AVR32_USBB.USBCON.usbe = false; - } - - static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Reset(void) - { - AVR32_USBB.USBCON.usbe = false; - AVR32_USBB.USBCON.usbe = true; - } - - #if defined(USB_CAN_BE_BOTH) - static inline uint8_t USB_GetUSBModeFromUID(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t USB_GetUSBModeFromUID(void) - { - if (AVR32_USBB.USBSTA.id) - return USB_MODE_Device; - else - return USB_MODE_Host; - } - #endif - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c deleted file mode 100644 index e11a4b642c..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBInterrupt.h" - -void USB_INT_DisableAllInterrupts(void) -{ - AVR32_USBB.USBCON.vbuste = false; - AVR32_USBB.USBCON.idte = false; - - AVR32_USBB.uhinteclr = -1; - AVR32_USBB.udinteclr = -1; -} - -void USB_INT_ClearAllInterrupts(void) -{ - AVR32_USBB.USBSTACLR.vbustic = true; - AVR32_USBB.USBSTACLR.idtic = true; - - AVR32_USBB.uhintclr = -1; - AVR32_USBB.udintclr = -1; -} - -ISR(USB_GEN_vect) -{ - #if defined(USB_CAN_BE_DEVICE) - #if !defined(NO_SOF_EVENTS) - if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) - { - USB_INT_Clear(USB_INT_SOFI); - - EVENT_USB_Device_StartOfFrame(); - } - #endif - - if (USB_INT_HasOccurred(USB_INT_VBUSTI) && USB_INT_IsEnabled(USB_INT_VBUSTI)) - { - USB_INT_Clear(USB_INT_VBUSTI); - - if (USB_VBUS_GetStatus()) - { - USB_DeviceState = DEVICE_STATE_Powered; - EVENT_USB_Device_Connect(); - } - else - { - USB_DeviceState = DEVICE_STATE_Unattached; - EVENT_USB_Device_Disconnect(); - } - } - - if (USB_INT_HasOccurred(USB_INT_SUSPI) && USB_INT_IsEnabled(USB_INT_SUSPI)) - { - USB_INT_Disable(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_WAKEUPI); - - USB_CLK_Freeze(); - - USB_DeviceState = DEVICE_STATE_Suspended; - EVENT_USB_Device_Suspend(); - } - - if (USB_INT_HasOccurred(USB_INT_WAKEUPI) && USB_INT_IsEnabled(USB_INT_WAKEUPI)) - { - USB_CLK_Unfreeze(); - - USB_INT_Clear(USB_INT_WAKEUPI); - - USB_INT_Disable(USB_INT_WAKEUPI); - USB_INT_Enable(USB_INT_SUSPI); - - if (USB_Device_ConfigurationNumber) - USB_DeviceState = DEVICE_STATE_Configured; - else - USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; - - EVENT_USB_Device_WakeUp(); - } - - if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI)) - { - USB_INT_Clear(USB_INT_EORSTI); - - USB_DeviceState = DEVICE_STATE_Default; - USB_Device_ConfigurationNumber = 0; - - USB_INT_Clear(USB_INT_SUSPI); - USB_INT_Disable(USB_INT_SUSPI); - USB_INT_Enable(USB_INT_WAKEUPI); - - USB_Device_SetDeviceAddress(0); - Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - USB_Device_ControlEndpointSize, 1); - - #if defined(INTERRUPT_CONTROL_ENDPOINT) - USB_INT_Enable(USB_INT_RXSTPI); - #endif - - EVENT_USB_Device_Reset(); - } - #endif - - #if defined(USB_CAN_BE_HOST) - #if !defined(NO_SOF_EVENTS) - if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI)) - { - USB_INT_Clear(USB_INT_HSOFI); - - EVENT_USB_Host_StartOfFrame(); - } - #endif - - if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI)) - { - USB_INT_Clear(USB_INT_DDISCI); - USB_INT_Clear(USB_INT_DCONNI); - USB_INT_Disable(USB_INT_DDISCI); - - EVENT_USB_Host_DeviceUnattached(); - - USB_ResetInterface(); - } - - if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI)) - { - USB_INT_Clear(USB_INT_VBERRI); - - USB_Host_VBUS_Manual_Off(); - USB_Host_VBUS_Auto_Off(); - - EVENT_USB_Host_HostError(HOST_ERROR_VBusVoltageDip); - EVENT_USB_Host_DeviceUnattached(); - - USB_HostState = HOST_STATE_Unattached; - } - - if (USB_INT_HasOccurred(USB_INT_DCONNI) && USB_INT_IsEnabled(USB_INT_DCONNI)) - { - USB_INT_Clear(USB_INT_DCONNI); - USB_INT_Disable(USB_INT_DCONNI); - - EVENT_USB_Host_DeviceAttached(); - - USB_INT_Enable(USB_INT_DDISCI); - - USB_HostState = HOST_STATE_Powered; - } - - if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI)) - { - USB_INT_Clear(USB_INT_BCERRI); - - EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0); - EVENT_USB_Host_DeviceUnattached(); - - USB_ResetInterface(); - } - #endif - - #if defined(USB_CAN_BE_BOTH) - if (USB_INT_HasOccurred(USB_INT_IDTI) && USB_INT_IsEnabled(USB_INT_IDTI)) - { - USB_INT_Clear(USB_INT_IDTI); - - if (USB_DeviceState != DEVICE_STATE_Unattached) - EVENT_USB_Device_Disconnect(); - - if (USB_HostState != HOST_STATE_Unattached) - EVENT_USB_Host_DeviceUnattached(); - - USB_CurrentMode = USB_GetUSBModeFromUID(); - USB_ResetInterface(); - - EVENT_USB_UIDChange(); - } - #endif -} - -#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE) -ISR(USB_COM_vect) -{ - uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint(); - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - USB_INT_Disable(USB_INT_RXSTPI); - - GlobalInterruptEnable(); - - USB_Device_ProcessControlRequest(); - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - USB_INT_Enable(USB_INT_RXSTPI); - Endpoint_SelectEndpoint(PrevSelectedEndpoint); -} -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h deleted file mode 100644 index 625e3f7824..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h +++ /dev/null @@ -1,370 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Controller Interrupt definitions for the AVR32 UC3 microcontrollers. - * - * This file contains definitions required for the correct handling of low level USB service routine interrupts - * from the USB controller. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __USBINTERRUPT_UC3_H__ -#define __USBINTERRUPT_UC3_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* External Variables: */ - extern volatile uint32_t USB_Endpoint_SelectedEndpoint; - - /* Enums: */ - enum USB_Interrupts_t - { - USB_INT_VBUSTI = 0, - #if (defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)) - USB_INT_IDTI = 1, - #endif - #if (defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)) - USB_INT_WAKEUPI = 2, - USB_INT_SUSPI = 3, - USB_INT_EORSTI = 4, - USB_INT_SOFI = 5, - USB_INT_RXSTPI = 6, - #endif - #if (defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)) - USB_INT_HSOFI = 7, - USB_INT_DCONNI = 8, - USB_INT_DDISCI = 9, - USB_INT_RSTI = 10, - USB_INT_BCERRI = 11, - USB_INT_VBERRI = 12, - #endif - }; - - /* Inline Functions: */ - static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Enable(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_VBUSTI: - AVR32_USBB.USBCON.vbuste = true; - break; - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - AVR32_USBB.USBCON.idte = true; - break; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - AVR32_USBB.UDINTESET.wakeupes = true; - break; - case USB_INT_SUSPI: - AVR32_USBB.UDINTESET.suspes = true; - break; - case USB_INT_EORSTI: - AVR32_USBB.UDINTESET.eorstes = true; - break; - case USB_INT_SOFI: - AVR32_USBB.UDINTESET.sofes = true; - break; - case USB_INT_RXSTPI: - (&AVR32_USBB.UECON0SET)[USB_Endpoint_SelectedEndpoint].rxstpes = true; - break; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - AVR32_USBB.UHINTESET.hsofies = true; - break; - case USB_INT_DCONNI: - AVR32_USBB.UHINTESET.dconnies = true; - break; - case USB_INT_DDISCI: - AVR32_USBB.UHINTESET.ddiscies = true; - break; - case USB_INT_RSTI: - AVR32_USBB.UHINTESET.rsties = true; - break; - case USB_INT_BCERRI: - AVR32_USBB.USBCON.bcerre = true; - break; - case USB_INT_VBERRI: - AVR32_USBB.USBCON.vberre = true; - break; - #endif - } - } - - static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Disable(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_VBUSTI: - AVR32_USBB.USBCON.vbuste = false; - break; - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - AVR32_USBB.USBCON.idte = false; - break; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - AVR32_USBB.UDINTECLR.wakeupec = true; - break; - case USB_INT_SUSPI: - AVR32_USBB.UDINTECLR.suspec = true; - break; - case USB_INT_EORSTI: - AVR32_USBB.UDINTECLR.eorstec = true; - break; - case USB_INT_SOFI: - AVR32_USBB.UDINTECLR.sofec = true; - break; - case USB_INT_RXSTPI: - (&AVR32_USBB.UECON0CLR)[USB_Endpoint_SelectedEndpoint].rxstpec = true; - break; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - AVR32_USBB.UHINTECLR.hsofiec = true; - break; - case USB_INT_DCONNI: - AVR32_USBB.UHINTECLR.dconniec = true; - break; - case USB_INT_DDISCI: - AVR32_USBB.UHINTECLR.ddisciec = true; - break; - case USB_INT_RSTI: - AVR32_USBB.UHINTECLR.rstiec = true; - break; - case USB_INT_BCERRI: - AVR32_USBB.USBCON.bcerre = false; - break; - case USB_INT_VBERRI: - AVR32_USBB.USBCON.vberre = false; - break; - #endif - } - } - - static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Clear(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_VBUSTI: - AVR32_USBB.USBSTACLR.vbustic = true; - (void)AVR32_USBB.USBSTACLR; - break; - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - AVR32_USBB.USBSTACLR.idtic = true; - (void)AVR32_USBB.USBSTACLR; - break; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - AVR32_USBB.UDINTCLR.wakeupc = true; - (void)AVR32_USBB.UDINTCLR; - break; - case USB_INT_SUSPI: - AVR32_USBB.UDINTCLR.suspc = true; - (void)AVR32_USBB.UDINTCLR; - break; - case USB_INT_EORSTI: - AVR32_USBB.UDINTCLR.eorstc = true; - (void)AVR32_USBB.UDINTCLR; - break; - case USB_INT_SOFI: - AVR32_USBB.UDINTCLR.sofc = true; - (void)AVR32_USBB.UDINTCLR; - break; - case USB_INT_RXSTPI: - (&AVR32_USBB.UESTA0CLR)[USB_Endpoint_SelectedEndpoint].rxstpic = true; - break; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - AVR32_USBB.UHINTCLR.hsofic = true; - (void)AVR32_USBB.UHINTCLR; - break; - case USB_INT_DCONNI: - AVR32_USBB.UHINTCLR.dconnic = true; - (void)AVR32_USBB.UHINTCLR; - break; - case USB_INT_DDISCI: - AVR32_USBB.UHINTCLR.ddiscic = true; - (void)AVR32_USBB.UHINTCLR; - break; - case USB_INT_RSTI: - AVR32_USBB.UHINTCLR.rstic = true; - (void)AVR32_USBB.UHINTCLR; - break; - case USB_INT_BCERRI: - AVR32_USBB.USBSTACLR.bcerric = true; - (void)AVR32_USBB.USBSTACLR; - break; - case USB_INT_VBERRI: - AVR32_USBB.USBSTACLR.vberric = true; - (void)AVR32_USBB.USBSTACLR; - break; - #endif - } - } - - static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_VBUSTI: - return AVR32_USBB.USBCON.vbuste; - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - return AVR32_USBB.USBCON.idte; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - return AVR32_USBB.UDINTE.wakeupe; - case USB_INT_SUSPI: - return AVR32_USBB.UDINTE.suspe; - case USB_INT_EORSTI: - return AVR32_USBB.UDINTE.eorste; - case USB_INT_SOFI: - return AVR32_USBB.UDINTE.sofe; - case USB_INT_RXSTPI: - return (&AVR32_USBB.UECON0)[USB_Endpoint_SelectedEndpoint].rxstpe; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - return AVR32_USBB.UHINTE.hsofie; - case USB_INT_DCONNI: - return AVR32_USBB.UHINTE.dconnie; - case USB_INT_DDISCI: - return AVR32_USBB.UHINTE.ddiscie; - case USB_INT_RSTI: - return AVR32_USBB.UHINTE.rstie; - case USB_INT_BCERRI: - return AVR32_USBB.USBCON.bcerre; - case USB_INT_VBERRI: - return AVR32_USBB.USBCON.vberre; - #endif - } - - return false; - } - - static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_VBUSTI: - return AVR32_USBB.USBSTA.vbusti; - #if defined(USB_CAN_BE_BOTH) - case USB_INT_IDTI: - return AVR32_USBB.USBSTA.idti; - #endif - #if defined(USB_CAN_BE_DEVICE) - case USB_INT_WAKEUPI: - return AVR32_USBB.UDINT.wakeup; - case USB_INT_SUSPI: - return AVR32_USBB.UDINT.susp; - case USB_INT_EORSTI: - return AVR32_USBB.UDINT.eorst; - case USB_INT_SOFI: - return AVR32_USBB.UDINT.sof; - case USB_INT_RXSTPI: - return (&AVR32_USBB.UESTA0)[USB_Endpoint_SelectedEndpoint].rxstpi; - #endif - #if defined(USB_CAN_BE_HOST) - case USB_INT_HSOFI: - return AVR32_USBB.UHINT.hsofi; - case USB_INT_DCONNI: - return AVR32_USBB.UHINT.dconni; - case USB_INT_DDISCI: - return AVR32_USBB.UHINT.ddisci; - case USB_INT_RSTI: - return AVR32_USBB.UHINT.rsti; - case USB_INT_BCERRI: - return AVR32_USBB.USBSTA.bcerri; - case USB_INT_VBERRI: - return AVR32_USBB.USBSTA.vberri; - #endif - } - - return false; - } - - /* Includes: */ - #include "../USBMode.h" - #include "../Events.h" - #include "../USBController.h" - - /* Function Prototypes: */ - void USB_INT_ClearAllInterrupts(void); - void USB_INT_DisableAllInterrupts(void); - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - #if defined(__DOXYGEN__) - /** Interrupt service routine handler for the USB controller ISR group. This interrupt routine must be - * linked to the entire USB controller ISR vector group inside the AVR32's interrupt controller peripheral, - * using the user application's preferred USB controller driver. - */ - void USB_GEN_vect(void); - #else - ISR(USB_GEN_vect); - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h deleted file mode 100644 index 9b1f0a9a60..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Common USB Controller definitions for all architectures. - * \copydetails Group_USBManagement - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_USBManagement USB Interface Management - * \brief USB Controller definitions for general USB controller management. - * - * Functions, macros, variables, enums and types related to the setup and management of the USB interface. - * - * @{ - */ - -#ifndef __USBCONTROLLER_H__ -#define __USBCONTROLLER_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks and Defines: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Defines: */ - /** \name Endpoint Direction Masks */ - //@{ - /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's - * direction for comparing with the \c ENDPOINT_DIR_* masks. - */ - #define ENDPOINT_DIR_MASK 0x80 - - /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with - * the index of the address within a device to obtain the full endpoint address. - */ - #define ENDPOINT_DIR_OUT 0x00 - - /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with - * the index of the address within a device to obtain the full endpoint address. - */ - #define ENDPOINT_DIR_IN 0x80 - //@} - - /** \name Pipe Direction Masks */ - //@{ - /** Pipe direction mask, for masking against pipe addresses to retrieve the pipe's - * direction for comparing with the \c PIPE_DIR_* masks. - */ - #define PIPE_DIR_MASK 0x80 - - /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with - * the index of the address within a device to obtain the full endpoint address. - */ - #define PIPE_DIR_OUT 0x00 - - /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with - * the index of the address within a device to obtain the full endpoint address. - */ - #define PIPE_DIR_IN 0x80 - //@} - - /** \name Endpoint/Pipe Type Masks */ - //@{ - /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared - * with the \c EP_TYPE_* masks to determine the exact type of the endpoint. - */ - #define EP_TYPE_MASK 0x03 - - /** Mask for a CONTROL type endpoint or pipe. - * - * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. - */ - #define EP_TYPE_CONTROL 0x00 - - /** Mask for an ISOCHRONOUS type endpoint or pipe. - * - * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. - */ - #define EP_TYPE_ISOCHRONOUS 0x01 - - /** Mask for a BULK type endpoint or pipe. - * - * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. - */ - #define EP_TYPE_BULK 0x02 - - /** Mask for an INTERRUPT type endpoint or pipe. - * - * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. - */ - #define EP_TYPE_INTERRUPT 0x03 - //@} - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/USBController_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/USBController_UC3.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/USBController_XMEGA.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h deleted file mode 100644 index 583860262b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB controller interrupt service routine management. - * - * This file contains definitions required for the correct handling of low level USB service routine interrupts - * from the USB controller. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __USBINTERRUPT_H__ -#define __USBINTERRUPT_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Architecture Includes: */ - #if (ARCH == ARCH_AVR8) - #include "AVR8/USBInterrupt_AVR8.h" - #elif (ARCH == ARCH_UC3) - #include "UC3/USBInterrupt_UC3.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/USBInterrupt_XMEGA.h" - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h deleted file mode 100644 index 8a52b092b4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB mode and feature support definitions. - * \copydetails Group_USBMode - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USB - * \defgroup Group_USBMode USB Mode Tokens - * \brief USB mode and feature support definitions. - * - * This file defines macros indicating the type of USB controller the library is being compiled for, and its - * capabilities. These macros may then be referenced in the user application to selectively enable or disable - * code sections depending on if they are defined or not. - * - * After the inclusion of the master USB driver header, one or more of the following tokens may be defined, to - * allow the user code to conditionally enable or disable code based on the USB controller family and allowable - * USB modes. These tokens may be tested against to eliminate code relating to a USB mode which is not enabled for - * the given compilation. - * - * @{ - */ - -#ifndef __USBMODE_H__ -#define __USBMODE_H__ - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - #if defined(__DOXYGEN__) - /** Indicates that the target AVR microcontroller belongs to the Series 2 AVR8 USB controller - * (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined. - */ - #define USB_SERIES_2_AVR - - /** Indicates that the target AVR microcontroller belongs to the Series 4 AVR8 USB controller - * (i.e. ATMEGAxxU4) when defined. - */ - #define USB_SERIES_4_AVR - - /** Indicates that the target AVR microcontroller belongs to the Series 6 AVR8 USB controller - * (i.e. AT90USBxxx6) when defined. - */ - #define USB_SERIES_6_AVR - - /** Indicates that the target AVR microcontroller belongs to the Series 7 AVR8 USB controller - * (i.e. AT90USBxxx7) when defined. - */ - #define USB_SERIES_7_AVR - - /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A0 Series USB controller - * (i.e. AT32UC3A0*) when defined. - */ - #define USB_SERIES_UC3A0_AVR - - /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A1 Series USB controller - * (i.e. AT32UC3A1*) when defined. - */ - #define USB_SERIES_UC3A1_AVR - - /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A3 Series USB controller - * (i.e. AT32UC3A3*) when defined. - */ - #define USB_SERIES_UC3A3_AVR - - /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A4 Series USB controller - * (i.e. AT32UC3A4*) when defined. - */ - #define USB_SERIES_UC3A4_AVR - - /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B0 Series USB controller - * (i.e. AT32UC3B0*) when defined. - */ - #define USB_SERIES_UC3B0_AVR - - /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B1 Series USB controller - * (i.e. AT32UC3B1*) when defined. - */ - #define USB_SERIES_UC3B1_AVR - - /** Indicates that the target AVR microcontroller belongs to the XMEGA A1U Series USB controller - * (i.e. ATXMEGA*A1U) when defined. - */ - #define USB_SERIES_A1U_XMEGA - - /** Indicates that the target AVR microcontroller belongs to the XMEGA A3U Series USB controller - * (i.e. ATXMEGA*A3U) when defined. - */ - #define USB_SERIES_A3U_XMEGA - - /** Indicates that the target AVR microcontroller belongs to the XMEGA A4U Series USB controller - * (i.e. ATXMEGA*A4U) when defined. - */ - #define USB_SERIES_A4U_XMEGA - - /** Indicates that the target AVR microcontroller belongs to the XMEGA B1 Series USB controller - * (i.e. ATXMEGA*B1) when defined. - */ - #define USB_SERIES_B1_XMEGA - - /** Indicates that the target AVR microcontroller belongs to the XMEGA B3 Series USB controller - * (i.e. ATXMEGA*B3) when defined. - */ - #define USB_SERIES_B3_XMEGA - - /** Indicates that the target AVR microcontroller belongs to the XMEGA C3 Series USB controller - * (i.e. ATXMEGA*C3) when defined. - */ - #define USB_SERIES_C3_XMEGA - - /** Indicates that the target AVR microcontroller belongs to the XMEGA C4 Series USB controller - * (i.e. ATXMEGA*C4) when defined. - */ - #define USB_SERIES_C4_XMEGA - - /** Indicates that the target microcontroller and compilation settings allow for the - * target to be configured in USB Device mode when defined. - */ - #define USB_CAN_BE_DEVICE - - /** Indicates that the target microcontroller and compilation settings allow for the - * target to be configured in USB Host mode when defined. - */ - #define USB_CAN_BE_HOST - - /** Indicates that the target microcontroller and compilation settings allow for the - * target to be configured in either USB Device or Host mode when defined. - */ - #define USB_CAN_BE_BOTH - #else - /* Macros: */ - #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \ - defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)) - #define USB_SERIES_2_AVR - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)) - #define USB_SERIES_4_AVR - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) - #define USB_SERIES_6_AVR - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__)) - #define USB_SERIES_7_AVR - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \ - defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__)) - #define USB_SERIES_UC3A0_AVR32 - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR32_UC3A1512__) || defined(__AVR32_UC3A1256__) || \ - defined(__AVR32_UC3A1128__) || defined(__AVR32_UC3A164__)) - #define USB_SERIES_UC3A1_AVR32 - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR32_UC3A3256__) || defined(__AVR32_UC3A3256S__) || \ - defined(__AVR32_UC3A3128__) || defined(__AVR32_UC3A3128S__) || \ - defined(__AVR32_UC3A364__) || defined(__AVR32_UC3A364S__)) - #define USB_SERIES_UC3A3_AVR32 - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR32_UC3A4256__) || defined(__AVR32_UC3A4256S__) || \ - defined(__AVR32_UC3A4128__) || defined(__AVR32_UC3A4128S__) || \ - defined(__AVR32_UC3A464__) || defined(__AVR32_UC3A464S__)) - #define USB_SERIES_UC3A4_AVR32 - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B0256__) || \ - defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B064__)) - #define USB_SERIES_UC3B0_AVR32 - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR32_UC3B1512__) || defined(__AVR32_UC3B1256__) || \ - defined(__AVR32_UC3B1128__) || defined(__AVR32_UC3B164__)) - #define USB_SERIES_UC3B1_AVR32 - #define USB_CAN_BE_DEVICE - #define USB_CAN_BE_HOST - #elif (defined(__AVR_ATxmega128A1U__) || defined(__AVR_ATxmega64A1U__)) - #define USB_SERIES_A1U_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega64A3U__) || defined(__AVR_ATxmega128A3U__) || \ - defined(__AVR_ATxmega192A3U__) || defined(__AVR_ATxmega256A3U__)) - #define USB_SERIES_A3U_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega256A3BU__)) - #define USB_SERIES_A3BU_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega16A4U__) || defined(__AVR_ATxmega32A4U__) || \ - defined(__AVR_ATxmega64A4U__) || defined(__AVR_ATxmega128A4U__)) - #define USB_SERIES_A4U_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega128B1__) || defined(__AVR_ATxmega64B1__)) - #define USB_SERIES_B1_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega128B3__) || defined(__AVR_ATxmega64B3__)) - #define USB_SERIES_B3_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega128C3__) || defined(__AVR_ATxmega64C3__) || \ - defined(__AVR_ATxmega192C3__) || defined(__AVR_ATxmega256C3__) || \ - defined(__AVR_ATxmega384C3__)) - #define USB_SERIES_C3_XMEGA - #define USB_CAN_BE_DEVICE - #elif (defined(__AVR_ATxmega16C4__) || defined(__AVR_ATxmega32C4__)) - #define USB_SERIES_C4_XMEGA - #define USB_CAN_BE_DEVICE - #endif - - #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST)) - #define USB_CAN_BE_BOTH - #endif - - #if defined(USB_HOST_ONLY) - #if !defined(USB_CAN_BE_HOST) - #error USB_HOST_ONLY is not available for the currently selected microcontroller model. - #else - #undef USB_CAN_BE_DEVICE - #undef USB_CAN_BE_BOTH - #endif - #endif - - #if defined(USB_DEVICE_ONLY) - #if !defined(USB_CAN_BE_DEVICE) - #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model. - #else - #undef USB_CAN_BE_HOST - #undef USB_CAN_BE_BOTH - #endif - #endif - - #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY)) - #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive. - #endif - - #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST)) - #error The currently selected device or architecture is not supported under the USB component of the library. - #endif - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c deleted file mode 100644 index e0a99150a4..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USBTASK_C -#define __INCLUDE_FROM_USB_DRIVER -#include "USBTask.h" - -volatile bool USB_IsInitialized; -USB_Request_Header_t USB_ControlRequest; - -#if defined(USB_CAN_BE_HOST) && !defined(HOST_STATE_AS_GPIOR) -volatile uint8_t USB_HostState; -#endif - -#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR) -volatile uint8_t USB_DeviceState; -#endif - -void USB_USBTask(void) -{ - #if defined(USB_HOST_ONLY) - USB_HostTask(); - #elif defined(USB_DEVICE_ONLY) - USB_DeviceTask(); - #else - if (USB_CurrentMode == USB_MODE_Device) - USB_DeviceTask(); - #if defined(USB_CAN_BE_HOST) - else if (USB_CurrentMode == USB_MODE_Host) - USB_HostTask(); - #endif - #endif -} - -#if defined(USB_CAN_BE_DEVICE) -static void USB_DeviceTask(void) -{ - if (USB_DeviceState != DEVICE_STATE_Unattached) - { - uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - - if (Endpoint_IsSETUPReceived()) - USB_Device_ProcessControlRequest(); - - Endpoint_SelectEndpoint(PrevEndpoint); - } -} -#endif - -#if defined(USB_CAN_BE_HOST) -static void USB_HostTask(void) -{ - uint8_t PrevPipe = Pipe_GetCurrentPipe(); - - Pipe_SelectPipe(PIPE_CONTROLPIPE); - - USB_Host_ProcessNextHostState(); - - Pipe_SelectPipe(PrevPipe); -} -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h deleted file mode 100644 index 531fa6dcac..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Main USB service task management. - * - * This file contains the function definitions required for the main USB service task, which must be called - * from the user application to ensure that the USB connection to or from a connected USB device is maintained. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __USBTASK_H__ -#define __USBTASK_H__ - - /* Includes: */ - #include "../../../Common/Common.h" - #include "USBMode.h" - #include "USBController.h" - #include "Events.h" - #include "StdRequestType.h" - #include "StdDescriptors.h" - - #if defined(USB_CAN_BE_DEVICE) - #include "DeviceStandardReq.h" - #endif - - #if defined(USB_CAN_BE_HOST) - #include "HostStandardReq.h" - #endif - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Global Variables: */ - /** Indicates if the USB interface is currently initialized but not necessarily connected to a host - * or device (i.e. if \ref USB_Init() has been run). If this is false, all other library globals related - * to the USB driver are invalid. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \ingroup Group_USBManagement - */ - extern volatile bool USB_IsInitialized; - - /** Structure containing the last received Control request when in Device mode (for use in user-applications - * inside of the \ref EVENT_USB_Device_ControlRequest() event, or for filling up with a control request to - * issue when in Host mode before calling \ref USB_Host_SendControlRequest(). - * - * \note The contents of this structure is automatically endian-corrected for the current CPU architecture. - * - * \ingroup Group_USBManagement - */ - extern USB_Request_Header_t USB_ControlRequest; - - #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__) - #if !defined(HOST_STATE_AS_GPIOR) || defined(__DOXYGEN__) - /** Indicates the current host state machine state. When in host mode, this indicates the state - * via one of the values of the \ref USB_Host_States_t enum values. - * - * This value should not be altered by the user application as it is handled automatically by the - * library. - * - * To reduce program size and speed up checks of this global on the AVR8 architecture, it can be - * placed into one of the AVR's \c GPIOR hardware registers instead of RAM by defining the - * \c HOST_STATE_AS_GPIOR token to a value between 0 and 2 in the project makefile and passing it to - * the compiler via the -D switch. When defined, the corresponding GPIOR register should not be used - * in the user application except implicitly via the library APIs. - * - * \note This global is only present if the user application can be a USB host. - * - * \see \ref USB_Host_States_t for a list of possible device states. - * - * \ingroup Group_Host - */ - extern volatile uint8_t USB_HostState; - #else - #define _GET_HOST_GPIOR_NAME2(y) GPIOR ## y - #define _GET_HOST_GPIOR_NAME(x) _GET_HOST_GPIOR_NAME2(x) - #define USB_HostState _GET_HOST_GPIOR_NAME(HOST_STATE_AS_GPIOR) - #endif - #endif - - #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) - #if !defined(DEVICE_STATE_AS_GPIOR) || defined(__DOXYGEN__) - /** Indicates the current device state machine state. When in device mode, this indicates the state - * via one of the values of the \ref USB_Device_States_t enum values. - * - * This value should not be altered by the user application as it is handled automatically by the - * library. The only exception to this rule is if the NO_LIMITED_CONTROLLER_CONNECT token is used - * (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events). - * - * To reduce program size and speed up checks of this global on the AVR8 architecture, it can be - * placed into one of the AVR's \c GPIOR hardware registers instead of RAM by defining the - * \c DEVICE_STATE_AS_GPIOR token to a value between 0 and 2 in the project makefile and passing it to - * the compiler via the -D switch. When defined, the corresponding GPIOR register should not be used - * in the user application except implicitly via the library APIs. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value except in the circumstances outlined above. - * - * \note This global is only present if the user application can be a USB device. - * \n\n - * - * \see \ref USB_Device_States_t for a list of possible device states. - * - * \ingroup Group_Device - */ - extern volatile uint8_t USB_DeviceState; - #else - #define _GET_DEVICE_GPIOR_NAME2(y) GPIOR ## y - #define _GET_DEVICE_GPIOR_NAME(x) _GET_DEVICE_GPIOR_NAME2(x) - #define USB_DeviceState _GET_DEVICE_GPIOR_NAME(DEVICE_STATE_AS_GPIOR) - #endif - #endif - - /* Function Prototypes: */ - /** This is the main USB management task. The USB driver requires this task to be executed - * continuously when the USB system is active (device attached in host mode, or attached to a host - * in device mode) in order to manage USB communications. This task may be executed inside an RTOS, - * fast timer ISR or the main user application loop. - * - * The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode. - * The task may be serviced at all times, or (for minimum CPU consumption): - * - * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect() - * event and disabled again on the firing of the \ref EVENT_USB_Device_Disconnect() event. - * - * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Host_DeviceAttached() - * event and disabled again on the firing of the \ref EVENT_USB_Host_DeviceEnumerationComplete() or - * \ref EVENT_USB_Host_DeviceEnumerationFailed() events. - * - * If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library - * by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch. - * - * \see \ref Group_Events for more information on the USB events. - * - * \ingroup Group_USBManagement - */ - void USB_USBTask(void); - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_USBTASK_C) - #if defined(USB_CAN_BE_HOST) - static void USB_HostTask(void); - #endif - - #if defined(USB_CAN_BE_DEVICE) - static void USB_DeviceTask(void); - #endif - #endif - - /* Macros: */ - #define HOST_TASK_NONBLOCK_WAIT(Duration, NextState) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \ - WaitMSRemaining = (Duration); \ - PostWaitState = (NextState); }MACROE - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c deleted file mode 100644 index 47c345900d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "../Device.h" - -void USB_Device_SendRemoteWakeup(void) -{ - USB.CTRLB |= USB_RWAKEUP_bm; -} - -#endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h deleted file mode 100644 index aec693a3ce..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Device definitions for the AVR XMEGA microcontrollers. - * \copydetails Group_Device_XMEGA - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_Device - * \defgroup Group_Device_XMEGA Device Management (XMEGA) - * \brief USB Device definitions for the AVR XMEGA microcontrollers. - * - * Architecture specific USB Device definitions for the Atmel AVR XMEGA microcontrollers. - * - * @{ - */ - -#ifndef __USBDEVICE_XMEGA_H__ -#define __USBDEVICE_XMEGA_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBController.h" - #include "../StdDescriptors.h" - #include "../USBInterrupt.h" - #include "../Endpoint.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - #if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) - #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. - #endif - - #if (defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) - #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. - #endif - - #if (defined(USE_FLASH_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)) - #error USE_FLASH_DESCRIPTORS and USE_RAM_DESCRIPTORS are mutually exclusive. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name USB Device Mode Option Masks */ - //@{ - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in low speed (1.5Mb/s) mode. - * - * \note Low Speed mode is not available on all USB AVR models. - * \n - * - * \note Restrictions apply on the number, size and type of endpoints which can be used - * when running in low speed mode - refer to the USB 2.0 specification. - */ - #define USB_DEVICE_OPT_LOWSPEED (1 << 0) - - #if (F_USB > 6000000) - /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the - * USB interface should be initialized in full speed (12Mb/s) mode. - */ - #define USB_DEVICE_OPT_FULLSPEED (0 << 0) - #endif - //@} - - #if (!defined(NO_INTERNAL_SERIAL) || defined(__DOXYGEN__)) - /** String descriptor index for the device's unique serial number string descriptor within the device. - * This unique serial number is used by the host to associate resources to the device (such as drivers or COM port - * number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers contain - * a unique serial number internally, and setting the device descriptors serial number string index to this value - * will cause it to use the internal serial number. - * - * On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR and so will force the host to create a pseudo-serial - * number for the device. - */ - #define USE_INTERNAL_SERIAL 0xDC - - /** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller - * model. - */ - #define INTERNAL_SERIAL_LENGTH_BITS (8 * (1 + (offsetof(NVM_PROD_SIGNATURES_t, COORDY1) - offsetof(NVM_PROD_SIGNATURES_t, LOTNUM0)))) - - /** Start address of the internal serial number, in the appropriate address space, if present on the selected microcontroller - * model. - */ - #define INTERNAL_SERIAL_START_ADDRESS offsetof(NVM_PROD_SIGNATURES_t, LOTNUM0) - #else - #define USE_INTERNAL_SERIAL NO_DESCRIPTOR - - #define INTERNAL_SERIAL_LENGTH_BITS 0 - #define INTERNAL_SERIAL_START_ADDRESS 0 - #endif - - /* Function Prototypes: */ - /** Sends a Remote Wakeup request to the host. This signals to the host that the device should - * be taken out of suspended mode, and communications should resume. - * - * Typically, this is implemented so that HID devices (mice, keyboards, etc.) can wake up the - * host computer when the host has suspended all USB devices to enter a low power state. - * - * \note This function should only be used if the device has indicated to the host that it - * supports the Remote Wakeup feature in the device descriptors, and should only be - * issued if the host is currently allowing remote wakeup events from the device (i.e., - * the \ref USB_Device_RemoteWakeupEnabled flag is set). When the \c NO_DEVICE_REMOTE_WAKEUP - * compile time option is used, this function is unavailable. - * \n\n - * - * \note The USB clock must be running for this function to operate. If the stack is initialized with - * the \ref USB_OPT_MANUAL_PLL option enabled, the user must ensure that the PLL is running - * before attempting to call this function. - * - * \see \ref Group_StdDescriptors for more information on the RMWAKEUP feature and device descriptors. - */ - void USB_Device_SendRemoteWakeup(void); - - /* Inline Functions: */ - /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) - * the frame number is incremented by one. - * - * \return Current USB frame number from the USB controller. - */ - static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline uint16_t USB_Device_GetFrameNumber(void) - { - return ((USB_EndpointTable_t*)USB.EPPTR)->FrameNum; - } - - #if !defined(NO_SOF_EVENTS) - /** Enables the device mode Start Of Frame events. When enabled, this causes the - * \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, - * at the start of each USB frame when enumerated in device mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_EnableSOFEvents(void) - { - USB.INTCTRLA |= USB_SOFIE_bm; - } - - /** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the - * \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode. - * - * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. - */ - static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_DisableSOFEvents(void) - { - USB.INTCTRLA &= ~USB_SOFIE_bm; - } - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Inline Functions: */ - static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetLowSpeed(void) - { - USB.CTRLA &= ~USB_SPEED_bm; - } - - static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetFullSpeed(void) - { - USB.CTRLA |= USB_SPEED_bm; - } - - static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void USB_Device_SetDeviceAddress(const uint8_t Address) - { - USB.ADDR = Address; - } - - static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_Device_IsAddressSet(void) - { - return ((USB.ADDR != 0) ? true : false); - } - - static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) ATTR_NON_NULL_PTR_ARG(1); - static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) - { - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - uint8_t SigReadAddress = INTERNAL_SERIAL_START_ADDRESS; - - for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) - { - uint8_t SerialByte; - - NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; - SerialByte = pgm_read_byte(SigReadAddress); - NVM.CMD = 0; - - if (SerialCharNum & 0x01) - { - SerialByte >>= 4; - SigReadAddress++; - } - - SerialByte &= 0x0F; - - UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? - (('A' - 10) + SerialByte) : ('0' + SerialByte)); - } - - SetGlobalInterruptMask(CurrentGlobalInt); - } - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c deleted file mode 100644 index 0a1a775052..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "EndpointStream_XMEGA.h" - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearOUT(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Discard_8(); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - Endpoint_ClearIN(); - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - Endpoint_Write_8(0); - - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, - * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE -#define TEMPLATE_BUFFER_TYPE const void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE -#define TEMPLATE_BUFFER_TYPE void* -#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_RW.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE - #define TEMPLATE_BUFFER_TYPE const void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE - #define TEMPLATE_BUFFER_TYPE void* - #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_RW.c" -#endif - -#endif - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) -#include "Template/Template_Endpoint_Control_W.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE -#define TEMPLATE_BUFFER_OFFSET(Length) 0 -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE -#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) -#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount -#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() -#include "Template/Template_Endpoint_Control_R.c" - -#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" -#endif - -#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) - #include "Template/Template_Endpoint_Control_W.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE - #define TEMPLATE_BUFFER_OFFSET(Length) 0 - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" - - #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE - #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) - #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount - #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) - #include "Template/Template_Endpoint_Control_R.c" -#endif - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h deleted file mode 100644 index 4d2a9f573d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h +++ /dev/null @@ -1,648 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Endpoint data stream transmission and reception management for the AVR XMEGA microcontrollers. - * \copydetails Group_EndpointStreamRW_XMEGA - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointStreamRW - * \defgroup Group_EndpointStreamRW_XMEGA Read/Write of Multi-Byte Streams (XMEGA) - * \brief Endpoint data stream transmission and reception management for the Atmel AVR XMEGA architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of data streams from - * and to endpoints. - * - * @{ - */ - -#ifndef __ENDPOINT_STREAM_XMEGA_H__ -#define __ENDPOINT_STREAM_XMEGA_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../USBTask.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Function Prototypes: */ - /** \name Stream functions for null data */ - //@{ - - /** Reads and discards the given number of bytes from the currently selected endpoint's bank, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of bytes to discard via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Discard_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending - * full packets to the host as needed. The last packet is not automatically sent once the - * remaining bytes have been written; the user is responsible for manually sending the last - * packet to the host via the \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Length Number of zero bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Null_Stream(uint16_t Length, - uint16_t* const BytesProcessed); - - //@} - - /** \name Stream functions for RAM source/destination data */ - //@{ - - /** Writes the given number of bytes to the endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes full while there is still data to process (and after the current - * packet transmission has been initiated) the BytesProcessed location will be updated with the - * total number of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The last packet filled is not automatically sent; - * the user is responsible for manually sending the last written packet to the host via the - * \ref Endpoint_ClearIN() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, - * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid - * storage location, the transfer will instead be performed as a series of chunks. Each time - * the endpoint bank becomes empty while there is still data to process (and after the current - * packet has been acknowledged) the BytesProcessed location will be updated with the total number - * of bytes processed in the stream, and the function will exit with an error code of - * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed - * in the user code - to continue the transfer, call the function again with identical parameters - * and it will resume until the BytesProcessed value reaches the total transfer length. - * - * Single Stream Transfer Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * - * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * NULL)) != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * Partial Stream Transfers Example: - * \code - * uint8_t DataStream[512]; - * uint8_t ErrorCode; - * uint16_t BytesProcessed; - * - * BytesProcessed = 0; - * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), - * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) - * { - * // Stream not yet complete - do other actions here, abort if required - * } - * - * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) - * { - * // Stream failed to complete - check ErrorCode here - * } - * \endcode - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The last packet is not automatically - * discarded once the remaining bytes has been read; the user is responsible for manually - * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. - * - * \note This routine should not be used on CONTROL type endpoints. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Stream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the status OUT packet - * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, - * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared - * in both failure and success states; the user is responsible for manually clearing the status OUT packet - * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, - * discarding fully read packets from the host as needed. The device IN acknowledgement is not - * automatically sent after success or failure states; the user is responsible for manually sending the - * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for EEPROM source/destination data */ - //@{ - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_LE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). - * - * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be read at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_EStream_BE(void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[out] Buffer Pointer to the destination data buffer to write to. - * \param[in] Length Number of bytes to send via the currently selected endpoint. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /** \name Stream functions for PROGMEM source/destination data */ - //@{ - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current - * transaction should be updated, \c NULL if the entire stream should be written at once. - * - * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - - /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). - * - * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. - * - * \note This function automatically clears the control transfer's status stage. Do not manually attempt - * to clear the status stage when using this routine in a control transaction. - * \n\n - * - * \note This routine should only be used on CONTROL type endpoints. - * \n\n - * - * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained - * together; i.e. the entire stream data must be read or written at the one time. - * - * \param[in] Buffer Pointer to the source data buffer to read from. - * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. - * - * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. - */ - uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, - uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - //@} - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c deleted file mode 100644 index b105e18c36..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_DEVICE) - -#include "../Endpoint.h" - -#if !defined(FIXED_CONTROL_ENDPOINT_SIZE) -uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE; -#endif - -Endpoint_FIFOPair_t USB_Endpoint_FIFOs[ENDPOINT_TOTAL_ENDPOINTS]; - -volatile uint8_t USB_Endpoint_SelectedEndpoint; -volatile USB_EP_t* USB_Endpoint_SelectedHandle; -volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO; - -bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, - const uint8_t Entries) -{ - for (uint8_t i = 0; i < Entries; i++) - { - if (!(Table[i].Address)) - continue; - - if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks))) - { - return false; - } - } - - return true; -} - -bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address, - const uint8_t Config, - const uint8_t Size) -{ - Endpoint_SelectEndpoint(Address); - - USB_Endpoint_SelectedHandle->CTRL = 0; - USB_Endpoint_SelectedHandle->STATUS = (Address & ENDPOINT_DIR_IN) ? USB_EP_BUSNACK0_bm : 0; - USB_Endpoint_SelectedHandle->CTRL = Config; - USB_Endpoint_SelectedHandle->CNT = 0; - USB_Endpoint_SelectedHandle->DATAPTR = (intptr_t)USB_Endpoint_SelectedFIFO->Data; - - USB_Endpoint_SelectedFIFO->Length = (Address & ENDPOINT_DIR_IN) ? Size : 0; - USB_Endpoint_SelectedFIFO->Position = 0; - - return true; -} - -void Endpoint_ClearEndpoints(void) -{ - for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) - { - ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0; - ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0; - } -} - -void Endpoint_ClearStatusStage(void) -{ - if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) - { - while (!(Endpoint_IsOUTReceived())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - Endpoint_ClearOUT(); - } - else - { - while (!(Endpoint_IsINReady())) - { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - - Endpoint_ClearIN(); - } -} - -#if !defined(CONTROL_ONLY_DEVICE) -uint8_t Endpoint_WaitUntilReady(void) -{ - #if (USB_STREAM_TIMEOUT_MS < 0xFF) - uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #else - uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; - #endif - - uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber(); - - for (;;) - { - if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) - { - if (Endpoint_IsINReady()) - return ENDPOINT_READYWAIT_NoError; - } - else - { - if (Endpoint_IsOUTReceived()) - return ENDPOINT_READYWAIT_NoError; - } - - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_READYWAIT_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_READYWAIT_BusSuspended; - else if (Endpoint_IsStalled()) - return ENDPOINT_READYWAIT_EndpointStalled; - - uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber(); - - if (CurrentFrameNumber != PreviousFrameNumber) - { - PreviousFrameNumber = CurrentFrameNumber; - - if (!(TimeoutMSRem--)) - return ENDPOINT_READYWAIT_Timeout; - } - } -} -#endif - -#endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h deleted file mode 100644 index a4118889be..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h +++ /dev/null @@ -1,777 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Endpoint definitions for the AVR XMEGA microcontrollers. - * \copydetails Group_EndpointManagement_XMEGA - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_EndpointRW - * \defgroup Group_EndpointRW_XMEGA Endpoint Data Reading and Writing (XMEGA) - * \brief Endpoint data read/write definitions for the Atmel AVR XMEGA architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. - */ - -/** \ingroup Group_EndpointPrimitiveRW - * \defgroup Group_EndpointPrimitiveRW_XMEGA Read/Write of Primitive Data Types (XMEGA) - * \brief Endpoint primitive read/write definitions for the Atmel AVR XMEGA architecture. - * - * Functions, macros, variables, enums and types related to data reading and writing of primitive data types - * from and to endpoints. - */ - -/** \ingroup Group_EndpointPacketManagement - * \defgroup Group_EndpointPacketManagement_XMEGA Endpoint Packet Management (XMEGA) - * \brief Endpoint packet management definitions for the Atmel AVR XMEGA architecture. - * - * Functions, macros, variables, enums and types related to packet management of endpoints. - */ - -/** \ingroup Group_EndpointManagement - * \defgroup Group_EndpointManagement_XMEGA Endpoint Management (XMEGA) - * \brief Endpoint management definitions for the Atmel AVR XMEGA architecture. - * - * Functions, macros and enums related to endpoint management when in USB Device mode. This - * module contains the endpoint management macros, as well as endpoint interrupt and data - * send/receive functions for various data types. - * - * @{ - */ - -#ifndef __ENDPOINT_XMEGA_H__ -#define __ENDPOINT_XMEGA_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBTask.h" - #include "../USBInterrupt.h" - #include "../USBController.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if (!defined(MAX_ENDPOINT_INDEX) && !defined(CONTROL_ONLY_DEVICE)) || defined(__DOXYGEN__) - /** Total number of endpoints (including the default control endpoint at address 0) which may - * be used in the device. Different USB AVR models support different amounts of endpoints, - * this value reflects the maximum number of endpoints for the currently selected AVR model. - */ - #define ENDPOINT_TOTAL_ENDPOINTS 16 - #else - #if defined(CONTROL_ONLY_DEVICE) - #define ENDPOINT_TOTAL_ENDPOINTS 1 - #else - #define ENDPOINT_TOTAL_ENDPOINTS (MAX_ENDPOINT_INDEX + 1) - #endif - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Type Defines: */ - typedef struct - { - uint8_t Data[64]; - - uint8_t Length; - uint8_t Position; - } Endpoint_FIFO_t; - - typedef struct - { - Endpoint_FIFO_t OUT; - Endpoint_FIFO_t IN; - } Endpoint_FIFOPair_t; - - /* External Variables: */ - extern Endpoint_FIFOPair_t USB_Endpoint_FIFOs[ENDPOINT_TOTAL_ENDPOINTS]; - extern volatile uint8_t USB_Endpoint_SelectedEndpoint; - extern volatile USB_EP_t* USB_Endpoint_SelectedHandle; - extern volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO; - - /* Inline Functions: */ - static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST - ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) - { - uint8_t MaskVal = 0; - uint16_t CheckBytes = 8; - - while (CheckBytes < Bytes) - { - MaskVal++; - CheckBytes <<= 1; - } - - return (MaskVal << USB_EP_BUFSIZE_gp); - } - - /* Function Prototypes: */ - bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address, - const uint8_t Config, - const uint8_t Size); - void Endpoint_ClearEndpoints(void); - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) - /** Default size of the default control endpoint's bank, until altered by the control endpoint bank size - * value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined. - */ - #define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 - #endif - - /* Enums: */ - /** Enum for the possible error return codes of the \ref Endpoint_WaitUntilReady() function. - * - * \ingroup Group_EndpointRW_XMEGA - */ - enum Endpoint_WaitUntilReady_ErrorCodes_t - { - ENDPOINT_READYWAIT_NoError = 0, /**< Endpoint is ready for next packet, no error. */ - ENDPOINT_READYWAIT_EndpointStalled = 1, /**< The endpoint was stalled during the stream - * transfer by the host or device. - */ - ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while - * waiting for the endpoint to become ready. - */ - ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and - * no USB endpoint traffic can occur until the bus - * has resumed. - */ - ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - }; - - /* Inline Functions: */ - /** Selects the given endpoint address. - * - * Any endpoint operations which do not require the endpoint address to be indicated will operate on - * the currently selected endpoint. - * - * \param[in] Address Endpoint address to select. - */ - static inline void Endpoint_SelectEndpoint(const uint8_t Address); - static inline void Endpoint_SelectEndpoint(const uint8_t Address) - { - uint8_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK); - - USB_Endpoint_SelectedEndpoint = Address; - - if (Address & ENDPOINT_DIR_IN) - { - USB_Endpoint_SelectedFIFO = &USB_Endpoint_FIFOs[EndpointNumber].IN; - USB_Endpoint_SelectedHandle = &((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EndpointNumber].IN; - } - else - { - USB_Endpoint_SelectedFIFO = &USB_Endpoint_FIFOs[EndpointNumber].OUT; - USB_Endpoint_SelectedHandle = &((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EndpointNumber].OUT; - } - } - - /** Configures the specified endpoint address with the given endpoint type, direction, bank size - * and banking mode. Once configured, the endpoint may be read from or written to, depending - * on its direction. - * - * \param[in] Address Endpoint address to configure. - * - * \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types - * are available on Low Speed USB devices - refer to the USB 2.0 specification. - * - * \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted - * to the USB host, or after they have been received from the USB host (depending on - * the endpoint's data direction). The bank size must indicate the maximum packet size - * that the endpoint can handle. - * - * \param[in] Banks Number of hardware banks to use for the endpoint being configured. - * - * \note The default control endpoint should not be manually configured by the user application, as - * it is automatically configured by the library internally. - * \n\n - * - * \note This routine will automatically select the specified endpoint. - * - * \return Boolean \c true if the configuration succeeded, \c false otherwise. - */ - static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, - const uint8_t Type, - const uint16_t Size, - const uint8_t Banks) ATTR_ALWAYS_INLINE; - static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, - const uint8_t Type, - const uint16_t Size, - const uint8_t Banks) - { - uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size)); - - if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS) - return false; - - // TODO - Fix once limitations are lifted - EPConfigMask &= ~USB_EP_PINGPONG_bm; - if (Size > 64) - return false; - - switch (Type) - { - case EP_TYPE_CONTROL: - EPConfigMask |= USB_EP_TYPE_CONTROL_gc; - break; - case EP_TYPE_ISOCHRONOUS: - EPConfigMask |= USB_EP_TYPE_ISOCHRONOUS_gc; - break; - default: - EPConfigMask |= USB_EP_TYPE_BULK_gc; - break; - } - - if (Type == EP_TYPE_CONTROL) - Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size); - - return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size); - } - - /** Indicates the number of bytes currently stored in the current endpoint's selected bank. - * - * \ingroup Group_EndpointRW_XMEGA - * - * \return Total number of bytes in the currently selected Endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_BytesInEndpoint(void) - { - if (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN) - return USB_Endpoint_SelectedFIFO->Position; - else - return (USB_Endpoint_SelectedFIFO->Length - USB_Endpoint_SelectedFIFO->Position); - } - - /** Get the endpoint address of the currently selected endpoint. This is typically used to save - * the currently selected endpoint so that it can be restored after another endpoint has been - * manipulated. - * - * \return Index of the currently selected endpoint. - */ - static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_GetCurrentEndpoint(void) - { - return USB_Endpoint_SelectedEndpoint; - } - - /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's - * data In and Out pointers to the bank's contents. - * - * \param[in] Address Endpoint address whose FIFO buffers are to be reset. - */ - static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ResetEndpoint(const uint8_t Address) - { - if (Address & ENDPOINT_DIR_IN) - USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].IN.Position = 0; - else - USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].OUT.Position = 0; - } - - /** Determines if the currently selected endpoint is enabled, but not necessarily configured. - * - * \return Boolean \c true if the currently selected endpoint is enabled, \c false otherwise. - */ - static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsEnabled(void) - { - return true; - } - - /** Aborts all pending IN transactions on the currently selected endpoint, once the bank - * has been queued for transmission to the host via \ref Endpoint_ClearIN(). This function - * will terminate all queued transactions, resetting the endpoint banks ready for a new - * packet. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - */ - static inline void Endpoint_AbortPendingIN(void) - { - USB_Endpoint_SelectedHandle->STATUS |= USB_EP_BUSNACK0_bm; - } - - /** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint - * bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN - * direction). This function will return false if an error has occurred in the endpoint, if the endpoint - * is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN - * direction and the endpoint bank is full. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - * - * \return Boolean \c true if the currently selected endpoint may be read from or written to, depending - * on its direction. - */ - static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsReadWriteAllowed(void) - { - return (USB_Endpoint_SelectedFIFO->Position < USB_Endpoint_SelectedFIFO->Length); - } - - /** Determines if the currently selected endpoint is configured. - * - * \return Boolean \c true if the currently selected endpoint has been configured, \c false otherwise. - */ - static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsConfigured(void) - { - return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) ? true : false); - } - - /** Determines if the selected IN endpoint is ready for a new packet to be sent to the host. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - * - * \return Boolean \c true if the current endpoint is ready for an IN packet, \c false otherwise. - */ - static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsINReady(void) - { - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); - - return ((USB_Endpoint_SelectedHandle->STATUS & USB_EP_BUSNACK0_bm) ? true : false); - } - - /** Determines if the selected OUT endpoint has received new packet from the host. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - * - * \return Boolean \c true if current endpoint is has received an OUT packet, \c false otherwise. - */ - static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsOUTReceived(void) - { - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); - - if (USB_Endpoint_SelectedHandle->STATUS & USB_EP_TRNCOMPL0_bm) - { - USB_Endpoint_SelectedFIFO->Length = USB_Endpoint_SelectedHandle->CNT; - return true; - } - - return false; - } - - /** Determines if the current CONTROL type endpoint has received a SETUP packet. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - * - * \return Boolean \c true if the selected endpoint has received a SETUP packet, \c false otherwise. - */ - static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsSETUPReceived(void) - { - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); - - if (USB_Endpoint_SelectedHandle->STATUS & USB_EP_SETUP_bm) - { - USB_Endpoint_SelectedFIFO->Length = USB_Endpoint_SelectedHandle->CNT; - return true; - } - - return false; - } - - /** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the - * endpoint for the next packet. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - * - * \note This is not applicable for non CONTROL type endpoints. - */ - static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearSETUP(void) - { - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); - USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_SETUP_bm | USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm); - USB_Endpoint_SelectedHandle->STATUS |= USB_EP_TOGGLE_bm; - USB_Endpoint_SelectedFIFO->Position = 0; - - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); - USB_Endpoint_SelectedHandle->STATUS |= USB_EP_TOGGLE_bm; - USB_Endpoint_SelectedFIFO->Position = 0; - } - - /** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the - * next packet and switching to the alternative endpoint bank if double banked. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - */ - static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearIN(void) - { - USB_Endpoint_SelectedHandle->CNT = USB_Endpoint_SelectedFIFO->Position; - USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm); - USB_Endpoint_SelectedFIFO->Position = 0; - } - - /** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint - * for the next packet and switching to the alternative endpoint bank if double banked. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - */ - static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearOUT(void) - { - USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm); - USB_Endpoint_SelectedFIFO->Position = 0; - } - - /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the - * indicated endpoint and that the current transfer sequence should be aborted. This provides a - * way for devices to indicate invalid commands to the host so that the current transfer can be - * aborted and the host can begin its own recovery sequence. - * - * The currently selected endpoint remains stalled until either the \ref Endpoint_ClearStall() macro - * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected - * endpoint. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - */ - static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_StallTransaction(void) - { - USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm; - - if ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) == USB_EP_TYPE_CONTROL_gc) - { - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint ^ ENDPOINT_DIR_IN); - USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm; - } - } - - /** Clears the STALL condition on the currently selected endpoint. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - */ - static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ClearStall(void) - { - USB_Endpoint_SelectedHandle->CTRL &= ~USB_EP_STALL_bm; - } - - /** Determines if the currently selected endpoint is stalled, false otherwise. - * - * \ingroup Group_EndpointPacketManagement_XMEGA - * - * \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise. - */ - static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline bool Endpoint_IsStalled(void) - { - return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_STALL_bm) ? true : false); - } - - /** Resets the data toggle of the currently selected endpoint. */ - static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_ResetDataToggle(void) - { - USB_Endpoint_SelectedHandle->STATUS &= ~USB_EP_TOGGLE_bm; - } - - /** Determines the currently selected endpoint's direction. - * - * \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask. - */ - static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_GetEndpointDirection(void) - { - return (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN); - } - - /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \return Next byte in the currently selected endpoint's FIFO buffer. - */ - static inline uint8_t Endpoint_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint8_t Endpoint_Read_8(void) - { - return USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++]; - } - - /** Writes one byte to the currently selected endpoint's bank, for IN direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \param[in] Data Data to write into the the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_8(const uint8_t Data) - { - USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++] = Data; - } - - /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - */ - static inline void Endpoint_Discard_8(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_8(void) - { - USB_Endpoint_SelectedFIFO->Position++; - } - - /** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \return Next two bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_Read_16_LE(void) - { - uint16_t Byte0 = Endpoint_Read_8(); - uint16_t Byte1 = Endpoint_Read_8(); - - return ((Byte1 << 8) | Byte0); - } - - /** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \return Next two bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint16_t Endpoint_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint16_t Endpoint_Read_16_BE(void) - { - uint16_t Byte0 = Endpoint_Read_8(); - uint16_t Byte1 = Endpoint_Read_8(); - - return ((Byte0 << 8) | Byte1); - } - - /** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_16_LE(const uint16_t Data) - { - Endpoint_Write_8(Data & 0xFF); - Endpoint_Write_8(Data >> 8); - } - - /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_16_BE(const uint16_t Data) - { - Endpoint_Write_8(Data >> 8); - Endpoint_Write_8(Data & 0xFF); - } - - /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - */ - static inline void Endpoint_Discard_16(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_16(void) - { - Endpoint_Discard_8(); - Endpoint_Discard_8(); - } - - /** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \return Next four bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_Read_32_LE(void) - { - uint32_t Byte0 = Endpoint_Read_8(); - uint32_t Byte1 = Endpoint_Read_8(); - uint32_t Byte2 = Endpoint_Read_8(); - uint32_t Byte3 = Endpoint_Read_8(); - - return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0); - } - - /** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \return Next four bytes in the currently selected endpoint's FIFO buffer. - */ - static inline uint32_t Endpoint_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; - static inline uint32_t Endpoint_Read_32_BE(void) - { - uint32_t Byte0 = Endpoint_Read_8(); - uint32_t Byte1 = Endpoint_Read_8(); - uint32_t Byte2 = Endpoint_Read_8(); - uint32_t Byte3 = Endpoint_Read_8(); - - return ((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3); - } - - /** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_32_LE(const uint32_t Data) - { - Endpoint_Write_8(Data & 0xFF); - Endpoint_Write_8(Data >> 8); - Endpoint_Write_8(Data >> 16); - Endpoint_Write_8(Data >> 24); - } - - /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN - * direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - * - * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. - */ - static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Write_32_BE(const uint32_t Data) - { - Endpoint_Write_8(Data >> 24); - Endpoint_Write_8(Data >> 16); - Endpoint_Write_8(Data >> 8); - Endpoint_Write_8(Data & 0xFF); - } - - /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. - * - * \ingroup Group_EndpointPrimitiveRW_XMEGA - */ - static inline void Endpoint_Discard_32(void) ATTR_ALWAYS_INLINE; - static inline void Endpoint_Discard_32(void) - { - Endpoint_Discard_8(); - Endpoint_Discard_8(); - Endpoint_Discard_8(); - Endpoint_Discard_8(); - } - - /* External Variables: */ - /** Global indicating the maximum packet size of the default control endpoint located at address - * 0 in the device. This value is set to the value indicated in the device descriptor in the user - * project once the USB interface is initialized into device mode. - * - * If space is an issue, it is possible to fix this to a static value by defining the control - * endpoint size in the \c FIXED_CONTROL_ENDPOINT_SIZE token passed to the compiler in the makefile - * via the -D switch. When a fixed control endpoint size is used, the size is no longer dynamically - * read from the descriptors at runtime and instead fixed to the given value. When used, it is - * important that the descriptor control endpoint size value matches the size given as the - * \c FIXED_CONTROL_ENDPOINT_SIZE token - it is recommended that the \c FIXED_CONTROL_ENDPOINT_SIZE token - * be used in the device descriptors to ensure this. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) - extern uint8_t USB_Device_ControlEndpointSize; - #else - #define USB_Device_ControlEndpointSize FIXED_CONTROL_ENDPOINT_SIZE - #endif - - /* Function Prototypes: */ - /** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple - * endpoints at the same time. - * - * \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the - * control endpoint. - * - * \param[in] Table Pointer to a table of endpoint descriptions. - * \param[in] Entries Number of entries in the endpoint table to configure. - * - * \return Boolean \c true if all endpoints configured successfully, \c false otherwise. - */ - bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, - const uint8_t Entries); - - /** Completes the status stage of a control transfer on a CONTROL type endpoint automatically, - * with respect to the data direction. This is a convenience function which can be used to - * simplify user control request handling. - * - * \note This routine should not be called on non CONTROL type endpoints. - */ - void Endpoint_ClearStatusStage(void); - - /** Spin-loops until the currently selected non-control endpoint is ready for the next packet of data - * to be read or written to it. - * - * \note This routine should not be called on CONTROL type endpoints. - * - * \ingroup Group_EndpointRW_XMEGA - * - * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. - */ - uint8_t Endpoint_WaitUntilReady(void); - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c deleted file mode 100644 index 39d920afe1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c deleted file mode 100644 index 39d920afe1..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c deleted file mode 100644 index 6106cb5813..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBMode.h" - -#if defined(USB_CAN_BE_HOST) - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c deleted file mode 100644 index 35776410e2..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (void* const Buffer, - uint16_t Length) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); - - if (!(Length)) - Endpoint_ClearOUT(); - - while (Length) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - else if (Endpoint_IsSETUPReceived()) - return ENDPOINT_RWCSTREAM_HostAborted; - - if (Endpoint_IsOUTReceived()) - { - while (Length && Endpoint_BytesInEndpoint()) - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - } - - Endpoint_ClearOUT(); - } - } - - while (!(Endpoint_IsINReady())) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - } - - return ENDPOINT_RWCSTREAM_NoError; -} - -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c deleted file mode 100644 index ed2d2d9b75..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, - uint16_t Length) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - bool LastPacketFull = false; - - Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); - - if (Length > USB_ControlRequest.wLength) - Length = USB_ControlRequest.wLength; - else if (!(Length)) - Endpoint_ClearIN(); - - while (Length || LastPacketFull) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - else if (Endpoint_IsSETUPReceived()) - return ENDPOINT_RWCSTREAM_HostAborted; - else if (Endpoint_IsOUTReceived()) - break; - - if (Endpoint_IsINReady()) - { - uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); - - while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInEndpoint++; - } - - LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); - Endpoint_ClearIN(); - } - } - - while (!(Endpoint_IsOUTReceived())) - { - uint8_t USB_DeviceState_LCL = USB_DeviceState; - - if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) - return ENDPOINT_RWCSTREAM_DeviceDisconnected; - else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) - return ENDPOINT_RWCSTREAM_BusSuspended; - } - - return ENDPOINT_RWCSTREAM_NoError; -} - -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_TRANSFER_BYTE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c deleted file mode 100644 index 02ad97867e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(TEMPLATE_FUNC_NAME) - -// cppcheck-suppress unusedFunction -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, - uint16_t Length, - uint16_t* const BytesProcessed) -{ - uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); - uint16_t BytesInTransfer = 0; - uint8_t ErrorCode; - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - - if (BytesProcessed != NULL) - { - Length -= *BytesProcessed; - TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); - } - - while (Length) - { - if (!(Endpoint_IsReadWriteAllowed())) - { - TEMPLATE_CLEAR_ENDPOINT(); - - #if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); - #endif - - if (BytesProcessed != NULL) - { - *BytesProcessed += BytesInTransfer; - return ENDPOINT_RWSTREAM_IncompleteTransfer; - } - - if ((ErrorCode = Endpoint_WaitUntilReady())) - return ErrorCode; - } - else - { - TEMPLATE_TRANSFER_BYTE(DataStream); - TEMPLATE_BUFFER_MOVE(DataStream, 1); - Length--; - BytesInTransfer++; - } - } - - return ENDPOINT_RWSTREAM_NoError; -} - -#undef TEMPLATE_FUNC_NAME -#undef TEMPLATE_BUFFER_TYPE -#undef TEMPLATE_TRANSFER_BYTE -#undef TEMPLATE_CLEAR_ENDPOINT -#undef TEMPLATE_BUFFER_OFFSET -#undef TEMPLATE_BUFFER_MOVE - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c deleted file mode 100644 index 3899278db6..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#define __INCLUDE_FROM_USB_CONTROLLER_C -#include "../USBController.h" - -#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) -volatile uint8_t USB_CurrentMode = USB_MODE_None; -#endif - -#if !defined(USE_STATIC_OPTIONS) -volatile uint8_t USB_Options; -#endif - -/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for 8-bit AVR-GCC */ -uint8_t USB_EndpointTable[sizeof(USB_EndpointTable_t) + 1]; - -void USB_Init( - #if defined(USB_CAN_BE_BOTH) - const uint8_t Mode - #endif - - #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) - , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void - #endif - - #if !defined(USE_STATIC_OPTIONS) - const uint8_t Options - #endif - ) -{ - #if !defined(USE_STATIC_OPTIONS) - USB_Options = Options; - #endif - - USB_IsInitialized = true; - - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; - USB.CAL0 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL0)); - USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1)); - NVM.CMD = 0; - - /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toochain */ - USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0)); - USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp)); - - if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH) - USB.INTCTRLA = (3 << USB_INTLVL_gp); - else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED) - USB.INTCTRLA = (2 << USB_INTLVL_gp); - else - USB.INTCTRLA = (1 << USB_INTLVL_gp); - - SetGlobalInterruptMask(CurrentGlobalInt); - - USB_ResetInterface(); -} - -void USB_Disable(void) -{ - USB_INT_DisableAllInterrupts(); - USB_INT_ClearAllInterrupts(); - - USB_Detach(); - USB_Controller_Disable(); - - USB_IsInitialized = false; -} - -void USB_ResetInterface(void) -{ - #if defined(USB_DEVICE_OPT_FULLSPEED) - if (USB_Options & USB_DEVICE_OPT_LOWSPEED) - CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp); - else - CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp); - #else - CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp); - #endif - - if (USB_Options & USB_OPT_PLLCLKSRC) - CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm); - else - CLK.USBCTRL |= (CLK_USBSRC_RC32M_gc | CLK_USBSEN_bm); - - USB_Device_SetDeviceAddress(0); - - USB_INT_DisableAllInterrupts(); - USB_INT_ClearAllInterrupts(); - - USB_Controller_Reset(); - USB_Init_Device(); -} - -#if defined(USB_CAN_BE_DEVICE) -static void USB_Init_Device(void) -{ - USB_DeviceState = DEVICE_STATE_Unattached; - USB_Device_ConfigurationNumber = 0; - - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - USB_Device_RemoteWakeupEnabled = false; - #endif - - #if !defined(NO_DEVICE_SELF_POWER) - USB_Device_CurrentlySelfPowered = false; - #endif - - #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) - USB_Descriptor_Device_t* DeviceDescriptorPtr; - - #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ - !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) - uint8_t DescriptorAddressSpace; - - if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr, &DescriptorAddressSpace) != NO_DESCRIPTOR) - { - if (DescriptorAddressSpace == MEMSPACE_FLASH) - USB_Device_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - else if (DescriptorAddressSpace == MEMSPACE_EEPROM) - USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - else - USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; - } - #else - if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) - { - #if defined(USE_RAM_DESCRIPTORS) - USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; - #elif defined(USE_EEPROM_DESCRIPTORS) - USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - #else - USB_Device_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); - #endif - } - #endif - #endif - - if (USB_Options & USB_DEVICE_OPT_LOWSPEED) - USB_Device_SetLowSpeed(); - else - USB_Device_SetFullSpeed(); - - Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - USB_Device_ControlEndpointSize, 1); - - USB_INT_Enable(USB_INT_BUSEVENTI); - - USB_Attach(); -} -#endif - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h deleted file mode 100644 index bb37905aba..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Controller definitions for the AVR XMEGA microcontrollers. - * \copydetails Group_USBManagement_XMEGA - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -/** \ingroup Group_USBManagement - * \defgroup Group_USBManagement_XMEGA USB Interface Management (XMEGA) - * \brief USB Controller definitions for the AVR XMEGA microcontrollers. - * - * Functions, macros, variables, enums and types related to the setup and management of the USB interface. - * - * @{ - */ - -#ifndef __USBCONTROLLER_XMEGA_H__ -#define __USBCONTROLLER_XMEGA_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - #include "../USBMode.h" - #include "../Events.h" - #include "../USBTask.h" - #include "../USBInterrupt.h" - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Type Defines: */ - typedef struct - { - struct - { - USB_EP_t OUT; - USB_EP_t IN; - } Endpoints[16]; - uint16_t FrameNum; - } ATTR_PACKED USB_EndpointTable_t; - - /* External Variables: */ - extern uint8_t USB_EndpointTable[]; - - #endif - - /* Includes: */ - #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) - #include "../Device.h" - #include "../Endpoint.h" - #include "../DeviceStandardReq.h" - #include "../EndpointStream.h" - #endif - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks and Defines: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - #if !defined(F_USB) - #error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile. - #endif - - #if ((F_USB % 6000000) || (F_USB < 6000000)) - #error Invalid F_USB specified. F_USB must be a multiple of 6MHz for USB Low Speed operation, and a multiple of 48MHz for Full Speed operation. - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** \name USB Controller Option Masks */ - //@{ - /** Sets the USB bus interrupt priority level to be low priority. The USB bus interrupt is used for Start of Frame events, bus suspend - * and resume events, bus reset events and other events related to the management of the USB bus. - */ - #define USB_OPT_BUSEVENT_PRILOW ((0 << 2) | (0 << 1)) - - /** Sets the USB bus interrupt priority level to be medium priority. The USB bus interrupt is used for Start of Frame events, bus suspend - * and resume events, bus reset events and other events related to the management of the USB bus. - */ - #define USB_OPT_BUSEVENT_PRIMED ((0 << 2) | (1 << 1)) - - /** Sets the USB bus interrupt priority level to be high priority. The USB bus interrupt is used for Start of Frame events, bus suspend - * and resume events, bus reset events and other events related to the management of the USB bus. - */ - #define USB_OPT_BUSEVENT_PRIHIGH ((1 << 2) | (0 << 1)) - - /** Sets the USB controller to source its clock from the internal RC 32MHz clock, once it has been DFLL calibrated to 48MHz. */ - #define USB_OPT_RC32MCLKSRC (0 << 3) - - /** Sets the USB controller to source its clock from the internal PLL. */ - #define USB_OPT_PLLCLKSRC (1 << 3) - //@} - - #if !defined(USB_STREAM_TIMEOUT_MS) || defined(__DOXYGEN__) - /** Constant for the maximum software timeout period of the USB data stream transfer functions - * (both control and standard) when in either device or host mode. If the next packet of a stream - * is not received or acknowledged within this time period, the stream function will fail. - * - * This value may be overridden in the user project makefile as the value of the - * \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch. - */ - #define USB_STREAM_TIMEOUT_MS 100 - #endif - - /* Inline Functions: */ - /** Detaches the device from the USB bus. This has the effect of removing the device from any - * attached host, ceasing USB communications. If no host is present, this prevents any host from - * enumerating the device once attached until \ref USB_Attach() is called. - */ - static inline void USB_Detach(void) ATTR_ALWAYS_INLINE; - static inline void USB_Detach(void) - { - USB.CTRLB &= ~USB_ATTACH_bm; - } - - /** Attaches the device to the USB bus. This announces the device's presence to any attached - * USB host, starting the enumeration process. If no host is present, attaching the device - * will allow for enumeration once a host is connected to the device. - * - * This is inexplicably also required for proper operation while in host mode, to enable the - * attachment of a device to the host. This is despite the bit being located in the device-mode - * register and despite the datasheet making no mention of its requirement in host mode. - */ - static inline void USB_Attach(void) ATTR_ALWAYS_INLINE; - static inline void USB_Attach(void) - { - USB.CTRLB |= USB_ATTACH_bm; - } - - /* Function Prototypes: */ - /** Main function to initialize and start the USB interface. Once active, the USB interface will - * allow for device connection to a host when in device mode, or for device enumeration while in - * host mode. - * - * As the USB library relies on interrupts for the device and host mode enumeration processes, - * the user must enable global interrupts before or shortly after this function is called. In - * device mode, interrupts must be enabled within 500ms of this function being called to ensure - * that the host does not time out whilst enumerating the device. In host mode, interrupts may be - * enabled at the application's leisure however enumeration will not begin of an attached device - * until after this has occurred. - * - * Calling this function when the USB interface is already initialized will cause a complete USB - * interface reset and re-enumeration. - * - * \param[in] Mode This is a mask indicating what mode the USB interface is to be initialized to, a value - * from the \ref USB_Modes_t enum. - * - * \param[in] Options Mask indicating the options which should be used when initializing the USB - * interface to control the USB interface's behavior. This should be comprised of - * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the - * PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device - * mode speed. - * - * \note To reduce the FLASH requirements of the library if only device or host mode is required, - * the mode can be statically set in the project makefile by defining the token \c USB_DEVICE_ONLY - * (for device mode) or \c USB_HOST_ONLY (for host mode), passing the token to the compiler - * via the -D switch. If the mode is statically set, this parameter does not exist in the - * function prototype. - * \n\n - * - * \note To reduce the FLASH requirements of the library if only fixed settings are required, - * the options may be set statically in the same manner as the mode (see the Mode parameter of - * this function). To statically set the USB options, pass in the \c USE_STATIC_OPTIONS token, - * defined to the appropriate options masks. When the options are statically set, this - * parameter does not exist in the function prototype. - * \n\n - * - * \note The mode parameter does not exist on devices where only one mode is possible, such as USB - * AVR models which only implement the USB device mode in hardware. - * - * \see \ref Group_Device for the \c USB_DEVICE_OPT_* masks. - */ - void USB_Init( - #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) - const uint8_t Mode - #endif - - #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) || defined(__DOXYGEN__) - , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void - #endif - - #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) - const uint8_t Options - #endif - ); - - /** Shuts down the USB interface. This turns off the USB interface after deallocating all USB FIFO - * memory, endpoints and pipes. When turned off, no USB functionality can be used until the interface - * is restarted with the \ref USB_Init() function. - */ - void USB_Disable(void); - - /** Resets the interface, when already initialized. This will re-enumerate the device if already connected - * to a host, or re-enumerate an already attached device when in host mode. - */ - void USB_ResetInterface(void); - - /* Global Variables: */ - #if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) || defined(__DOXYGEN__) - /** Indicates the mode that the USB interface is currently initialized to, a value from the - * \ref USB_Modes_t enum. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - * - * \note When the controller is initialized into UID auto-detection mode, this variable will hold the - * currently selected USB mode (i.e. \ref USB_MODE_Device or \ref USB_MODE_Host). If the controller - * is fixed into a specific mode (either through the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY compile time - * options, or a limitation of the USB controller in the chosen device model) this will evaluate to - * a constant of the appropriate value and will never evaluate to \ref USB_MODE_None even when the - * USB interface is not initialized. - */ - extern volatile uint8_t USB_CurrentMode; - #elif defined(USB_DEVICE_ONLY) - #define USB_CurrentMode USB_MODE_Device - #endif - - #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) - /** Indicates the current USB options that the USB interface was initialized with when \ref USB_Init() - * was called. This value will be one of the \c USB_MODE_* masks defined elsewhere in this module. - * - * \attention This variable should be treated as read-only in the user application, and never manually - * changed in value. - */ - extern volatile uint8_t USB_Options; - #elif defined(USE_STATIC_OPTIONS) - #define USB_Options USE_STATIC_OPTIONS - #endif - - /* Enums: */ - /** Enum for the possible USB controller modes, for initialization via \ref USB_Init() and indication back to the - * user application via \ref USB_CurrentMode. - */ - enum USB_Modes_t - { - USB_MODE_None = 0, /**< Indicates that the controller is currently not initialized in any specific USB mode. */ - USB_MODE_Device = 1, /**< Indicates that the controller is currently initialized in USB Device mode. */ - }; - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Function Prototypes: */ - #if defined(__INCLUDE_FROM_USB_CONTROLLER_C) - static void USB_Init_Device(void); - #endif - - /* Inline Functions: */ - static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Enable(void) - { - USB.CTRLA |= USB_ENABLE_bm; - } - - static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Disable(void) - { - USB.CTRLA &= ~USB_ENABLE_bm; - } - - static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; - static inline void USB_Controller_Reset(void) - { - USB.CTRLA &= ~USB_ENABLE_bm; - USB.CTRLA |= USB_ENABLE_bm; - } - - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c deleted file mode 100644 index 9bba25ae96..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../../../Common/Common.h" -#if (ARCH == ARCH_XMEGA) - -#define __INCLUDE_FROM_USB_DRIVER -#include "../USBInterrupt.h" - -void USB_INT_DisableAllInterrupts(void) -{ - USB.INTCTRLA &= USB_INTLVL_gm; - USB.INTCTRLB = 0; -} - -void USB_INT_ClearAllInterrupts(void) -{ - USB.INTFLAGSACLR = 0xFF; - USB.INTFLAGSBCLR = 0xFF; -} - -ISR(USB_BUSEVENT_vect) -{ - #if !defined(NO_SOF_EVENTS) - if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) - { - USB_INT_Clear(USB_INT_SOFI); - - EVENT_USB_Device_StartOfFrame(); - } - #endif - - if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Suspend)) - { - USB_INT_Clear(USB_INT_BUSEVENTI_Suspend); - - #if !defined(NO_LIMITED_CONTROLLER_CONNECT) - USB_DeviceState = DEVICE_STATE_Unattached; - EVENT_USB_Device_Disconnect(); - #else - USB_DeviceState = DEVICE_STATE_Suspended; - EVENT_USB_Device_Suspend(); - #endif - } - - if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Resume)) - { - USB_INT_Clear(USB_INT_BUSEVENTI_Resume); - - if (USB_Device_ConfigurationNumber) - USB_DeviceState = DEVICE_STATE_Configured; - else - USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; - - #if !defined(NO_LIMITED_CONTROLLER_CONNECT) - EVENT_USB_Device_Connect(); - #else - EVENT_USB_Device_WakeUp(); - #endif - } - - if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Reset)) - { - USB_INT_Clear(USB_INT_BUSEVENTI_Reset); - - USB_DeviceState = DEVICE_STATE_Default; - USB_Device_ConfigurationNumber = 0; - - USB_Device_SetDeviceAddress(0); - - Endpoint_ClearEndpoints(); - Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, - USB_Device_ControlEndpointSize, 1); - - EVENT_USB_Device_Reset(); - } -} - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h deleted file mode 100644 index 5eef7121ee..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief USB Controller Interrupt definitions for the AVR XMEGA microcontrollers. - * - * This file contains definitions required for the correct handling of low level USB service routine interrupts - * from the USB controller. - * - * \note This file should not be included directly. It is automatically included as needed by the USB driver - * dispatch header located in LUFA/Drivers/USB/USB.h. - */ - -#ifndef __USBINTERRUPT_XMEGA_H__ -#define __USBINTERRUPT_XMEGA_H__ - - /* Includes: */ - #include "../../../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Preprocessor Checks: */ - #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Enums: */ - enum USB_Interrupts_t - { - USB_INT_BUSEVENTI = 1, - USB_INT_BUSEVENTI_Suspend = 2, - USB_INT_BUSEVENTI_Resume = 3, - USB_INT_BUSEVENTI_Reset = 4, - USB_INT_SOFI = 5, - }; - - /* Inline Functions: */ - static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Enable(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_BUSEVENTI: - USB.INTCTRLA |= USB_BUSEVIE_bm; - return; - case USB_INT_SOFI: - USB.INTCTRLA |= USB_SOFIE_bm; - return; - } - } - - static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Disable(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_BUSEVENTI: - USB.INTCTRLA &= ~USB_BUSEVIE_bm; - return; - case USB_INT_SOFI: - USB.INTCTRLA &= ~USB_SOFIE_bm; - return; - } - } - - static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; - static inline void USB_INT_Clear(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_BUSEVENTI_Suspend: - USB.INTFLAGSACLR = USB_SUSPENDIF_bm; - return; - case USB_INT_BUSEVENTI_Resume: - USB.INTFLAGSACLR = USB_RESUMEIF_bm; - return; - case USB_INT_BUSEVENTI_Reset: - USB.INTFLAGSACLR = USB_RSTIF_bm; - return; - case USB_INT_SOFI: - USB.INTFLAGSACLR = USB_SOFIF_bm; - return; - } - } - - static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_BUSEVENTI: - return ((USB.INTCTRLA & USB_BUSEVIE_bm) ? true : false); - case USB_INT_SOFI: - return ((USB.INTCTRLA & USB_SOFIE_bm) ? true : false); - } - - return false; - } - - static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; - static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) - { - switch (Interrupt) - { - case USB_INT_BUSEVENTI_Suspend: - return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false); - case USB_INT_BUSEVENTI_Resume: - return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false); - case USB_INT_BUSEVENTI_Reset: - return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false); - case USB_INT_SOFI: - return ((USB.INTFLAGSACLR & USB_SOFIF_bm) ? true : false); - } - - return false; - } - - /* Includes: */ - #include "../USBMode.h" - #include "../Events.h" - #include "../USBController.h" - - /* Function Prototypes: */ - void USB_INT_ClearAllInterrupts(void); - void USB_INT_DisableAllInterrupts(void); - #endif - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h b/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h deleted file mode 100644 index 66f0fd3c0a..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h +++ /dev/null @@ -1,418 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Master include file for the library USB functionality. - * - * Master include file for the library USB functionality. - * - * This file should be included in all user projects making use of the USB portions of the library, instead of - * the individual USB driver submodule headers. - */ - -/** \defgroup Group_USB USB Core - LUFA/Drivers/USB/USB.h - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Drivers/USB/Core/ConfigDescriptors.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/DeviceStandardReq.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/Events.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/HostStandardReq.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/USBTask.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/Device_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/Endpoint_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/EndpointStream_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/Host_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/Pipe_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/PipeStream_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/USBController_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Core/ARCH/USBInterrupt_ARCH.c (Makefile source module name: LUFA_SRC_USB) - * - LUFA/Drivers/USB/Class/Common/HIDParser.c (Makefile source module name: LUFA_SRC_USB) - * - * \section Sec_ModDescription Module Description - * Driver and framework for the USB controller of the selected architecture and microcontroller model. This module - * consists of many submodules, and is designed to provide an easy way to configure and control USB host, device - * or OTG mode USB applications. - * - * The USB stack requires the sole control over the USB controller in the microcontroller only; i.e. it does not - * require any additional timers or other peripherals to operate. This ensures that the USB stack requires as few - * resources as possible. - * - * The USB stack can be used in Device Mode for connections to USB Hosts (see \ref Group_Device), in Host mode for - * hosting of other USB devices (see \ref Group_Host), or as a dual role device which can either act as a USB host - * or device depending on what peripheral is connected (see \ref Group_OTG). Both modes also require a common set - * of USB management functions found \ref Group_USBManagement. - */ - -/** \defgroup Group_USBClassDrivers USB Class Drivers - * - * Drivers for both host and device mode of the standard USB classes, for rapid application development. - * Class drivers give a framework which sits on top of the low level library API, allowing for standard - * USB classes to be implemented in a project with minimal user code. These drivers can be used in - * conjunction with the library low level APIs to implement interfaces both via the class drivers and via - * the standard library APIs. - * - * Multiple device mode class drivers can be used within a project, including multiple instances of the - * same class driver. In this way, USB Hosts and Devices can be made quickly using the internal class drivers - * so that more time and effort can be put into the end application instead of the USB protocol. - * - * The available class drivers and their modes are listed below. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -* - * - * - * - * - * - * - * - * - * - * - * - *
USB ClassDevice ModeHost Mode
Android Open AccessoryNoYes
Audio 1.0YesYes
CDC-ACMYesYes
HIDYesYes
MIDIYesYes
Mass StorageYesYes
PrinterNoYes
RNDISYesYes
Still ImageNoYes
- * - * - * \section Sec_UsingClassDrivers Using the Class Drivers - * To make the Class drivers easy to integrate into a user application, they all implement a standardized - * design with similarly named/used function, enums, defines and types. The two different modes are implemented - * slightly differently, and thus will be explained separately. For information on a specific class driver, read - * the class driver's module documentation. - * - * \subsection Sec_ClassDriverDevice Device Mode Class Drivers - * Implementing a Device Mode Class Driver in a user application requires a number of steps to be followed. Firstly, - * the module configuration and state structure must be added to the project source. These structures are named in a - * similar manner between classes, that of USB_ClassInfo_{Class Name}_Device_t, and are used to hold the - * complete state and configuration for each class instance. Multiple class instances is where the power of the class - * drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's \c USB_ClassInfo_* - * structure. - * - * Inside the ClassInfo structure lies two sections, a \c Config section, and a \c State section. The \c Config - * section contains the instance's configuration parameters, and must have all fields set by the user application - * before the class driver is used. Each Device mode Class driver typically contains a set of configuration parameters - * for the endpoint size/number of the associated logical USB interface, plus any class-specific configuration parameters. - * - * The following is an example of a properly initialized instance of the Audio Class Driver structure: - * - * \code - * USB_ClassInfo_Audio_Device_t My_Audio_Interface = - * { - * .Config = - * { - * .StreamingInterfaceNumber = 1, - * .DataINEndpoint = - * { - * .Address = (ENDPOINT_DIR_IN | 1), - * .Size = 64, - * .Banks = 1, - * }, - * }, - * }; - * \endcode - * - * \note The class driver's configuration parameters should match those used in the device's descriptors that are - * sent to the host. - * - * To initialize the Class driver instance, the driver's {Class Name}_Device_ConfigureEndpoints() function - * should be called in response to the \ref EVENT_USB_Device_ConfigurationChanged() event. This function will return a - * boolean true value if the driver successfully initialized the instance. Like all the class driver functions, this function - * takes in the address of the specific instance you wish to initialize - in this manner, multiple separate instances of - * the same class type can be initialized like this: - * - * \code - * void EVENT_USB_Device_ConfigurationChanged(void) - * { - * LEDs_SetAllLEDs(LEDMASK_USB_READY); - * - * if (!(Audio_Device_ConfigureEndpoints(&My_Audio_Interface))) - * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - * } - * \endcode - * - * Once initialized, it is important to maintain the class driver's state by repeatedly calling the Class Driver's - * {Class Name}_Device_USBTask() function in the main program loop. The exact implementation of this - * function varies between class drivers, and can be used for any internal class driver purpose to maintain each - * instance. Again, this function uses the address of the instance to operate on, and thus needs to be called for each - * separate instance, just like the main USB maintenance routine \ref USB_USBTask(): - * - * \code - * int main(void) - * { - * SetupHardware(); - * - * LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - * - * for (;;) - * { - * if (USB_DeviceState != DEVICE_STATE_Configured) - * Create_And_Process_Samples(); - * - * Audio_Device_USBTask(&My_Audio_Interface); - * USB_USBTask(); - * } - * } - * \endcode - * - * The final standardized Device Class Driver function is the Control Request handler function - * {Class Name}_Device_ProcessControlRequest(), which should be called when the - * \ref EVENT_USB_Device_ControlRequest() event fires. This function should also be called for - * each class driver instance, using the address of the instance to operate on as the function's - * parameter. The request handler will abort if it is determined that the current request is not - * targeted at the given class driver instance, thus these methods can safely be called - * one-after-another in the event handler with no form of error checking: - * - * \code - * void EVENT_USB_Device_ControlRequest(void) - * { - * Audio_Device_ProcessControlRequest(&My_Audio_Interface); - * } - * \endcode - * - * Each class driver may also define a set of callback functions (which are prefixed by \c CALLBACK_* - * in the function's name) which must also be added to the user application - refer to each - * individual class driver's documentation for mandatory callbacks. In addition, each class driver may - * also define a set of events (identifiable by their prefix of \c EVENT_* in the function's name), which - * the user application may choose to implement, or ignore if not needed. - * - * The individual Device Mode Class Driver documentation contains more information on the non-standardized, - * class-specific functions which the user application can then use on the driver instances, such as data - * read and write routines. See each driver's individual documentation for more information on the - * class-specific functions. - * - * \subsection Sec_ClassDriverHost Host Mode Class Drivers - * Implementing a Host Mode Class Driver in a user application requires a number of steps to be followed. Firstly, - * the module configuration and state structure must be added to the project source. These structures are named in a - * similar manner between classes, that of USB_ClassInfo_{Class Name}_Host_t, and are used to hold the - * complete state and configuration for each class instance. Multiple class instances is where the power of the class - * drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's \c USB_ClassInfo_* - * structure. - * - * Inside the \c USB_ClassInfo_* structure lies two sections, a \c Config section, and a \c State section. The \c Config - * section contains the instance's configuration parameters, and must have all fields set by the user application - * before the class driver is used. Each Device mode Class driver typically contains a set of configuration parameters - * for the endpoint size/number of the associated logical USB interface, plus any class-specific configuration parameters. - * - * The following is an example of a properly initialized instance of the MIDI Host Class Driver structure: - * - * \code - * USB_ClassInfo_MIDI_Host_t My_MIDI_Interface = - * { - * .Config = - * { - * .DataINPipe = - * { - * .Address = (PIPE_DIR_IN | 1), - * .Size = 64, - * .Banks = 1, - * }, - * .DataOUTPipe = - * { - * .Address = (PIPE_DIR_OUT | 2), - * .Size = 64, - * .Banks = 1, - * }, - * }, - * }; - * \endcode - * - * To initialize the Class driver instance, the driver's {Class Name}_Host_ConfigurePipes() function - * should be called in response to the \c EVENT_USB_Host_DeviceEnumerationComplete() event firing. This function will - * will return an error code from the class driver's {Class Name}_EnumerationFailure_ErrorCodes_t enum - * to indicate if the driver successfully initialized the instance and bound it to an interface in the attached device. - * Like all the class driver functions, this function takes in the address of the specific instance you wish to initialize - - * in this manner, multiple separate instances of the same class type can be initialized. A fragment of a Class Driver - * based Host mode application may look like the following: - * - * \code - * void EVENT_USB_Host_DeviceEnumerationComplete(void) - * { - * LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); - * - * uint16_t ConfigDescriptorSize; - * uint8_t ConfigDescriptorData[512]; - * - * if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, - * sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) - * { - * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - * return; - * } - * - * if (MIDI_Host_ConfigurePipes(&Keyboard_MIDI_Interface, - * ConfigDescriptorSize, ConfigDescriptorData) != MIDI_ENUMERROR_NoError) - * { - * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - * return; - * } - * - * if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) - * { - * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); - * return; - * } - * - * LEDs_SetAllLEDs(LEDMASK_USB_READY); - * } - * \endcode - * - * Note that the function also requires the device's configuration descriptor so that it can determine which interface - * in the device to bind to - this can be retrieved as shown in the above fragment using the - * \ref USB_Host_GetDeviceConfigDescriptor() function. If the device does not implement the interface the class driver - * is looking for, if all the matching interfaces are already bound to class driver instances or if an error occurs while - * binding to a device interface (for example, a device endpoint bank larger that the maximum supported bank size is used) - * the configuration will fail. - * - * To complete the device enumeration after binding the host mode Class Drivers to the attached device, a call to - * \c USB_Host_SetDeviceConfiguration() must be made. If the device configuration is not set within the - * \c EVENT_USB_Host_DeviceEnumerationComplete() event, the host still will assume the device enumeration has failed. - * - * Once initialized, it is important to maintain the class driver's state by repeatedly calling the Class Driver's - * {Class Name}_Host_USBTask() function in the main program loop. The exact implementation of this - * function varies between class drivers, and can be used for any internal class driver purpose to maintain each - * instance. Again, this function uses the address of the instance to operate on, and thus needs to be called for each - * separate instance, just like the main USB maintenance routine \ref USB_USBTask(): - * - * \code - * int main(void) - * { - * SetupHardware(); - * - * LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); - * - * for (;;) - * { - * if (USB_HostState != HOST_STATE_Configured) - * Create_And_Process_Samples(); - * - * MIDI_Host_USBTask(&My_Audio_Interface); - * USB_USBTask(); - * } - * } - * \endcode - * - * Each class driver may also define a set of callback functions (which are prefixed by \c CALLBACK_* - * in the function's name) which must also be added to the user application - refer to each - * individual class driver's documentation for mandatory callbacks. In addition, each class driver may - * also define a set of events (identifiable by their prefix of \c EVENT_* in the function's name), which - * the user application may choose to implement, or ignore if not needed. - * - * The individual Host Mode Class Driver documentation contains more information on the non-standardized, - * class-specific functions which the user application can then use on the driver instances, such as data - * read and write routines. See each driver's individual documentation for more information on the - * class-specific functions. - */ - -#ifndef __USB_H__ -#define __USB_H__ - - /* Macros: */ - #define __INCLUDE_FROM_USB_DRIVER - - /* Includes: */ - #include "../../Common/Common.h" - #include "Core/USBMode.h" - - /* Includes: */ - #include "Core/USBTask.h" - #include "Core/Events.h" - #include "Core/StdDescriptors.h" - #include "Core/ConfigDescriptors.h" - #include "Core/USBController.h" - #include "Core/USBInterrupt.h" - - #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__) - #include "Core/Host.h" - #include "Core/Pipe.h" - #include "Core/HostStandardReq.h" - #include "Core/PipeStream.h" - #endif - - #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) - #include "Core/Device.h" - #include "Core/Endpoint.h" - #include "Core/DeviceStandardReq.h" - #include "Core/EndpointStream.h" - #endif - - #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) - #include "Core/OTG.h" - #endif - - #include "Class/AndroidAccessoryClass.h" - #include "Class/AudioClass.h" - #include "Class/CDCClass.h" - #include "Class/HIDClass.h" - #include "Class/MassStorageClass.h" - #include "Class/MIDIClass.h" - #include "Class/PrinterClass.h" - #include "Class/RNDISClass.h" - #include "Class/StillImageClass.h" - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/License.txt b/protocol/lufa/LUFA-120730/LUFA/License.txt deleted file mode 100644 index 9e27adfb2b..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/License.txt +++ /dev/null @@ -1,24 +0,0 @@ - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org - - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose is hereby granted without -fee, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the name of the author not be used in -advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -The author disclaim all warranties with regard to this -software, including all implied warranties of merchantability -and fitness. In no event shall the author be liable for any -special, indirect or consequential damages or any damages -whatsoever resulting from loss of use, data or profits, whether -in an action of contract, negligence or other tortious action, -arising out of or in connection with the use or performance of -this software. \ No newline at end of file diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h b/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h deleted file mode 100644 index 9bd29f5c00..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Architecture Specific Hardware Platform Drivers. - * - * This file is the master dispatch header file for the device-specific hardware platform drivers, for low level - * hardware configuration and management. The platform drivers are a set of drivers which are designed to provide - * a high level management layer for the various low level system functions such as clock control and interrupt - * management. - * - * User code may choose to either include this master dispatch header file to include all available platform - * driver header files for the current architecture, or may choose to only include the specific platform driver - * modules required for a particular application. - */ - -/** \defgroup Group_PlatformDrivers System Platform Drivers - LUFA/Platform/Platform.h - * \brief Hardware platform drivers. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - UC3 Architecture Only: LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM) - * - UC3 Architecture Only: LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM) - * - * \section Sec_ModDescription Module Description - * Device-specific hardware platform drivers, for low level hardware configuration and management. The platform - * drivers are a set of drivers which are designed to provide a high level management layer for the various low level - * system functions such as clock control and interrupt management. - * - * User code may choose to either include this master dispatch header file to include all available platform - * driver header files for the current architecture, or may choose to only include the specific platform driver - * modules required for a particular application. - * - * \note The exact APIs and availability of sub-modules within the platform driver group may vary depending on the - * target used - see individual target module documentation for the API specific to your target processor. - */ - -#ifndef __LUFA_PLATFORM_H__ -#define __LUFA_PLATFORM_H__ - - /* Includes: */ - #include "../Common/Common.h" - - /* Includes: */ - #if (ARCH == ARCH_UC3) - #include "UC3/ClockManagement.h" - #include "UC3/InterruptManagement.h" - #elif (ARCH == ARCH_XMEGA) - #include "XMEGA/ClockManagement.h" - #endif - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h b/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h deleted file mode 100644 index fb62fdcc9e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h +++ /dev/null @@ -1,338 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Module Clock Driver for the AVR32 UC3 microcontrollers. - * - * Clock management driver for the AVR32 UC3 microcontrollers. This driver allows for the configuration - * of the various clocks within the device to clock the various peripherals. - */ - -/** \ingroup Group_PlatformDrivers_UC3 - * \defgroup Group_PlatformDrivers_UC3Clocks Clock Management Driver - LUFA/Platform/UC3/ClockManagement.h - * \brief Module Clock Driver for the AVR32 UC3 microcontrollers. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Clock management driver for the AVR32 UC3 microcontrollers. This driver allows for the configuration - * of the various clocks within the device to clock the various peripherals. - * - * Usage Example: - * \code - * #include - * - * void main(void) - * { - * // Start the master external oscillator which will be used as the main clock reference - * AVR32CLK_StartExternalOscillator(0, EXOSC_MODE_8MHZ_OR_MORE, EXOSC_START_0CLK); - * - * // Start the PLL for the CPU clock, switch CPU to it - * AVR32CLK_StartPLL(0, CLOCK_SRC_OSC0, 12000000, F_CPU); - * AVR32CLK_SetCPUClockSource(CLOCK_SRC_PLL0, F_CPU); - * - * // Start the PLL for the USB Generic Clock module - * AVR32CLK_StartPLL(1, CLOCK_SRC_OSC0, 12000000, 48000000); - * } - * \endcode - * - * @{ - */ - -#ifndef _UC3_CLOCK_MANAGEMENT_H_ -#define _UC3_CLOCK_MANAGEMENT_H_ - - /* Includes: */ - #include "../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Enum for the possible external oscillator types. */ - enum UC3_Extern_OSC_ClockTypes_t - { - EXOSC_MODE_CLOCK = AVR32_PM_OSCCTRL0_MODE_EXT_CLOCK, /**< External clock (non-crystal) mode. */ - EXOSC_MODE_900KHZ_MAX = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G0, /**< External crystal oscillator equal to or slower than 900KHz. */ - EXOSC_MODE_3MHZ_MAX = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G1, /**< External crystal oscillator equal to or slower than 3MHz. */ - EXOSC_MODE_8MHZ_MAX = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G2, /**< External crystal oscillator equal to or slower than 8MHz. */ - EXOSC_MODE_8MHZ_OR_MORE = AVR32_PM_OSCCTRL0_MODE_CRYSTAL_G3, /**< External crystal oscillator equal to or faster than 8MHz. */ - }; - - /** Enum for the possible external oscillator startup times. */ - enum UC3_Extern_OSC_ClockStartup_t - { - EXOSC_START_0CLK = AVR32_PM_OSCCTRL0_STARTUP_0_RCOSC, /**< Immediate startup, no delay. */ - EXOSC_START_64CLK = AVR32_PM_OSCCTRL0_STARTUP_64_RCOSC, /**< Wait 64 clock cycles before startup for stability. */ - EXOSC_START_128CLK = AVR32_PM_OSCCTRL0_STARTUP_128_RCOSC, /**< Wait 128 clock cycles before startup for stability. */ - EXOSC_START_2048CLK = AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC, /**< Wait 2048 clock cycles before startup for stability. */ - EXOSC_START_4096CLK = AVR32_PM_OSCCTRL0_STARTUP_4096_RCOSC, /**< Wait 4096 clock cycles before startup for stability. */ - EXOSC_START_8192CLK = AVR32_PM_OSCCTRL0_STARTUP_8192_RCOSC, /**< Wait 8192 clock cycles before startup for stability. */ - EXOSC_START_16384CLK = AVR32_PM_OSCCTRL0_STARTUP_16384_RCOSC, /**< Wait 16384 clock cycles before startup for stability. */ - }; - - /** Enum for the possible module clock sources. */ - enum UC3_System_ClockSource_t - { - CLOCK_SRC_SLOW_CLK = 0, /**< Clock sourced from the internal slow clock. */ - CLOCK_SRC_OSC0 = 1, /**< Clock sourced from the Oscillator 0 clock. */ - CLOCK_SRC_OSC1 = 2, /**< Clock sourced from the Oscillator 1 clock. */ - CLOCK_SRC_PLL0 = 3, /**< Clock sourced from the PLL 0 clock. */ - CLOCK_SRC_PLL1 = 4, /**< Clock sourced from the PLL 1 clock. */ - }; - - /* Inline Functions: */ - /** Starts the given external oscillator of the UC3 microcontroller, with the given options. This routine blocks until - * the oscillator is ready for use. - * - * \param[in] Channel Index of the external oscillator to start. - * \param[in] Type Type of clock attached to the given oscillator channel, a value from \ref UC3_Extern_OSC_ClockTypes_t. - * \param[in] Startup Statup time of the external oscillator, a value from \ref UC3_Extern_OSC_ClockStartup_t. - * - * \return Boolean \c true if the external oscillator was successfully started, \c false if invalid parameters specified. - */ - static inline bool AVR32CLK_StartExternalOscillator(const uint8_t Channel, - const uint8_t Type, - const uint8_t Startup) ATTR_ALWAYS_INLINE; - static inline bool AVR32CLK_StartExternalOscillator(const uint8_t Channel, - const uint8_t Type, - const uint8_t Startup) - { - switch (Channel) - { - case 0: - AVR32_PM.OSCCTRL0.startup = Startup; - AVR32_PM.OSCCTRL0.mode = Type; - break; - case 1: - AVR32_PM.OSCCTRL1.startup = Startup; - AVR32_PM.OSCCTRL1.mode = Type; - break; - default: - return false; - } - - AVR32_PM.mcctrl |= (1 << (AVR32_PM_MCCTRL_OSC0EN_OFFSET + Channel)); - - while (!(AVR32_PM.poscsr & (1 << (AVR32_PM_POSCSR_OSC0RDY_OFFSET + Channel)))); - return true; - } - - /** Stops the given external oscillator of the UC3 microcontroller. - * - * \param[in] Channel Index of the external oscillator to stop. - */ - static inline void AVR32CLK_StopExternalOscillator(const uint8_t Channel) ATTR_ALWAYS_INLINE; - static inline void AVR32CLK_StopExternalOscillator(const uint8_t Channel) - { - AVR32_PM.mcctrl &= ~(1 << (AVR32_PM_MCCTRL_OSC0EN_OFFSET + Channel)); - } - - /** Starts the given PLL of the UC3 microcontroller, with the given options. This routine blocks until the PLL is ready for use. - * - * \attention The output frequency must be equal to or greater than the source frequency. - * - * \param[in] Channel Index of the PLL to start. - * \param[in] Source Clock source for the PLL, a value from \ref UC3_System_ClockSource_t. - * \param[in] SourceFreq Frequency of the PLL's clock source, in Hz. - * \param[in] Frequency Target frequency of the PLL's output. - * - * \return Boolean \c true if the PLL was successfully started, \c false if invalid parameters specified. - */ - static inline bool AVR32CLK_StartPLL(const uint8_t Channel, - const uint8_t Source, - const uint32_t SourceFreq, - const uint32_t Frequency) ATTR_ALWAYS_INLINE; - static inline bool AVR32CLK_StartPLL(const uint8_t Channel, - const uint8_t Source, - const uint32_t SourceFreq, - const uint32_t Frequency) - { - if (SourceFreq > Frequency) - return false; - - switch (Source) - { - case CLOCK_SRC_OSC0: - AVR32_PM.PLL[Channel].pllosc = 0; - break; - case CLOCK_SRC_OSC1: - AVR32_PM.PLL[Channel].pllosc = 1; - break; - default: - return false; - } - - AVR32_PM.PLL[Channel].pllmul = (Frequency / SourceFreq) ? (((Frequency / SourceFreq) - 1) / 2) : 0; - AVR32_PM.PLL[Channel].plldiv = 0; - AVR32_PM.PLL[Channel].pllen = true; - - while (!(AVR32_PM.poscsr & (1 << (AVR32_PM_POSCSR_LOCK0_OFFSET + Channel)))); - return true; - } - - /** Stops the given PLL of the UC3 microcontroller. - * - * \param[in] Channel Index of the PLL to stop. - */ - static inline void AVR32CLK_StopPLL(const uint8_t Channel) ATTR_ALWAYS_INLINE; - static inline void AVR32CLK_StopPLL(const uint8_t Channel) - { - AVR32_PM.PLL[Channel].pllen = false; - } - - /** Starts the given Generic Clock of the UC3 microcontroller, with the given options. - * - * \param[in] Channel Index of the Generic Clock to start. - * \param[in] Source Clock source for the Generic Clock, a value from \ref UC3_System_ClockSource_t. - * \param[in] SourceFreq Frequency of the Generic Clock's clock source, in Hz. - * \param[in] Frequency Target frequency of the Generic Clock's output. - * - * \return Boolean \c true if the Generic Clock was successfully started, \c false if invalid parameters specified. - */ - static inline bool AVR32CLK_StartGenericClock(const uint8_t Channel, - const uint8_t Source, - const uint32_t SourceFreq, - const uint32_t Frequency) ATTR_ALWAYS_INLINE; - static inline bool AVR32CLK_StartGenericClock(const uint8_t Channel, - const uint8_t Source, - const uint32_t SourceFreq, - const uint32_t Frequency) - { - if (Channel >= AVR32_PM_GCLK_NUM) - return false; - - if (SourceFreq < Frequency) - return false; - - switch (Source) - { - case CLOCK_SRC_OSC0: - AVR32_PM.GCCTRL[Channel].pllsel = false; - AVR32_PM.GCCTRL[Channel].oscsel = 0; - break; - case CLOCK_SRC_OSC1: - AVR32_PM.GCCTRL[Channel].pllsel = false; - AVR32_PM.GCCTRL[Channel].oscsel = 1; - break; - case CLOCK_SRC_PLL0: - AVR32_PM.GCCTRL[Channel].pllsel = true; - AVR32_PM.GCCTRL[Channel].oscsel = 0; - break; - case CLOCK_SRC_PLL1: - AVR32_PM.GCCTRL[Channel].pllsel = true; - AVR32_PM.GCCTRL[Channel].oscsel = 1; - break; - default: - return false; - } - - AVR32_PM.GCCTRL[Channel].diven = (SourceFreq > Frequency) ? true : false; - AVR32_PM.GCCTRL[Channel].div = (((SourceFreq / Frequency) - 1) / 2); - AVR32_PM.GCCTRL[Channel].cen = true; - - return true; - } - - /** Stops the given generic clock of the UC3 microcontroller. - * - * \param[in] Channel Index of the generic clock to stop. - * - * \return Boolean \c true if the generic clock was sucessfully stopped, \c false if invalid parameters specified. - */ - static inline bool AVR32CLK_StopGenericClock(const uint8_t Channel) ATTR_ALWAYS_INLINE; - static inline bool AVR32CLK_StopGenericClock(const uint8_t Channel) - { - if (Channel >= AVR32_PM_GCLK_NUM) - return false; - - AVR32_PM.GCCTRL[Channel].cen = false; - - return true; - } - - /** Sets the clock source for the main microcontroller core. The given clock source should be configured - * and ready for use before this function is called. - * - * This function will configure the FLASH controller's wait states automatically to suit the given clock source. - * - * \param[in] Source Clock source for the CPU core, a value from \ref UC3_System_ClockSource_t. - * \param[in] SourceFreq Frequency of the CPU core's clock source, in Hz. - * - * \return Boolean \c true if the CPU core clock was sucessfully altered, \c false if invalid parameters specified. - */ - static inline bool AVR32CLK_SetCPUClockSource(const uint8_t Source, - const uint32_t SourceFreq) ATTR_ALWAYS_INLINE; - static inline bool AVR32CLK_SetCPUClockSource(const uint8_t Source, - const uint32_t SourceFreq) - { - if (SourceFreq > AVR32_PM_CPU_MAX_FREQ) - return false; - - AVR32_FLASHC.FCR.fws = (SourceFreq > AVR32_FLASHC_FWS_0_MAX_FREQ) ? true : false; - - switch (Source) - { - #if defined(AVR32_PM_MCCTRL_MCSEL_SLOW) - case CLOCK_SRC_SLOW_CLK: - AVR32_PM.MCCTRL.mcsel = AVR32_PM_MCCTRL_MCSEL_SLOW; - break; - #endif - #if defined(AVR32_PM_MCCTRL_MCSEL_OSC0) - case CLOCK_SRC_OSC0: - AVR32_PM.MCCTRL.mcsel = AVR32_PM_MCCTRL_MCSEL_OSC0; - break; - #endif - #if defined(AVR32_PM_MCCTRL_MCSEL_PLL0) - case CLOCK_SRC_PLL0: - AVR32_PM.MCCTRL.mcsel = AVR32_PM_MCCTRL_MCSEL_PLL0; - break; - #endif - default: - return false; - } - - return true; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S b/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S deleted file mode 100644 index 1666323e5f..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S +++ /dev/null @@ -1,128 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2011. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#if defined(__AVR32__) -#include - -.section .exception_handlers, "ax", @progbits - -// ================= EXCEPTION TABLE ================ -.balign 0x200 -.global EVBA_Table -EVBA_Table: - -.org 0x000 -Exception_Unrecoverable_Exception: - rjmp $ -.org 0x004 -Exception_TLB_Multiple_Hit: - rjmp $ -.org 0x008 -Exception_Bus_Error_Data_Fetch: - rjmp $ -.org 0x00C -Exception_Bus_Error_Instruction_Fetch: - rjmp $ -.org 0x010 -Exception_NMI: - rjmp $ -.org 0x014 -Exception_Instruction_Address: - rjmp $ -.org 0x018 -Exception_ITLB_Protection: - rjmp $ -.org 0x01C -Exception_OCD_Breakpoint: - rjmp $ -.org 0x020 -Exception_Illegal_Opcode: - rjmp $ -.org 0x024 -Exception_Unimplemented_Instruction: - rjmp $ -.org 0x028 -Exception_Privilege_Violation: - rjmp $ -.org 0x02C -Exception_Floating_Point: - rjmp $ -.org 0x030 -Exception_Coprocessor_Absent: - rjmp $ -.org 0x034 -Exception_Data_Address_Read: - rjmp $ -.org 0x038 -Exception_Data_Address_Write: - rjmp $ -.org 0x03C -Exception_DTLB_Protection_Read: - rjmp $ -.org 0x040 -Exception_DTLB_Protection_Write: - rjmp $ -.org 0x044 -Exception_DTLB_Modified: - rjmp $ -.org 0x050 -Exception_ITLB_Miss: - rjmp $ -.org 0x060 -Exception_DTLB_Miss_Read: - rjmp $ -.org 0x070 -Exception_DTLB_Miss_Write: - rjmp $ -.org 0x100 -Exception_Supervisor_Call: - rjmp $ -// ============== END OF EXCEPTION TABLE ============= - -// ============= GENERAL INTERRUPT HANDLER =========== -.balign 4 -.irp Level, 0, 1, 2, 3 -Exception_INT\Level: - mov r12, \Level - call INTC_GetInterruptHandler - mov pc, r12 -.endr -// ========= END OF GENERAL INTERRUPT HANDLER ======== - -// ====== GENERAL INTERRUPT HANDLER OFFSET TABLE ====== -.balign 4 -.global Autovector_Table -Autovector_Table: -.irp Level, 0, 1, 2, 3 - .word ((AVR32_INTC_INT0 + \Level) << AVR32_INTC_IPR_INTLEVEL_OFFSET) | (Exception_INT\Level - EVBA_Table) -.endr -// === END OF GENERAL INTERRUPT HANDLER OFFSET TABLE === - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c b/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c deleted file mode 100644 index 84e16ba205..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "../../Common/Common.h" -#if (ARCH == ARCH_UC3) - -#define __INCLUDE_FROM_INTMANAGEMENT_C -#include "InterruptManagement.h" - -/** Interrupt vector table, containing the ISR to call for each interrupt group */ -InterruptHandlerPtr_t InterruptHandlers[AVR32_INTC_NUM_INT_GRPS]; - -/** ISR for unhandled interrupt groups */ -ISR(Unhandled_Interrupt) -{ - for (;;); -} - -/** Retrieves the associated interrupt handler for the interrupt group currently being fired. This - * is called directly from the exception handler routine before dispatching to the ISR. - */ -InterruptHandlerPtr_t INTC_GetInterruptHandler(const uint_reg_t InterruptLevel) -{ - return InterruptHandlers[AVR32_INTC.icr[AVR32_INTC_INT3 - InterruptLevel]]; -} - -/** Initializes the interrupt controller ready to handle interrupts. This must be called at the - * start of the user program before any interrupts are registered or enabled. - */ -void INTC_Init(void) -{ - for (uint8_t InterruptGroup = 0; InterruptGroup < AVR32_INTC_NUM_INT_GRPS; InterruptGroup++) - { - InterruptHandlers[InterruptGroup] = Unhandled_Interrupt; - AVR32_INTC.ipr[InterruptGroup] = Autovector_Table[AVR32_INTC_INT0]; - } - - __builtin_mtsr(AVR32_EVBA, (uintptr_t)&EVBA_Table); -} - -#endif diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h b/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h deleted file mode 100644 index b0e1e3ec1e..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Interrupt Controller Driver for the AVR32 UC3 microcontrollers. - * - * Interrupt controller driver for the AVR32 UC3 microcontrollers, for the configuration of interrupt - * handlers within the device. - */ - -/** \ingroup Group_PlatformDrivers_UC3 - * \defgroup Group_PlatformDrivers_UC3Interrupts Interrupt Controller Driver - LUFA/Platform/UC3/InterruptManagement.h - * \brief Interrupt Controller Driver for the AVR32 UC3 microcontrollers. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM) - * - LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM) - * - * \section Sec_ModDescription Module Description - * Interrupt controller driver for the AVR32 UC3 microcontrollers, for the configuration of interrupt - * handlers within the device. - * - * Usage Example: - * \code - * #include - * - * ISR(USB_Group_IRQ_Handler) - * { - * // USB group handler code here - * } - * - * void main(void) - * { - * INTC_Init(); - * INTC_RegisterGroupHandler(INTC_IRQ_GROUP(AVR32_USBB_IRQ), AVR32_INTC_INT0, USB_Group_IRQ_Handler); - * } - * \endcode - * - * @{ - */ - -#ifndef _UC3_INTERRUPT_MANAGEMENT_H_ -#define _UC3_INTERRUPT_MANAGEMENT_H_ - - /* Includes: */ - #include "../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Private Interface - For use in library only: */ - #if !defined(__DOXYGEN__) - /* Type Defines: */ - typedef void (*InterruptHandlerPtr_t)(void); - - /* External Variables: */ - #if defined(__INCLUDE_FROM_INTMANAGEMENT_C) - extern const void EVBA_Table; - #endif - extern InterruptHandlerPtr_t InterruptHandlers[AVR32_INTC_NUM_INT_GRPS]; - extern const uint32_t Autovector_Table[]; - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Converts a given interrupt index into its associated interrupt group. - * - * \param[in] IRQIndex Index of the interrupt request to convert. - * - * \return Interrupt group number associated with the interrupt index. - */ - #define INTC_IRQ_GROUP(IRQIndex) (IRQIndex / 32) - - /** Converts a given interrupt index into its associated interrupt line. - * - * \param[in] IRQIndex Index of the interrupt request to convert. - * - * \return Interrupt line number associated with the interrupt index. - */ - #define INTC_IRQ_LINE(IRQIndex) (IRQIndex % 32) - - /* Function Prototypes: */ - void INTC_Init(void); - InterruptHandlerPtr_t INTC_GetInterruptHandler(const uint_reg_t InterruptLevel); - - /* Inline Functions: */ - /** Registers a handler for a given interrupt group. On the AVR32 UC3 devices, interrupts are grouped by - * peripheral. To save on SRAM used, a single ISR handles all interrupt lines within a single group - to - * determine the exact line that has interrupted within the group ISR handler, use \ref INTC_GetGroupInterrupts(). - * - * If multiple interrupts with the same group are registered, the last registered handler will become the - * handler called for interrupts raised within that group. - * - * To obtain the group number of a specific interrupt index, use the \ref INTC_IRQ_GROUP() macro. - * - * \param[in] GroupNumber Group number of the interrupt group to register a handler for. - * \param[in] InterruptLevel Priority level for the specified interrupt, a \c AVR32_INTC_INT* mask. - * \param[in] Handler Address of the ISR handler for the interrupt group. - */ - static inline void INTC_RegisterGroupHandler(const uint16_t GroupNumber, - const uint8_t InterruptLevel, - const InterruptHandlerPtr_t Handler) ATTR_ALWAYS_INLINE; - static inline void INTC_RegisterGroupHandler(const uint16_t GroupNumber, - const uint8_t InterruptLevel, - const InterruptHandlerPtr_t Handler) - { - InterruptHandlers[GroupNumber] = Handler; - AVR32_INTC.ipr[GroupNumber] = Autovector_Table[InterruptLevel]; - } - - /** Retrieves the pending interrupts for a given interrupt group. The result of this function should be masked - * against interrupt request indexes converted to a request line number via the \ref INTC_IRQ_LINE() macro. To - * obtain the group number of a given interrupt request, use the \ref INTC_IRQ_GROUP() macro. - * - * \param[in] GroupNumber Group number of the interrupt group to check. - * - * \return Mask of pending interrupt lines for the given interrupt group. - */ - static inline uint_reg_t INTC_GetGroupInterrupts(const uint16_t GroupNumber) ATTR_ALWAYS_INLINE; - static inline uint_reg_t INTC_GetGroupInterrupts(const uint16_t GroupNumber) - { - return AVR32_INTC.irr[GroupNumber]; - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h b/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h deleted file mode 100644 index cd9c5f49e3..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h +++ /dev/null @@ -1,397 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * \brief Module Clock Driver for the AVR USB XMEGA microcontrollers. - * - * Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration - * of the various clocks within the device to clock the various peripherals. - */ - -/** \ingroup Group_PlatformDrivers_XMEGA - * \defgroup Group_PlatformDrivers_XMEGAClocks Clock Management Driver - LUFA/Platform/XMEGA/ClockManagement.h - * \brief Module Clock Driver for the AVR USB XMEGA microcontrollers. - * - * \section Sec_Dependencies Module Source Dependencies - * The following files must be built with any user project that uses this module: - * - None - * - * \section Sec_ModDescription Module Description - * Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration - * of the various clocks within the device to clock the various peripherals. - * - * Usage Example: - * \code - * #include - * - * void main(void) - * { - * // Start the PLL to multiply the 2MHz RC oscillator to F_CPU and switch the CPU core to run from it - * XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU); - * XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL); - * - * // Start the 32MHz internal RC oscillator and start the DFLL to increase it to F_USB using the USB SOF as a reference - * XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); - * XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB); - * } - * \endcode - * - * @{ - */ - -#ifndef _XMEGA_CLOCK_MANAGEMENT_H_ -#define _XMEGA_CLOCK_MANAGEMENT_H_ - - /* Includes: */ - #include "../../Common/Common.h" - - /* Enable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - extern "C" { - #endif - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Enum for the possible external oscillator frequency ranges. */ - enum XMEGA_Extern_OSC_ClockFrequency_t - { - EXOSC_FREQ_2MHZ_MAX = OSC_FRQRANGE_04TO2_gc, /**< External crystal oscillator equal to or slower than 2MHz. */ - EXOSC_FREQ_9MHZ_MAX = OSC_FRQRANGE_2TO9_gc, /**< External crystal oscillator equal to or slower than 9MHz. */ - EXOSC_FREQ_12MHZ_MAX = OSC_FRQRANGE_9TO12_gc, /**< External crystal oscillator equal to or slower than 12MHz. */ - EXOSC_FREQ_16MHZ_MAX = OSC_FRQRANGE_12TO16_gc, /**< External crystal oscillator equal to or slower than 16MHz. */ - }; - - /** Enum for the possible external oscillator startup times. */ - enum XMEGA_Extern_OSC_ClockStartup_t - { - EXOSC_START_6CLK = OSC_XOSCSEL_EXTCLK_gc, /**< Wait 6 clock cycles before startup (external clock). */ - EXOSC_START_32KCLK = OSC_XOSCSEL_32KHz_gc, /**< Wait 32K clock cycles before startup (32.768KHz crystal). */ - EXOSC_START_256CLK = OSC_XOSCSEL_XTAL_256CLK_gc, /**< Wait 256 clock cycles before startup. */ - EXOSC_START_1KCLK = OSC_XOSCSEL_XTAL_1KCLK_gc, /**< Wait 1K clock cycles before startup. */ - EXOSC_START_16KCLK = OSC_XOSCSEL_XTAL_16KCLK_gc, /**< Wait 16K clock cycles before startup. */ - }; - - /** Enum for the possible module clock sources. */ - enum XMEGA_System_ClockSource_t - { - CLOCK_SRC_INT_RC2MHZ = 0, /**< Clock sourced from the Internal 2MHz RC Oscillator clock. */ - CLOCK_SRC_INT_RC32MHZ = 1, /**< Clock sourced from the Internal 32MHz RC Oscillator clock. */ - CLOCK_SRC_INT_RC32KHZ = 2, /**< Clock sourced from the Internal 32KHz RC Oscillator clock. */ - CLOCK_SRC_XOSC = 3, /**< Clock sourced from the External Oscillator clock. */ - CLOCK_SRC_PLL = 4, /**< Clock sourced from the Internal PLL clock. */ - }; - - /** Enum for the possible DFLL clock reference sources. */ - enum XMEGA_System_DFLLReference_t - { - DFLL_REF_INT_RC32KHZ = 0, /**< Reference clock sourced from the Internal 32KHz RC Oscillator clock. */ - DFLL_REF_EXT_RC32KHZ = 1, /**< Reference clock sourced from the External 32KHz RC Oscillator clock connected to TOSC pins. */ - DFLL_REF_INT_USBSOF = 2, /**< Reference clock sourced from the USB Start Of Frame packets. */ - }; - - /* Inline Functions: */ - /** Write a value to a location protected by the XMEGA CCP protection mechanism. This function uses inline assembly to ensure that - * the protected address is written to within four clock cycles of the CCP key being written. - * - * \param[in] Address Address to write to, a memory address protected by the CCP mechanism - * \param[in] Value Value to write to the protected location - */ - static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_ALWAYS_INLINE; - static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) - { - __asm__ __volatile__ ( - "out %0, __zero_reg__" "\n\t" /* Zero RAMPZ using fixed zero value register */ - "movw r30, %1" "\n\t" /* Copy address to Z register pair */ - "out %2, %3" "\n\t" /* Write key to CCP register */ - "st Z, %4" "\n\t" /* Indirectly write value to address */ - : /* No output operands */ - : /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value) - : /* Clobbered registers: */ "r30", "r31" - ); - } - - /** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until - * the oscillator is ready for use. - * - * \param[in] FreqRange Frequency range of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockFrequency_t. - * \param[in] Startup Startup time of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockStartup_t. - * - * \return Boolean \c true if the external oscillator was successfully started, \c false if invalid parameters specified. - */ - static inline bool XMEGACLK_StartExternalOscillator(const uint8_t FreqRange, - const uint8_t Startup) ATTR_ALWAYS_INLINE; - static inline bool XMEGACLK_StartExternalOscillator(const uint8_t FreqRange, - const uint8_t Startup) - { - OSC.XOSCCTRL = (FreqRange | ((Startup == EXOSC_START_32KCLK) ? OSC_X32KLPM_bm : 0) | Startup); - OSC.CTRL |= OSC_XOSCEN_bm; - - while (!(OSC.STATUS & OSC_XOSCRDY_bm)); - return true; - } - - /** Stops the external oscillator of the XMEGA microcontroller. */ - static inline void XMEGACLK_StopExternalOscillator(void) ATTR_ALWAYS_INLINE; - static inline void XMEGACLK_StopExternalOscillator(void) - { - OSC.CTRL &= ~OSC_XOSCEN_bm; - } - - /** Starts the given internal oscillator of the XMEGA microcontroller, with the given options. This routine blocks until - * the oscillator is ready for use. - * - * \param[in] Source Internal oscillator to start, a value from \ref XMEGA_System_ClockSource_t. - * - * \return Boolean \c true if the internal oscillator was successfully started, \c false if invalid parameters specified. - */ - static inline uint8_t XMEGACLK_StartInternalOscillator(const uint8_t Source) ATTR_ALWAYS_INLINE; - static inline uint8_t XMEGACLK_StartInternalOscillator(const uint8_t Source) - { - switch (Source) - { - case CLOCK_SRC_INT_RC2MHZ: - OSC.CTRL |= OSC_RC2MEN_bm; - while (!(OSC.STATUS & OSC_RC2MRDY_bm)); - return true; - case CLOCK_SRC_INT_RC32MHZ: - OSC.CTRL |= OSC_RC32MEN_bm; - while (!(OSC.STATUS & OSC_RC32MRDY_bm)); - return true; - case CLOCK_SRC_INT_RC32KHZ: - OSC.CTRL |= OSC_RC32KEN_bm; - while (!(OSC.STATUS & OSC_RC32KRDY_bm)); - return true; - } - - return false; - } - - /** Stops the given internal oscillator of the XMEGA microcontroller. - * - * \param[in] Source Internal oscillator to stop, a value from \ref XMEGA_System_ClockSource_t. - * - * \return Boolean \c true if the internal oscillator was successfully stopped, \c false if invalid parameters specified. - */ - static inline bool XMEGACLK_StopInternalOscillator(const uint8_t Source) ATTR_ALWAYS_INLINE; - static inline bool XMEGACLK_StopInternalOscillator(const uint8_t Source) - { - switch (Source) - { - case CLOCK_SRC_INT_RC2MHZ: - OSC.CTRL &= ~OSC_RC2MEN_bm; - return true; - case CLOCK_SRC_INT_RC32MHZ: - OSC.CTRL &= ~OSC_RC32MEN_bm; - return true; - case CLOCK_SRC_INT_RC32KHZ: - OSC.CTRL &= ~OSC_RC32KEN_bm; - return true; - } - - return false; - } - - /** Starts the PLL of the XMEGA microcontroller, with the given options. This routine blocks until the PLL is ready for use. - * - * \attention The output frequency must be equal to or greater than the source frequency. - * - * \param[in] Source Clock source for the PLL, a value from \ref XMEGA_System_ClockSource_t. - * \param[in] SourceFreq Frequency of the PLL's clock source, in Hz. - * \param[in] Frequency Target frequency of the PLL's output. - * - * \return Boolean \c true if the PLL was successfully started, \c false if invalid parameters specified. - */ - static inline bool XMEGACLK_StartPLL(const uint8_t Source, - const uint32_t SourceFreq, - const uint32_t Frequency) ATTR_ALWAYS_INLINE; - static inline bool XMEGACLK_StartPLL(const uint8_t Source, - const uint32_t SourceFreq, - const uint32_t Frequency) - { - uint8_t MulFactor = (Frequency / SourceFreq); - - if (SourceFreq > Frequency) - return false; - - if (MulFactor > 31) - return false; - - switch (Source) - { - case CLOCK_SRC_INT_RC2MHZ: - OSC.PLLCTRL = (OSC_PLLSRC_RC2M_gc | MulFactor); - break; - case CLOCK_SRC_INT_RC32MHZ: - OSC.PLLCTRL = (OSC_PLLSRC_RC32M_gc | MulFactor); - break; - case CLOCK_SRC_XOSC: - OSC.PLLCTRL = (OSC_PLLSRC_XOSC_gc | MulFactor); - break; - default: - return false; - } - - OSC.CTRL |= OSC_PLLEN_bm; - - while (!(OSC.STATUS & OSC_PLLRDY_bm)); - return true; - } - - /** Stops the PLL of the XMEGA microcontroller. */ - static inline void XMEGACLK_StopPLL(void) ATTR_ALWAYS_INLINE; - static inline void XMEGACLK_StopPLL(void) - { - OSC.CTRL &= ~OSC_PLLEN_bm; - } - - /** Starts the DFLL of the XMEGA microcontroller, with the given options. - * - * \param[in] Source RC Clock source for the DFLL, a value from \ref XMEGA_System_ClockSource_t. - * \param[in] Reference Reference clock source for the DFLL, an value from \ref XMEGA_System_DFLLReference_t. - * \param[in] Frequency Target frequency of the DFLL's output. - * - * \return Boolean \c true if the DFLL was successfully started, \c false if invalid parameters specified. - */ - static inline bool XMEGACLK_StartDFLL(const uint8_t Source, - const uint8_t Reference, - const uint32_t Frequency) ATTR_ALWAYS_INLINE; - static inline bool XMEGACLK_StartDFLL(const uint8_t Source, - const uint8_t Reference, - const uint32_t Frequency) - { - uint16_t DFLLCompare = (Frequency / 1000); - - switch (Source) - { - case CLOCK_SRC_INT_RC2MHZ: - OSC.DFLLCTRL |= (Reference << OSC_RC2MCREF_bp); - DFLLRC2M.COMP1 = (DFLLCompare & 0xFF); - DFLLRC2M.COMP2 = (DFLLCompare >> 8); - DFLLRC2M.CTRL = DFLL_ENABLE_bm; - break; - case CLOCK_SRC_INT_RC32MHZ: - OSC.DFLLCTRL |= (Reference << OSC_RC32MCREF_gp); - DFLLRC32M.COMP1 = (DFLLCompare & 0xFF); - DFLLRC32M.COMP2 = (DFLLCompare >> 8); - - if (Reference == DFLL_REF_INT_USBSOF) - { - NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; - DFLLRC32M.CALA = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBRCOSCA)); - DFLLRC32M.CALB = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBRCOSC)); - NVM.CMD = 0; - } - - DFLLRC32M.CTRL = DFLL_ENABLE_bm; - break; - default: - return false; - } - - return true; - } - - /** Stops the given DFLL of the XMEGA microcontroller. - * - * \param[in] Source RC Clock source for the DFLL to be stopped, a value from \ref XMEGA_System_ClockSource_t. - * - * \return Boolean \c true if the DFLL was successfully stopped, \c false if invalid parameters specified. - */ - static inline bool XMEGACLK_StopDFLL(const uint8_t Source) ATTR_ALWAYS_INLINE; - static inline bool XMEGACLK_StopDFLL(const uint8_t Source) - { - switch (Source) - { - case CLOCK_SRC_INT_RC2MHZ: - DFLLRC2M.CTRL = 0; - break; - case CLOCK_SRC_INT_RC32MHZ: - DFLLRC32M.CTRL = 0; - break; - default: - return false; - } - - return true; - } - - /** Sets the clock source for the main microcontroller core. The given clock source should be configured - * and ready for use before this function is called. - * - * \param[in] Source Clock source for the CPU core, a value from \ref XMEGA_System_ClockSource_t. - * - * \return Boolean \c true if the CPU core clock was successfully altered, \c false if invalid parameters specified. - */ - static inline bool XMEGACLK_SetCPUClockSource(const uint8_t Source) ATTR_ALWAYS_INLINE; - static inline bool XMEGACLK_SetCPUClockSource(const uint8_t Source) - { - uint8_t ClockSourceMask = 0; - - switch (Source) - { - case CLOCK_SRC_INT_RC2MHZ: - ClockSourceMask = CLK_SCLKSEL_RC2M_gc; - break; - case CLOCK_SRC_INT_RC32MHZ: - ClockSourceMask = CLK_SCLKSEL_RC32M_gc; - break; - case CLOCK_SRC_INT_RC32KHZ: - ClockSourceMask = CLK_SCLKSEL_RC32K_gc; - break; - case CLOCK_SRC_XOSC: - ClockSourceMask = CLK_SCLKSEL_XOSC_gc; - break; - case CLOCK_SRC_PLL: - ClockSourceMask = CLK_SCLKSEL_PLL_gc; - break; - default: - return false; - } - - uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); - GlobalInterruptDisable(); - - XMEGACLK_CCP_Write(&CLK.CTRL, ClockSourceMask); - - SetGlobalInterruptMask(CurrentGlobalInt); - - Delay_MS(1); - return (CLK.CTRL == ClockSourceMask); - } - - /* Disable C linkage for C++ Compilers: */ - #if defined(__cplusplus) - } - #endif - -#endif - -/** @} */ - diff --git a/protocol/lufa/LUFA-120730/LUFA/Version.h b/protocol/lufa/LUFA-120730/LUFA/Version.h deleted file mode 100644 index 29b5020f6d..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/Version.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * \brief LUFA library version constants. - * - * Version constants for informational purposes and version-specific macro creation. This header file contains the - * current LUFA version number in several forms, for use in the user-application (for example, for printing out - * whilst debugging, or for testing for version compatibility). - */ - -#ifndef __LUFA_VERSION_H__ -#define __LUFA_VERSION_H__ - - /* Public Interface - May be used in end-application: */ - /* Macros: */ - /** Indicates the version number of the library, as an integer. */ - #define LUFA_VERSION_INTEGER 0x120730 - - /** Indicates the version number of the library, as a string. */ - #define LUFA_VERSION_STRING "120730" - -#endif - diff --git a/protocol/lufa/LUFA-120730/LUFA/makefile b/protocol/lufa/LUFA-120730/LUFA/makefile deleted file mode 100644 index fcf46bf687..0000000000 --- a/protocol/lufa/LUFA-120730/LUFA/makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# LUFA Library -# Copyright (C) Dean Camera, 2012. -# -# dean [at] fourwalledcubicle [dot] com -# www.lufa-lib.org -# -# --------------------------------------- -# Makefile for the LUFA library itself. -# --------------------------------------- - -LUFA_VERSION_NUM := $(shell grep LUFA_VERSION_STRING Version.h | cut -d'"' -f2) -EXCLUDE_FROM_EXPORT := Documentation DoxygenPages CodeTemplates Build *.conf *.tar *.o *.d *.lss *.lst *.hex *.elf *.hex *.eep *.map *.bin - -all: - -export_tar: - @echo Exporting LUFA library to a TAR archive... - @tar -cf LUFA_$(LUFA_VERSION_NUM).tar --directory=. $(EXCLUDE_FROM_EXPORT:%=--exclude=%) * - @tar -cf LUFA_$(LUFA_VERSION_NUM)_Code_Templates.tar CodeTemplates - @echo Export LUFA_$(LUFA_VERSION_NUM).tar complete. - -version: - @echo "LUFA $(LUFA_VERSION_NUM)" - -# Check if this is being included from a legacy or non LUFA build system makefile -ifneq ($(LUFA_PATH),) - LUFA_ROOT_PATH = $(patsubst %/,%,$(LUFA_PATH))/LUFA/ - - include $(patsubst %/,%,$(LUFA_PATH))/LUFA/Build/lufa.sources.in -else - LUFA_BUILD_MODULES += MASTER - LUFA_BUILD_TARGETS += export_tar version - - LUFA_PATH = . - ARCH = {AVR8,UC3,XMEGA} - DOXYGEN_OVERRIDE_PARAMS = QUIET=YES PROJECT_NUMBER=$(LUFA_VERSION_NUM) - - clean: - rm -f $(LUFA_SRC_ALL_FILES:%.c=%.o) - rm -f $(LUFA_SRC_ALL_FILES:%.c=%.d) - rm -f $(LUFA_SRC_ALL_FILES:%.c=%.lst) - - include Build/lufa_core.mk - include Build/lufa_sources.mk - include Build/lufa_doxygen.mk -endif - - -.PHONY: all export_tar version clean \ No newline at end of file diff --git a/protocol/lufa/LUFA-120730/README.txt b/protocol/lufa/LUFA-120730/README.txt deleted file mode 100644 index aacb4af9ae..0000000000 --- a/protocol/lufa/LUFA-120730/README.txt +++ /dev/null @@ -1,56 +0,0 @@ - - _ _ _ ___ _ - | | | | | __/ \ - | |_| U | _| o | - The Lightweight USB - |___|___|_||_n_| Framework for AVRs - ========================================= - Written by Dean Camera - dean [at] fourwalledcubicle [dot] com - - http://www.lufa-lib.org - ========================================= - - LUFA is donation supported. To support LUFA, - please donate at http://www.lufa-lib.org/donate - - Released under a modified MIT license - see - LUFA/License.txt for license details. - - For Commercial Licensing information, see - http://www.lufa-lib.org/license - - -This package contains the complete LUFA library, demos, user-submitted -projects and bootloaders for use with compatible microcontroller models. -LUFA is a simple to use, lightweight framework which sits atop the hardware -USB controller in specific AVR microcontroller models, and allows for the -quick and easy creation of complex USB devices and hosts. - -To get started, you will need to install the "Doxygen" documentation -generation tool. If you use Linux, this can be installed via the "doxygen" -package in your chosen package management tool - under Ubuntu, this can be -achieved by running the following command in the terminal: - - sudo apt-get install doxygen - -Other package managers and distributions will have similar methods to -install Doxygen. In Windows, you can download a prebuilt installer for -Doxygen from its website, www.doxygen.org. - -Once installed, you can then use the Doxygen tool to generate the library -documentation from the command line or terminal of your operating system. To -do this, open your terminal or command line to the root directory of the -LUFA package, and type the following command: - - make doxygen - -Which will recursively generate documentation for all elements in the -library - the core, plus all demos, projects and bootloaders. Generated -documentation will then be available by opening the file "index.html" of the -created Documentation/html/ subdirectories inside each project folder. - -The documentation for the library itself (but not the documentation for the -individual demos, projects or bootloaders) is also available as a separate -package from the project webpage for convenience if Doxygen cannot be -installed. - diff --git a/protocol/lufa/LUFA-git b/protocol/lufa/LUFA-git deleted file mode 160000 index b6c18b2a7c..0000000000 --- a/protocol/lufa/LUFA-git +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b6c18b2a7c544653efbe12a1d4e8ba65e7d83c35 diff --git a/protocol/lufa/descriptor.c b/protocol/lufa/descriptor.c deleted file mode 100644 index c13a81bda8..0000000000 --- a/protocol/lufa/descriptor.c +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Copyright 2012 Jun Wako - * This file is based on: - * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse - * LUFA-120219/Demos/Device/Lowlevel/GenericHID - */ - -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "util.h" -#include "report.h" -#include "descriptor.h" - - -/******************************************************************************* - * HID Report Descriptors - ******************************************************************************/ -const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] = -{ - HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ - HID_RI_USAGE(8, 0x06), /* Keyboard */ - HID_RI_COLLECTION(8, 0x01), /* Application */ - HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */ - HID_RI_USAGE_MINIMUM(8, 0xE0), /* Keyboard Left Control */ - HID_RI_USAGE_MAXIMUM(8, 0xE7), /* Keyboard Right GUI */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0x01), - HID_RI_REPORT_COUNT(8, 0x08), - HID_RI_REPORT_SIZE(8, 0x01), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - - HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_INPUT(8, HID_IOF_CONSTANT), /* reserved */ - - HID_RI_USAGE_PAGE(8, 0x08), /* LEDs */ - HID_RI_USAGE_MINIMUM(8, 0x01), /* Num Lock */ - HID_RI_USAGE_MAXIMUM(8, 0x05), /* Kana */ - HID_RI_REPORT_COUNT(8, 0x05), - HID_RI_REPORT_SIZE(8, 0x01), - HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), - HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, 0x03), - HID_RI_OUTPUT(8, HID_IOF_CONSTANT), - - HID_RI_USAGE_PAGE(8, 0x07), /* Keyboard */ - HID_RI_USAGE_MINIMUM(8, 0x00), /* Reserved (no event indicated) */ - HID_RI_USAGE_MAXIMUM(8, 0xFF), /* Keyboard Application */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), - HID_RI_REPORT_COUNT(8, 0x06), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), - HID_RI_END_COLLECTION(0), -}; - -#ifdef MOUSE_ENABLE -const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] = -{ - HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ - HID_RI_USAGE(8, 0x02), /* Mouse */ - HID_RI_COLLECTION(8, 0x01), /* Application */ - HID_RI_USAGE(8, 0x01), /* Pointer */ - HID_RI_COLLECTION(8, 0x00), /* Physical */ - - HID_RI_USAGE_PAGE(8, 0x09), /* Button */ - HID_RI_USAGE_MINIMUM(8, 0x01), /* Button 1 */ - HID_RI_USAGE_MAXIMUM(8, 0x05), /* Button 5 */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0x01), - HID_RI_REPORT_COUNT(8, 0x05), - HID_RI_REPORT_SIZE(8, 0x01), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, 0x03), - HID_RI_INPUT(8, HID_IOF_CONSTANT), - - HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ - HID_RI_USAGE(8, 0x30), /* Usage X */ - HID_RI_USAGE(8, 0x31), /* Usage Y */ - HID_RI_LOGICAL_MINIMUM(8, -127), - HID_RI_LOGICAL_MAXIMUM(8, 127), - HID_RI_REPORT_COUNT(8, 0x02), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), - - HID_RI_USAGE(8, 0x38), /* Wheel */ - HID_RI_LOGICAL_MINIMUM(8, -127), - HID_RI_LOGICAL_MAXIMUM(8, 127), - HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), - - HID_RI_USAGE_PAGE(8, 0x0C), /* Consumer */ - HID_RI_USAGE(16, 0x0238), /* AC Pan (Horizontal wheel) */ - HID_RI_LOGICAL_MINIMUM(8, -127), - HID_RI_LOGICAL_MAXIMUM(8, 127), - HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_RELATIVE), - - HID_RI_END_COLLECTION(0), - HID_RI_END_COLLECTION(0), -}; -#endif - -#ifdef EXTRAKEY_ENABLE -const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] = -{ - HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ - HID_RI_USAGE(8, 0x80), /* System Control */ - HID_RI_COLLECTION(8, 0x01), /* Application */ - HID_RI_REPORT_ID(8, REPORT_ID_SYSTEM), - HID_RI_LOGICAL_MINIMUM(16, 0x0001), - HID_RI_LOGICAL_MAXIMUM(16, 0x00B7), - HID_RI_USAGE_MINIMUM(16, 0x0001), /* System Power Down */ - HID_RI_USAGE_MAXIMUM(16, 0x00B7), /* System Display LCD Autoscale */ - HID_RI_REPORT_SIZE(8, 16), - HID_RI_REPORT_COUNT(8, 1), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), - HID_RI_END_COLLECTION(0), - - HID_RI_USAGE_PAGE(8, 0x0C), /* Consumer */ - HID_RI_USAGE(8, 0x01), /* Consumer Control */ - HID_RI_COLLECTION(8, 0x01), /* Application */ - HID_RI_REPORT_ID(8, REPORT_ID_CONSUMER), - HID_RI_LOGICAL_MINIMUM(16, 0x0001), - HID_RI_LOGICAL_MAXIMUM(16, 0x029C), - HID_RI_USAGE_MINIMUM(16, 0x0001), /* +10 */ - HID_RI_USAGE_MAXIMUM(16, 0x029C), /* AC Distribute Vertically */ - HID_RI_REPORT_SIZE(8, 16), - HID_RI_REPORT_COUNT(8, 1), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), - HID_RI_END_COLLECTION(0), -}; -#endif - -#ifdef CONSOLE_ENABLE -const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = -{ - HID_RI_USAGE_PAGE(16, 0xFF31), /* Vendor Page(PJRC Teensy compatible) */ - HID_RI_USAGE(8, 0x74), /* Vendor Usage(PJRC Teensy compatible) */ - HID_RI_COLLECTION(8, 0x01), /* Application */ - HID_RI_USAGE(8, 0x75), /* Vendor Usage 0x75 */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), - HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - HID_RI_USAGE(8, 0x76), /* Vendor Usage 0x76 */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0xFF), - HID_RI_REPORT_COUNT(8, CONSOLE_EPSIZE), - HID_RI_REPORT_SIZE(8, 0x08), - HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), - HID_RI_END_COLLECTION(0), -}; -#endif - -#ifdef NKRO_ENABLE -const USB_Descriptor_HIDReport_Datatype_t PROGMEM NKROReport[] = -{ - HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */ - HID_RI_USAGE(8, 0x06), /* Keyboard */ - HID_RI_COLLECTION(8, 0x01), /* Application */ - HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */ - HID_RI_USAGE_MINIMUM(8, 0xE0), /* Keyboard Left Control */ - HID_RI_USAGE_MAXIMUM(8, 0xE7), /* Keyboard Right GUI */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0x01), - HID_RI_REPORT_COUNT(8, 0x08), - HID_RI_REPORT_SIZE(8, 0x01), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - - HID_RI_USAGE_PAGE(8, 0x08), /* LEDs */ - HID_RI_USAGE_MINIMUM(8, 0x01), /* Num Lock */ - HID_RI_USAGE_MAXIMUM(8, 0x05), /* Kana */ - HID_RI_REPORT_COUNT(8, 0x05), - HID_RI_REPORT_SIZE(8, 0x01), - HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), - HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, 0x03), - HID_RI_OUTPUT(8, HID_IOF_CONSTANT), - - HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */ - HID_RI_USAGE_MINIMUM(8, 0x00), /* Keyboard 0 */ - HID_RI_USAGE_MAXIMUM(8, (NKRO_EPSIZE-1)*8-1), /* Keyboard Right GUI */ - HID_RI_LOGICAL_MINIMUM(8, 0x00), - HID_RI_LOGICAL_MAXIMUM(8, 0x01), - HID_RI_REPORT_COUNT(8, (NKRO_EPSIZE-1)*8), - HID_RI_REPORT_SIZE(8, 0x01), - HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - HID_RI_END_COLLECTION(0), -}; -#endif - -/******************************************************************************* - * Device Descriptors - ******************************************************************************/ -const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = -{ - .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, - - .USBSpecification = VERSION_BCD(1,1,0), - .Class = USB_CSCP_NoDeviceClass, - .SubClass = USB_CSCP_NoDeviceSubclass, - .Protocol = USB_CSCP_NoDeviceProtocol, - - .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - - /* specified in config.h */ - .VendorID = VENDOR_ID, - .ProductID = PRODUCT_ID, - .ReleaseNumber = DEVICE_VER, - - .ManufacturerStrIndex = 0x01, - .ProductStrIndex = 0x02, - .SerialNumStrIndex = NO_DESCRIPTOR, - - .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS -}; - -/******************************************************************************* - * Configuration Descriptors - ******************************************************************************/ -const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = -{ - .Config = - { - .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), - .TotalInterfaces = TOTAL_INTERFACES, - - .ConfigurationNumber = 1, - .ConfigurationStrIndex = NO_DESCRIPTOR, - - .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_REMOTEWAKEUP), - - .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) - }, - - /* - * Keyboard - */ - .Keyboard_Interface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = KEYBOARD_INTERFACE, - .AlternateSetting = 0x00, - - .TotalEndpoints = 1, - - .Class = HID_CSCP_HIDClass, - .SubClass = HID_CSCP_BootSubclass, - .Protocol = HID_CSCP_KeyboardBootProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Keyboard_HID = - { - .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, - - .HIDSpec = VERSION_BCD(1,1,1), - .CountryCode = 0x00, - .TotalReportDescriptors = 1, - .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(KeyboardReport) - }, - - .Keyboard_INEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM), - .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = KEYBOARD_EPSIZE, - .PollingIntervalMS = 0x0A - }, - - /* - * Mouse - */ -#ifdef MOUSE_ENABLE - .Mouse_Interface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = MOUSE_INTERFACE, - .AlternateSetting = 0x00, - - .TotalEndpoints = 1, - - .Class = HID_CSCP_HIDClass, - .SubClass = HID_CSCP_BootSubclass, - .Protocol = HID_CSCP_MouseBootProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Mouse_HID = - { - .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, - - .HIDSpec = VERSION_BCD(1,1,1), - .CountryCode = 0x00, - .TotalReportDescriptors = 1, - .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(MouseReport) - }, - - .Mouse_INEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM), - .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MOUSE_EPSIZE, - .PollingIntervalMS = 0x0A - }, -#endif - - /* - * Extra - */ -#ifdef EXTRAKEY_ENABLE - .Extrakey_Interface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = EXTRAKEY_INTERFACE, - .AlternateSetting = 0x00, - - .TotalEndpoints = 1, - - .Class = HID_CSCP_HIDClass, - .SubClass = HID_CSCP_NonBootSubclass, - .Protocol = HID_CSCP_NonBootProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Extrakey_HID = - { - .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, - - .HIDSpec = VERSION_BCD(1,1,1), - .CountryCode = 0x00, - .TotalReportDescriptors = 1, - .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(ExtrakeyReport) - }, - - .Extrakey_INEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = (ENDPOINT_DIR_IN | EXTRAKEY_IN_EPNUM), - .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = EXTRAKEY_EPSIZE, - .PollingIntervalMS = 0x0A - }, -#endif - - /* - * Console - */ -#ifdef CONSOLE_ENABLE - .Console_Interface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = CONSOLE_INTERFACE, - .AlternateSetting = 0x00, - - .TotalEndpoints = 2, - - .Class = HID_CSCP_HIDClass, - .SubClass = HID_CSCP_NonBootSubclass, - .Protocol = HID_CSCP_NonBootProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .Console_HID = - { - .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, - - .HIDSpec = VERSION_BCD(1,1,1), - .CountryCode = 0x00, - .TotalReportDescriptors = 1, - .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(ConsoleReport) - }, - - .Console_INEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = (ENDPOINT_DIR_IN | CONSOLE_IN_EPNUM), - .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CONSOLE_EPSIZE, - .PollingIntervalMS = 0x01 - }, - - .Console_OUTEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = (ENDPOINT_DIR_OUT | CONSOLE_OUT_EPNUM), - .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CONSOLE_EPSIZE, - .PollingIntervalMS = 0x01 - }, -#endif - - /* - * NKRO - */ -#ifdef NKRO_ENABLE - .NKRO_Interface = - { - .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, - - .InterfaceNumber = NKRO_INTERFACE, - .AlternateSetting = 0x00, - - .TotalEndpoints = 1, - - .Class = HID_CSCP_HIDClass, - .SubClass = HID_CSCP_NonBootSubclass, - .Protocol = HID_CSCP_NonBootProtocol, - - .InterfaceStrIndex = NO_DESCRIPTOR - }, - - .NKRO_HID = - { - .Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, - - .HIDSpec = VERSION_BCD(1,1,1), - .CountryCode = 0x00, - .TotalReportDescriptors = 1, - .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(NKROReport) - }, - - .NKRO_INEndpoint = - { - .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, - - .EndpointAddress = (ENDPOINT_DIR_IN | NKRO_IN_EPNUM), - .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = NKRO_EPSIZE, - .PollingIntervalMS = 0x01 - }, -#endif -}; - - -/******************************************************************************* - * String Descriptors - ******************************************************************************/ -const USB_Descriptor_String_t PROGMEM LanguageString = -{ - .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, - - .UnicodeString = {LANGUAGE_ID_ENG} -}; - -const USB_Descriptor_String_t PROGMEM ManufacturerString = -{ - /* subtract 1 for null terminator */ - .Header = {.Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER))-1), .Type = DTYPE_String}, - - .UnicodeString = LSTR(MANUFACTURER) -}; - -const USB_Descriptor_String_t PROGMEM ProductString = -{ - /* subtract 1 for null terminator */ - .Header = {.Size = USB_STRING_LEN(sizeof(STR(PRODUCT))-1), .Type = DTYPE_String}, - - .UnicodeString = LSTR(PRODUCT) -}; - - -/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" - * documentation) by the application code so that the address and size of a requested descriptor can be given - * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function - * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the - * USB host. - */ -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint8_t wIndex, - const void** const DescriptorAddress) -{ - const uint8_t DescriptorType = (wValue >> 8); - const uint8_t DescriptorIndex = (wValue & 0xFF); - - const void* Address = NULL; - uint16_t Size = NO_DESCRIPTOR; - - switch (DescriptorType) - { - case DTYPE_Device: - Address = &DeviceDescriptor; - Size = sizeof(USB_Descriptor_Device_t); - break; - case DTYPE_Configuration: - Address = &ConfigurationDescriptor; - Size = sizeof(USB_Descriptor_Configuration_t); - break; - case DTYPE_String: - switch (DescriptorIndex ) - { - case 0x00: - Address = &LanguageString; - Size = pgm_read_byte(&LanguageString.Header.Size); - break; - case 0x01: - Address = &ManufacturerString; - Size = pgm_read_byte(&ManufacturerString.Header.Size); - break; - case 0x02: - Address = &ProductString; - Size = pgm_read_byte(&ProductString.Header.Size); - break; - } - break; - case HID_DTYPE_HID: - switch (wIndex) { - case KEYBOARD_INTERFACE: - Address = &ConfigurationDescriptor.Keyboard_HID; - Size = sizeof(USB_HID_Descriptor_HID_t); - break; -#ifdef MOUSE_ENABLE - case MOUSE_INTERFACE: - Address = &ConfigurationDescriptor.Mouse_HID; - Size = sizeof(USB_HID_Descriptor_HID_t); - break; -#endif -#ifdef EXTRAKEY_ENABLE - case EXTRAKEY_INTERFACE: - Address = &ConfigurationDescriptor.Extrakey_HID; - Size = sizeof(USB_HID_Descriptor_HID_t); - break; -#endif -#ifdef CONSOLE_ENABLE - case CONSOLE_INTERFACE: - Address = &ConfigurationDescriptor.Console_HID; - Size = sizeof(USB_HID_Descriptor_HID_t); - break; -#endif -#ifdef NKRO_ENABLE - case NKRO_INTERFACE: - Address = &ConfigurationDescriptor.NKRO_HID; - Size = sizeof(USB_HID_Descriptor_HID_t); - break; -#endif - } - break; - case HID_DTYPE_Report: - switch (wIndex) { - case KEYBOARD_INTERFACE: - Address = &KeyboardReport; - Size = sizeof(KeyboardReport); - break; -#ifdef MOUSE_ENABLE - case MOUSE_INTERFACE: - Address = &MouseReport; - Size = sizeof(MouseReport); - break; -#endif -#ifdef EXTRAKEY_ENABLE - case EXTRAKEY_INTERFACE: - Address = &ExtrakeyReport; - Size = sizeof(ExtrakeyReport); - break; -#endif -#ifdef CONSOLE_ENABLE - case CONSOLE_INTERFACE: - Address = &ConsoleReport; - Size = sizeof(ConsoleReport); - break; -#endif -#ifdef NKRO_ENABLE - case NKRO_INTERFACE: - Address = &NKROReport; - Size = sizeof(NKROReport); - break; -#endif - } - break; - } - - *DescriptorAddress = Address; - return Size; -} diff --git a/protocol/lufa/descriptor.h b/protocol/lufa/descriptor.h deleted file mode 100644 index 42af07917c..0000000000 --- a/protocol/lufa/descriptor.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2012,2013 Jun Wako - * This file is based on: - * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse - * LUFA-120219/Demos/Device/Lowlevel/GenericHID - */ - -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -/** \file - * - * Header file for Descriptors.c. - */ - -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ - -#include -#include - - -typedef struct -{ - USB_Descriptor_Configuration_Header_t Config; - - // Keyboard HID Interface - USB_Descriptor_Interface_t Keyboard_Interface; - USB_HID_Descriptor_HID_t Keyboard_HID; - USB_Descriptor_Endpoint_t Keyboard_INEndpoint; - -#ifdef MOUSE_ENABLE - // Mouse HID Interface - USB_Descriptor_Interface_t Mouse_Interface; - USB_HID_Descriptor_HID_t Mouse_HID; - USB_Descriptor_Endpoint_t Mouse_INEndpoint; -#endif - -#ifdef EXTRAKEY_ENABLE - // Extrakey HID Interface - USB_Descriptor_Interface_t Extrakey_Interface; - USB_HID_Descriptor_HID_t Extrakey_HID; - USB_Descriptor_Endpoint_t Extrakey_INEndpoint; -#endif - -#ifdef CONSOLE_ENABLE - // Console HID Interface - USB_Descriptor_Interface_t Console_Interface; - USB_HID_Descriptor_HID_t Console_HID; - USB_Descriptor_Endpoint_t Console_INEndpoint; - USB_Descriptor_Endpoint_t Console_OUTEndpoint; -#endif - -#ifdef NKRO_ENABLE - // NKRO HID Interface - USB_Descriptor_Interface_t NKRO_Interface; - USB_HID_Descriptor_HID_t NKRO_HID; - USB_Descriptor_Endpoint_t NKRO_INEndpoint; -#endif -} USB_Descriptor_Configuration_t; - - -/* index of interface */ -#define KEYBOARD_INTERFACE 0 - -#ifdef MOUSE_ENABLE -# define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1) -#else -# define MOUSE_INTERFACE KEYBOARD_INTERFACE -#endif - -#ifdef EXTRAKEY_ENABLE -# define EXTRAKEY_INTERFACE (MOUSE_INTERFACE + 1) -#else -# define EXTRAKEY_INTERFACE MOUSE_INTERFACE -#endif - -#ifdef CONSOLE_ENABLE -# define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1) -#else -# define CONSOLE_INTERFACE EXTRAKEY_INTERFACE -#endif - -#ifdef NKRO_ENABLE -# define NKRO_INTERFACE (CONSOLE_INTERFACE + 1) -#else -# define NKRO_INTERFACE CONSOLE_INTERFACE -#endif - - -/* nubmer of interfaces */ -#define TOTAL_INTERFACES (NKRO_INTERFACE + 1) - - -// Endopoint number and size -#define KEYBOARD_IN_EPNUM 1 - -#ifdef MOUSE_ENABLE -# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) -#else -# define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM -#endif - -#ifdef EXTRAKEY_ENABLE -# define EXTRAKEY_IN_EPNUM (MOUSE_IN_EPNUM + 1) -#else -# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM -#endif - -#ifdef CONSOLE_ENABLE -# define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1) -# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1) -//# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2) -#else -# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM -#endif - -#ifdef NKRO_ENABLE -# define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1) -# if defined(__AVR_ATmega32U2__) && NKRO_IN_EPNUM > 4 -# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO)" -# endif -#endif - - -#define KEYBOARD_EPSIZE 8 -#define MOUSE_EPSIZE 8 -#define EXTRAKEY_EPSIZE 8 -#define CONSOLE_EPSIZE 32 -#define NKRO_EPSIZE 16 - - -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint8_t wIndex, - const void** const DescriptorAddress) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - - -/* new API */ -#if LUFA_VERSION_INTEGER < 0x140302 - #undef VERSION_BCD - #define VERSION_BCD(Major, Minor, Revision) \ - CPU_TO_LE16( ((Major & 0xFF) << 8) | \ - ((Minor & 0x0F) << 4) | \ - (Revision & 0x0F) ) -#endif - -#endif diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c deleted file mode 100644 index cdfc7bc6ad..0000000000 --- a/protocol/lufa/lufa.c +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright 2012 Jun Wako - * This file is based on: - * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse - * LUFA-120219/Demos/Device/Lowlevel/GenericHID - */ - -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#include "report.h" -#include "host.h" -#include "host_driver.h" -#include "keyboard.h" -#include "action.h" -#include "led.h" -#include "sendchar.h" -#include "debug.h" -#ifdef SLEEP_LED_ENABLE -#include "sleep_led.h" -#endif -#include "suspend.h" - -#include "descriptor.h" -#include "lufa.h" - -uint8_t keyboard_idle = 0; -uint8_t keyboard_protocol = 1; -static uint8_t keyboard_led_stats = 0; - -static report_keyboard_t keyboard_report_sent; - - -/* Host driver */ -static uint8_t keyboard_leds(void); -static void send_keyboard(report_keyboard_t *report); -static void send_mouse(report_mouse_t *report); -static void send_system(uint16_t data); -static void send_consumer(uint16_t data); -host_driver_t lufa_driver = { - keyboard_leds, - send_keyboard, - send_mouse, - send_system, - send_consumer -}; - - -/******************************************************************************* - * Console - ******************************************************************************/ -#ifdef CONSOLE_ENABLE -static void Console_Task(void) -{ - /* Device must be connected and configured for the task to run */ - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - uint8_t ep = Endpoint_GetCurrentEndpoint(); - -#if 0 - // TODO: impl receivechar()/recvchar() - Endpoint_SelectEndpoint(CONSOLE_OUT_EPNUM); - - /* Check to see if a packet has been sent from the host */ - if (Endpoint_IsOUTReceived()) - { - /* Check to see if the packet contains data */ - if (Endpoint_IsReadWriteAllowed()) - { - /* Create a temporary buffer to hold the read in report from the host */ - uint8_t ConsoleData[CONSOLE_EPSIZE]; - - /* Read Console Report Data */ - Endpoint_Read_Stream_LE(&ConsoleData, sizeof(ConsoleData), NULL); - - /* Process Console Report Data */ - //ProcessConsoleHIDReport(ConsoleData); - } - - /* Finalize the stream transfer to send the last packet */ - Endpoint_ClearOUT(); - } -#endif - - /* IN packet */ - Endpoint_SelectEndpoint(CONSOLE_IN_EPNUM); - if (!Endpoint_IsEnabled() || !Endpoint_IsConfigured()) { - Endpoint_SelectEndpoint(ep); - return; - } - - // fill empty bank - while (Endpoint_IsReadWriteAllowed()) - Endpoint_Write_8(0); - - // flash senchar packet - if (Endpoint_IsINReady()) { - Endpoint_ClearIN(); - } - - Endpoint_SelectEndpoint(ep); -} -#else -static void Console_Task(void) -{ -} -#endif - - -/******************************************************************************* - * USB Events - ******************************************************************************/ -/* - * Event Order of Plug in: - * 0) EVENT_USB_Device_Connect - * 1) EVENT_USB_Device_Suspend - * 2) EVENT_USB_Device_Reset - * 3) EVENT_USB_Device_Wake -*/ -void EVENT_USB_Device_Connect(void) -{ - print("[C]"); - /* For battery powered device */ - if (!USB_IsInitialized) { - USB_Disable(); - USB_Init(); - USB_Device_EnableSOFEvents(); - } -} - -void EVENT_USB_Device_Disconnect(void) -{ - print("[D]"); - /* For battery powered device */ - USB_IsInitialized = false; -/* TODO: This doesn't work. After several plug in/outs can not be enumerated. - if (USB_IsInitialized) { - USB_Disable(); // Disable all interrupts - USB_Controller_Enable(); - USB_INT_Enable(USB_INT_VBUSTI); - } -*/ -} - -void EVENT_USB_Device_Reset(void) -{ - print("[R]"); -} - -void EVENT_USB_Device_Suspend() -{ - print("[S]"); - matrix_power_down(); -#ifdef SLEEP_LED_ENABLE - sleep_led_enable(); -#endif -} - -void EVENT_USB_Device_WakeUp() -{ - print("[W]"); - suspend_wakeup_init(); - -#ifdef SLEEP_LED_ENABLE - sleep_led_disable(); - // NOTE: converters may not accept this - led_set(host_keyboard_leds()); -#endif -} - -void EVENT_USB_Device_StartOfFrame(void) -{ - Console_Task(); -} - -/** Event handler for the USB_ConfigurationChanged event. - * This is fired when the host sets the current configuration of the USB device after enumeration. - */ -void EVENT_USB_Device_ConfigurationChanged(void) -{ - bool ConfigSuccess = true; - - /* Setup Keyboard HID Report Endpoints */ - ConfigSuccess &= ENDPOINT_CONFIG(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - KEYBOARD_EPSIZE, ENDPOINT_BANK_SINGLE); - -#ifdef MOUSE_ENABLE - /* Setup Mouse HID Report Endpoint */ - ConfigSuccess &= ENDPOINT_CONFIG(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE); -#endif - -#ifdef EXTRAKEY_ENABLE - /* Setup Extra HID Report Endpoint */ - ConfigSuccess &= ENDPOINT_CONFIG(EXTRAKEY_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - EXTRAKEY_EPSIZE, ENDPOINT_BANK_SINGLE); -#endif - -#ifdef CONSOLE_ENABLE - /* Setup Console HID Report Endpoints */ - ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE); -#if 0 - ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, - CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); -#endif -#endif - -#ifdef NKRO_ENABLE - /* Setup NKRO HID Report Endpoints */ - ConfigSuccess &= ENDPOINT_CONFIG(NKRO_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, - NKRO_EPSIZE, ENDPOINT_BANK_SINGLE); -#endif -} - -/* -Appendix G: HID Request Support Requirements - -The following table enumerates the requests that need to be supported by various types of HID class devices. - -Device type GetReport SetReport GetIdle SetIdle GetProtocol SetProtocol ------------------------------------------------------------------------------------------- -Boot Mouse Required Optional Optional Optional Required Required -Non-Boot Mouse Required Optional Optional Optional Optional Optional -Boot Keyboard Required Optional Required Required Required Required -Non-Boot Keybrd Required Optional Required Required Optional Optional -Other Device Required Optional Optional Optional Optional Optional -*/ -/** Event handler for the USB_ControlRequest event. - * This is fired before passing along unhandled control requests to the library for processing internally. - */ -void EVENT_USB_Device_ControlRequest(void) -{ - uint8_t* ReportData = NULL; - uint8_t ReportSize = 0; - - /* Handle HID Class specific requests */ - switch (USB_ControlRequest.bRequest) - { - case HID_REQ_GetReport: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - - // Interface - switch (USB_ControlRequest.wIndex) { - case KEYBOARD_INTERFACE: - // TODO: test/check - ReportData = (uint8_t*)&keyboard_report_sent; - ReportSize = sizeof(keyboard_report_sent); - break; - } - - /* Write the report data to the control endpoint */ - Endpoint_Write_Control_Stream_LE(ReportData, ReportSize); - Endpoint_ClearOUT(); - } - - break; - case HID_REQ_SetReport: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - - // Interface - switch (USB_ControlRequest.wIndex) { - case KEYBOARD_INTERFACE: -#ifdef NKRO_ENABLE - case NKRO_INTERFACE: -#endif - Endpoint_ClearSETUP(); - - while (!(Endpoint_IsOUTReceived())) { - if (USB_DeviceState == DEVICE_STATE_Unattached) - return; - } - keyboard_led_stats = Endpoint_Read_8(); - - Endpoint_ClearOUT(); - Endpoint_ClearStatusStage(); - break; - } - - } - - break; - - case HID_REQ_GetProtocol: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - if (USB_ControlRequest.wIndex == KEYBOARD_INTERFACE) { - Endpoint_ClearSETUP(); - while (!(Endpoint_IsINReady())); - Endpoint_Write_8(keyboard_protocol); - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); - } - } - - break; - case HID_REQ_SetProtocol: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - if (USB_ControlRequest.wIndex == KEYBOARD_INTERFACE) { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00); -#ifdef NKRO_ENABLE - keyboard_nkro = !!keyboard_protocol; -#endif - clear_keyboard(); - } - } - - break; - case HID_REQ_SetIdle: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - Endpoint_ClearStatusStage(); - - keyboard_idle = ((USB_ControlRequest.wValue & 0xFF00) >> 8); - } - - break; - case HID_REQ_GetIdle: - if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) - { - Endpoint_ClearSETUP(); - while (!(Endpoint_IsINReady())); - Endpoint_Write_8(keyboard_idle); - Endpoint_ClearIN(); - Endpoint_ClearStatusStage(); - } - - break; - } -} - -/******************************************************************************* - * Host driver - ******************************************************************************/ -static uint8_t keyboard_leds(void) -{ - return keyboard_led_stats; -} - -static void send_keyboard(report_keyboard_t *report) -{ - uint8_t timeout = 255; - - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - /* Select the Keyboard Report Endpoint */ -#ifdef NKRO_ENABLE - if (keyboard_nkro) { - /* Report protocol - NKRO */ - Endpoint_SelectEndpoint(NKRO_IN_EPNUM); - - /* Check if write ready for a polling interval around 1ms */ - while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(4); - if (!Endpoint_IsReadWriteAllowed()) return; - - /* Write Keyboard Report Data */ - Endpoint_Write_Stream_LE(report, NKRO_EPSIZE, NULL); - } - else -#endif - { - /* Boot protocol */ - Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM); - - /* Check if write ready for a polling interval around 10ms */ - while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40); - if (!Endpoint_IsReadWriteAllowed()) return; - - /* Write Keyboard Report Data */ - Endpoint_Write_Stream_LE(report, KEYBOARD_EPSIZE, NULL); - } - - /* Finalize the stream transfer to send the last packet */ - Endpoint_ClearIN(); - - keyboard_report_sent = *report; -} - -static void send_mouse(report_mouse_t *report) -{ -#ifdef MOUSE_ENABLE - uint8_t timeout = 255; - - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - /* Select the Mouse Report Endpoint */ - Endpoint_SelectEndpoint(MOUSE_IN_EPNUM); - - /* Check if write ready for a polling interval around 10ms */ - while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40); - if (!Endpoint_IsReadWriteAllowed()) return; - - /* Write Mouse Report Data */ - Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL); - - /* Finalize the stream transfer to send the last packet */ - Endpoint_ClearIN(); -#endif -} - -static void send_system(uint16_t data) -{ - uint8_t timeout = 255; - - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - report_extra_t r = { - .report_id = REPORT_ID_SYSTEM, - .usage = data - }; - Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM); - - /* Check if write ready for a polling interval around 10ms */ - while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40); - if (!Endpoint_IsReadWriteAllowed()) return; - - Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); - Endpoint_ClearIN(); -} - -static void send_consumer(uint16_t data) -{ - uint8_t timeout = 255; - - if (USB_DeviceState != DEVICE_STATE_Configured) - return; - - report_extra_t r = { - .report_id = REPORT_ID_CONSUMER, - .usage = data - }; - Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM); - - /* Check if write ready for a polling interval around 10ms */ - while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40); - if (!Endpoint_IsReadWriteAllowed()) return; - - Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); - Endpoint_ClearIN(); -} - - -/******************************************************************************* - * sendchar - ******************************************************************************/ -#ifdef CONSOLE_ENABLE -#define SEND_TIMEOUT 5 -int8_t sendchar(uint8_t c) -{ - // Not wait once timeouted. - // Because sendchar() is called so many times, waiting each call causes big lag. - static bool timeouted = false; - - if (USB_DeviceState != DEVICE_STATE_Configured) - return -1; - - uint8_t ep = Endpoint_GetCurrentEndpoint(); - Endpoint_SelectEndpoint(CONSOLE_IN_EPNUM); - if (!Endpoint_IsEnabled() || !Endpoint_IsConfigured()) { - goto ERROR_EXIT; - } - - if (timeouted && !Endpoint_IsReadWriteAllowed()) { - goto ERROR_EXIT; - } - - timeouted = false; - - uint8_t timeout = SEND_TIMEOUT; - while (!Endpoint_IsReadWriteAllowed()) { - if (USB_DeviceState != DEVICE_STATE_Configured) { - goto ERROR_EXIT; - } - if (Endpoint_IsStalled()) { - goto ERROR_EXIT; - } - if (!(timeout--)) { - timeouted = true; - goto ERROR_EXIT; - } - _delay_ms(1); - } - - Endpoint_Write_8(c); - - // send when bank is full - if (!Endpoint_IsReadWriteAllowed()) - Endpoint_ClearIN(); - - Endpoint_SelectEndpoint(ep); - return 0; -ERROR_EXIT: - Endpoint_SelectEndpoint(ep); - return -1; -} -#else -int8_t sendchar(uint8_t c) -{ - return 0; -} -#endif - - -/******************************************************************************* - * main - ******************************************************************************/ -static void SetupHardware(void) -{ - /* Disable watchdog if enabled by bootloader/fuses */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - /* Disable clock division */ - clock_prescale_set(clock_div_1); - - // Leonardo needs. Without this USB device is not recognized. - USB_Disable(); - - USB_Init(); - - // for Console_Task - USB_Device_EnableSOFEvents(); - print_set_sendchar(sendchar); -} - -int main(void) __attribute__ ((weak)); -int main(void) -{ - SetupHardware(); - sei(); - - /* wait for USB startup & debug output */ - while (USB_DeviceState != DEVICE_STATE_Configured) { -#if defined(INTERRUPT_CONTROL_ENDPOINT) - ; -#else - USB_USBTask(); -#endif - } - print("USB configured.\n"); - - /* init modules */ - keyboard_init(); - host_set_driver(&lufa_driver); -#ifdef SLEEP_LED_ENABLE - sleep_led_init(); -#endif - - print("Keyboard start.\n"); - while (1) { - while (USB_DeviceState == DEVICE_STATE_Suspended) { - print("[s]"); - suspend_power_down(); - if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { - USB_Device_SendRemoteWakeup(); - } - } - - keyboard_task(); - -#if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); -#endif - } -} diff --git a/protocol/lufa/lufa.h b/protocol/lufa/lufa.h deleted file mode 100644 index 195123c0f9..0000000000 --- a/protocol/lufa/lufa.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2012 Jun Wako - * This file is based on: - * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse - * LUFA-120219/Demos/Device/Lowlevel/GenericHID - */ - -/* - LUFA Library - Copyright (C) Dean Camera, 2012. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com) - - Permission to use, copy, modify, distribute, and sell this - software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in - all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - - The author disclaim all warranties with regard to this - software, including all implied warranties of merchantability - and fitness. In no event shall the author be liable for any - special, indirect or consequential damages or any damages - whatsoever resulting from loss of use, data or profits, whether - in an action of contract, negligence or other tortious action, - arising out of or in connection with the use or performance of - this software. -*/ - -#ifndef _LUFA_H_ -#define _LUFA_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "host.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -extern host_driver_t lufa_driver; - -#ifdef __cplusplus -} -#endif - -/* extra report structure */ -typedef struct { - uint8_t report_id; - uint16_t usage; -} __attribute__ ((packed)) report_extra_t; - - -#if LUFA_VERSION_INTEGER < 0x120730 - /* old API 120219 */ - #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank) -#else - /* new API >= 120730 */ - #define ENDPOINT_BANK_SINGLE 1 - #define ENDPOINT_BANK_DOUBLE 2 - #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum) , eptype, epsize, epbank) -#endif - -#endif diff --git a/protocol/m0110.c b/protocol/m0110.c deleted file mode 100644 index 0d3a5aaa42..0000000000 --- a/protocol/m0110.c +++ /dev/null @@ -1,591 +0,0 @@ -/* -Copyright 2011,2012 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ -/* M0110A Support was contributed by skagon@github */ - -#include -#include -#include -#include -#include "m0110.h" -#include "debug.h" - - -static inline uint8_t raw2scan(uint8_t raw); -static inline uint8_t inquiry(void); -static inline uint8_t instant(void); -static inline void clock_lo(void); -static inline void clock_hi(void); -static inline bool clock_in(void); -static inline void data_lo(void); -static inline void data_hi(void); -static inline bool data_in(void); -static inline uint16_t wait_clock_lo(uint16_t us); -static inline uint16_t wait_clock_hi(uint16_t us); -static inline uint16_t wait_data_lo(uint16_t us); -static inline uint16_t wait_data_hi(uint16_t us); -static inline void idle(void); -static inline void request(void); - - -#define WAIT_US(stat, us, err) do { \ - if (!wait_##stat(us)) { \ - m0110_error = err; \ - goto ERROR; \ - } \ -} while (0) - -#define WAIT_MS(stat, ms, err) do { \ - uint16_t _ms = ms; \ - while (_ms) { \ - if (wait_##stat(1000)) { \ - break; \ - } \ - _ms--; \ - } \ - if (_ms == 0) { \ - m0110_error = err; \ - goto ERROR; \ - } \ -} while (0) - -#define KEY(raw) ((raw) & 0x7f) -#define IS_BREAK(raw) (((raw) & 0x80) == 0x80) - - -uint8_t m0110_error = 0; - - -void m0110_init(void) -{ - idle(); - _delay_ms(1000); - -/* Not needed to initialize in fact. - uint8_t data; - m0110_send(M0110_MODEL); - data = m0110_recv(); - print("m0110_init model: "); phex(data); print("\n"); - - m0110_send(M0110_TEST); - data = m0110_recv(); - print("m0110_init test: "); phex(data); print("\n"); -*/ -} - -uint8_t m0110_send(uint8_t data) -{ - m0110_error = 0; - - request(); - WAIT_MS(clock_lo, 250, 1); // keyboard may block long time - for (uint8_t bit = 0x80; bit; bit >>= 1) { - WAIT_US(clock_lo, 250, 3); - if (data&bit) { - data_hi(); - } else { - data_lo(); - } - WAIT_US(clock_hi, 200, 4); - } - _delay_us(100); // hold last bit for 80us - idle(); - return 1; -ERROR: - print("m0110_send err: "); phex(m0110_error); print("\n"); - _delay_ms(500); - idle(); - return 0; -} - -uint8_t m0110_recv(void) -{ - uint8_t data = 0; - m0110_error = 0; - - WAIT_MS(clock_lo, 250, 1); // keyboard may block long time - for (uint8_t i = 0; i < 8; i++) { - data <<= 1; - WAIT_US(clock_lo, 200, 2); - WAIT_US(clock_hi, 200, 3); - if (data_in()) { - data |= 1; - } - } - idle(); - return data; -ERROR: - print("m0110_recv err: "); phex(m0110_error); print("\n"); - _delay_ms(500); - idle(); - return 0xFF; -} - -/* -Handling for exceptional case of key combinations for M0110A - -Shift and Calc/Arrow key could be operated simultaneously: - - Case Shift Arrow Events Interpret - ------------------------------------------------------------------- - 1 Down Down 71, 79, DD Calc(d)*a *b - 2 Down Up 71, 79, UU Arrow&Calc(u)*a - 3 Up Down F1, 79, DD Shift(u) *c - 4 Up Up F1, 79, UU Shift(u) and Arrow&Calc(u)*a - - Case Shift Calc Events Interpret - ------------------------------------------------------------------- - 5(1) Down Down 71, 71, 79, DD Shift(d) and Cacl(d) - 6(2) Down Up F1, 71, 79, UU Shift(u) and Arrow&Calc(u)*a - 7(1) Up Down F1, 71, 79, DD Shift(u) and Calc(d) - 8(4) Up Up F1, F1, 79, UU Shift(ux2) and Arrow&Calc(u)*a - -During Calc key is hold: - Case Shift Arrow Events Interpret - ------------------------------------------------------------------- - A(3) ---- Down F1, 79, DD Shift(u) *c - B ---- Up 79, UU Arrow&Calc(u)*a - C Down ---- F1, 71 Shift(u) and Shift(d) - D Up ---- F1 Shift(u) - E Hold Down 79, DD Normal - F Hold Up 79, UU Arrow&Calc(u)*a - G(1) Down Down F1, 71, 79, DD Shift(u)*b and Calc(d)*a - H(2) Down Up F1, 71, 79, UU Shift(u) and Arrow&Calc(u)*a - I(3) Up Down F1, F1, 79, DD Shift(ux2) *c - J(4) Up Up F1, 79, UU Shift(u) and Arrow&Calc(u)*a - - Case Shift Calc Events Interpret - ------------------------------------------------------------------- - K(1) ---- Down 71, 79, DD Calc(d)*a - L(4) ---- Up F1, 79, UU Shift(u) and Arrow&Calc(u)*a - M(1) Hold Down 71, 79, DD Calc(d)*a - N Hold Up 79, UU Arrow&Calc(u)*a - - Where DD/UU indicates part of Keypad Down/Up event. - *a: Impossible to distinguish btween Arrow and Calc event. - *b: Shift(d) event is ignored. - *c: Arrow/Calc(d) event is ignored. -*/ -uint8_t m0110_recv_key(void) -{ - static uint8_t keybuf = 0x00; - static uint8_t keybuf2 = 0x00; - static uint8_t rawbuf = 0x00; - uint8_t raw, raw2, raw3; - - if (keybuf) { - raw = keybuf; - keybuf = 0x00; - return raw; - } - if (keybuf2) { - raw = keybuf2; - keybuf2 = 0x00; - return raw; - } - - if (rawbuf) { - raw = rawbuf; - rawbuf = 0x00; - } else { - raw = instant(); // Use INSTANT for better response. Should be INQUIRY ? - } - switch (KEY(raw)) { - case M0110_KEYPAD: - raw2 = instant(); - switch (KEY(raw2)) { - case M0110_ARROW_UP: - case M0110_ARROW_DOWN: - case M0110_ARROW_LEFT: - case M0110_ARROW_RIGHT: - if (IS_BREAK(raw2)) { - // Case B,F,N: - keybuf = (raw2scan(raw2) | M0110_CALC_OFFSET); // Calc(u) - return (raw2scan(raw2) | M0110_KEYPAD_OFFSET); // Arrow(u) - } - break; - } - // Keypad or Arrow - return (raw2scan(raw2) | M0110_KEYPAD_OFFSET); - break; - case M0110_SHIFT: - raw2 = instant(); - switch (KEY(raw2)) { - case M0110_SHIFT: - // Case: 5-8,C,G,H - rawbuf = raw2; - return raw2scan(raw); // Shift(d/u) - break; - case M0110_KEYPAD: - // Shift + Arrow, Calc, or etc. - raw3 = instant(); - switch (KEY(raw3)) { - case M0110_ARROW_UP: - case M0110_ARROW_DOWN: - case M0110_ARROW_LEFT: - case M0110_ARROW_RIGHT: - if (IS_BREAK(raw)) { - if (IS_BREAK(raw3)) { - // Case 4: - print("(4)\n"); - keybuf2 = raw2scan(raw); // Shift(u) - keybuf = (raw2scan(raw3) | M0110_CALC_OFFSET); // Calc(u) - return (raw2scan(raw3) | M0110_KEYPAD_OFFSET); // Arrow(u) - } else { - // Case 3: - print("(3)\n"); - return (raw2scan(raw)); // Shift(u) - } - } else { - if (IS_BREAK(raw3)) { - // Case 2: - print("(2)\n"); - keybuf = (raw2scan(raw3) | M0110_CALC_OFFSET); // Calc(u) - return (raw2scan(raw3) | M0110_KEYPAD_OFFSET); // Arrow(u) - } else { - // Case 1: - print("(1)\n"); - return (raw2scan(raw3) | M0110_CALC_OFFSET); // Calc(d) - } - } - break; - default: - // Shift + Keypad - keybuf = (raw2scan(raw3) | M0110_KEYPAD_OFFSET); - return raw2scan(raw); // Shift(d/u) - break; - } - break; - default: - // Shift + Normal keys - keybuf = raw2scan(raw2); - return raw2scan(raw); // Shift(d/u) - break; - } - break; - default: - // Normal keys - return raw2scan(raw); - break; - } -} - - -static inline uint8_t raw2scan(uint8_t raw) { - return (raw == M0110_NULL) ? M0110_NULL : ( - (raw == M0110_ERROR) ? M0110_ERROR : ( - ((raw&0x80) | ((raw&0x7F)>>1)) - ) - ); -} - -static inline uint8_t inquiry(void) -{ - m0110_send(M0110_INQUIRY); - return m0110_recv(); -} - -static inline uint8_t instant(void) -{ - m0110_send(M0110_INSTANT); - uint8_t data = m0110_recv(); - if (data != M0110_NULL) { - debug_hex(data); debug(" "); - } - return data; -} - -static inline void clock_lo() -{ - M0110_CLOCK_PORT &= ~(1<HOST: HOST reads bit on rising edge. - CLOCK ~~~~~~~~~~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~~~~~~~~~ - DATA ~~~~~~~~~~~~X777777X666666X555555X444444X333333X222222X111111X000000X~~~~~~~ - <--> 160us(clock low) - <---> 180us(clock high) - -3) HOST->KEYBOARD: HOST asserts bit on falling edge. - CLOCK ~~~~~~~~~~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~~~~~~~~~ - DATA ~~~~~~|_____X777777X666666X555555X444444X333333X222222X111111X000000X~~~~~~~ - <----> 840us(request to send by host) <---> 80us(hold DATA) - <--> 180us(clock low) - <---> 220us(clock high) - - -Protocol --------- -COMMAND: - Inquiry 0x10 get key event with block - Instant 0x12 get key event - Model 0x14 get model number(M0110 responds with 0x09) - bit 7 1 if another device connected(used when keypad exists?) - bit4-6 next device model number - bit1-3 keyboard model number - bit 0 always 1 - Test 0x16 test(ACK:0x7D/NAK:0x77) - -KEY EVENT: - bit 7 key state(0:press 1:release) - bit 6-1 scan code(see below) - bit 0 always 1 - To get scan code use this: ((bits&(1<<7)) | ((bits&0x7F))>>1). - - Note: On the M0110A, Keypad keys and Arrow keys are preceded by 0x79. - Moreover, some Keypad keys(=, /, * and +) are preceded by 0x71 on press and 0xF1 on release. - -ARROW KEYS: - Arrow keys and Calc keys(+,*,/,= on keypad) share same byte sequence and preceding byte of - Calc keys(0x71 and 0xF1) means press and release event of SHIFT. This causes a very confusing situation, - it is difficult or impossible to tell Calc key from Arrow key plus SHIFT in some cases. - - Raw key events: - press release - ---------------- ---------------- - Left: 0x79, 0x0D 0x79, 0x8D - Right: 0x79, 0x05 0x79, 0x85 - Up: 0x79, 0x1B 0x79, 0x9B - Down: 0x79, 0x11 0x79, 0x91 - Pad+: 0x71, 0x79, 0x0D 0xF1, 0x79, 0x8D - Pad*: 0x71, 0x79, 0x05 0xF1, 0x79, 0x85 - Pad/: 0x71, 0x79, 0x1B 0xF1, 0x79, 0x9B - Pad=: 0x71, 0x79, 0x11 0xF1, 0x79, 0x91 - - -RAW CODE: - M0110A - ,---------------------------------------------------------. ,---------------. - | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| - |---------------------------------------------------------| |---------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| - |-----------------------------------------------------' | |---------------| - |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| - |---------------------------------------------------------| |---------------| - |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | - |---------------------------------------------------------' |-----------|Ent| - |Optio|Mac | Space | \|Lft|Rgt|Dn | | 0| .| | - `---------------------------------------------------------' `---------------' - ,---------------------------------------------------------. ,---------------. - | 65| 25| 27| 29| 2B| 2F| 2D| 35| 39| 33| 3B| 37| 31| 67| |+0F|*11|*1B|*05| - |---------------------------------------------------------| |---------------| - | 61| 19| 1B| 1D| 1F| 23| 21| 41| 45| 3F| 47| 43| 3D| | |+33|+37|+39|+1D| - |-----------------------------------------------------' | |---------------| - | 73| 01| 03| 05| 07| 0B| 09| 4D| 51| 4B| 53| 4F| 49| |+2D|+2F|+31|*0D| - |---------------------------------------------------------| |---------------| - | 71| 0D| 0F| 11| 13| 17| 5B| 5D| 27| 5F| 59| 71|+1B| |+27|+29|+2B| | - |---------------------------------------------------------' |-----------|+19| - | 75| 6F| 63 | 55|+0D|+05|+11| | +25|+03| | - `---------------------------------------------------------' `---------------' - + 0x79, 0xDD / 0xF1, 0xUU - * 0x71, 0x79,DD / 0xF1, 0x79, 0xUU - - -MODEL NUMBER: - M0110: 0x09 00001001 : model number 4 (100) - M0110A: 0x0B 00001011 : model number 5 (101) - M0110 & M0120: ??? - - -Scan Code ---------- - m0110_recv_key() function returns following scan codes instead of M0110 raw codes. - Scan codes are 1 byte size and MSB(bit7) is set when key is released. - - scancode = ((raw&0x80) | ((raw&0x7F)>>1)) - - M0110 M0120 - ,---------------------------------------------------------. ,---------------. - | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -|Lft|Rgt| - |---------------------------------------------------------| |---------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9|Up | - |---------------------------------------------------------| |---------------| - |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6|Dn | - |---------------------------------------------------------| |---------------| - |Shift | Z| X| C| V| B| N| M| ,| ,| /| | | 1| 2| 3| | - `---------------------------------------------------------' |-----------|Ent| - |Opt|Mac | Space |Enter|Opt| | 0| .| | - `------------------------------------------------' `---------------' - ,---------------------------------------------------------. ,---------------. - | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 4E| 46| 42| - |---------------------------------------------------------| |---------------| - | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4D| - |---------------------------------------------------------| |---------------| - | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 48| - |---------------------------------------------------------| |---------------| - | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| | 53| 54| 55| | - `---------------------------------------------------------' |-----------| 4C| - | 3A| 37| 31 | 34| 3A| | 52| 41| | - `------------------------------------------------' `---------------' - - International keyboard(See page 22 of "Technical Info for 128K/512K") - ,---------------------------------------------------------. - | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| - |---------------------------------------------------------| - | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| - |------------------------------------------------------ | - | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | - |---------------------------------------------------------| - | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38| - `---------------------------------------------------------' - | 3A| 37| 34 | 31| 3A| - `------------------------------------------------' - - M0110A - ,---------------------------------------------------------. ,---------------. - | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| - |---------------------------------------------------------| |---------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| - |-----------------------------------------------------' | |---------------| - |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| - |---------------------------------------------------------| |---------------| - |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | - |---------------------------------------------------------' |-----------|Ent| - |Optio|Mac | Space | \|Lft|Rgt|Dn | | 0| .| | - `---------------------------------------------------------' `---------------' - ,---------------------------------------------------------. ,---------------. - | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62| - |---------------------------------------------------------| |---------------| - | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| | | 59| 5B| 5C| 4E| - |-----------------------------------------------------' | |---------------| - | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66| - |---------------------------------------------------------| |---------------| - | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| 4D| | 53| 54| 55| | - |---------------------------------------------------------' |-----------| 4C| - | 3A| 37| 31 | 2A| 46| 42| 48| | 52| 41| | - `---------------------------------------------------------' `---------------' - - -References ----------- -Technical Info for 128K/512K and Plus - ftp://ftp.apple.asimov.net/pub/apple_II/documentation/macintosh/Mac%20Hardware%20Info%20-%20Mac%20128K.pdf - ftp://ftp.apple.asimov.net/pub/apple_II/documentation/macintosh/Mac%20Hardware%20Info%20-%20Mac%20Plus.pdf -Protocol: - Page 20 of Tech Info for 128K/512K - http://www.mac.linux-m68k.org/devel/plushw.php -Connector: - Page 20 of Tech Info for 128K/512K - http://www.kbdbabel.org/conn/kbd_connector_macplus.png -Signaling: - http://www.kbdbabel.org/signaling/kbd_signaling_mac.png - http://typematic.blog.shinobi.jp/Entry/14/ -M0110 raw scan codes: - Page 22 of Tech Info for 128K/512K - Page 07 of Tech Info for Plus - http://m0115.web.fc2.com/m0110.jpg - http://m0115.web.fc2.com/m0110a.jpg -*/ diff --git a/protocol/m0110.h b/protocol/m0110.h deleted file mode 100644 index 2b95ed34d5..0000000000 --- a/protocol/m0110.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright 2011,2012 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef M0110_H -#define M0110_H - - -/* port settings for clock and data line */ -#if !(defined(M0110_CLOCK_PORT) && \ - defined(M0110_CLOCK_PIN) && \ - defined(M0110_CLOCK_DDR) && \ - defined(M0110_CLOCK_BIT)) -# error "M0110 clock port setting is required in config.h" -#endif - -#if !(defined(M0110_DATA_PORT) && \ - defined(M0110_DATA_PIN) && \ - defined(M0110_DATA_DDR) && \ - defined(M0110_DATA_BIT)) -# error "M0110 data port setting is required in config.h" -#endif - -/* Commands */ -#define M0110_INQUIRY 0x10 -#define M0110_INSTANT 0x14 -#define M0110_MODEL 0x16 -#define M0110_TEST 0x36 - -/* Response(raw byte from M0110) */ -#define M0110_NULL 0x7B -#define M0110_KEYPAD 0x79 -#define M0110_TEST_ACK 0x7D -#define M0110_TEST_NAK 0x77 -#define M0110_SHIFT 0x71 -#define M0110_ARROW_UP 0x1B -#define M0110_ARROW_DOWN 0x11 -#define M0110_ARROW_LEFT 0x0D -#define M0110_ARROW_RIGHT 0x05 - -/* This inidcates no response. */ -#define M0110_ERROR 0xFF - -/* scan code offset for keypad and arrow keys */ -#define M0110_KEYPAD_OFFSET 0x40 -#define M0110_CALC_OFFSET 0x60 - - -extern uint8_t m0110_error; - -/* host role */ -void m0110_init(void); -uint8_t m0110_send(uint8_t data); -uint8_t m0110_recv(void); -uint8_t m0110_recv_key(void); -uint8_t m0110_inquiry(void); -uint8_t m0110_instant(void); - -#endif diff --git a/protocol/mbed/HIDKeyboard.cpp b/protocol/mbed/HIDKeyboard.cpp deleted file mode 100644 index 947077cd24..0000000000 --- a/protocol/mbed/HIDKeyboard.cpp +++ /dev/null @@ -1,271 +0,0 @@ -#include -#include "USBHID.h" -#include "USBHID_Types.h" -#include "USBDescriptor.h" -#include "HIDKeyboard.h" - -#define DEFAULT_CONFIGURATION (1) - - -HIDKeyboard::HIDKeyboard(uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) -{ - USBDevice::connect(); -} - -bool HIDKeyboard::sendReport(report_keyboard_t report) { - USBDevice::write(EP1IN, report.raw, sizeof(report), MAX_PACKET_SIZE_EP1); - return true; -} - -uint8_t HIDKeyboard::leds() { - return led_state; -} - -bool HIDKeyboard::USBCallback_setConfiguration(uint8_t configuration) { - if (configuration != DEFAULT_CONFIGURATION) { - return false; - } - - // Configure endpoints > 0 - addEndpoint(EPINT_IN, MAX_PACKET_SIZE_EPINT); - //addEndpoint(EPINT_OUT, MAX_PACKET_SIZE_EPINT); - - // We activate the endpoint to be able to recceive data - //readStart(EPINT_OUT, MAX_PACKET_SIZE_EPINT); - return true; -} - - -uint8_t * HIDKeyboard::stringImanufacturerDesc() { - static uint8_t stringImanufacturerDescriptor[] = { - 0x18, /*bLength*/ - STRING_DESCRIPTOR, /*bDescriptorType 0x03*/ - 't',0,'m',0,'k',0,'-',0,'k',0,'b',0,'d',0,'.',0,'c',0,'o',0,'m',0 /*bString iManufacturer*/ - }; - return stringImanufacturerDescriptor; -} - -uint8_t * HIDKeyboard::stringIproductDesc() { - static uint8_t stringIproductDescriptor[] = { - 0x0a, /*bLength*/ - STRING_DESCRIPTOR, /*bDescriptorType 0x03*/ - 'm',0,'b',0,'e',0,'d',0 /*bString iProduct*/ - }; - return stringIproductDescriptor; -} - -uint8_t * HIDKeyboard::stringIserialDesc() { - static uint8_t stringIserialDescriptor[] = { - 0x04, /*bLength*/ - STRING_DESCRIPTOR, /*bDescriptorType 0x03*/ - '0',0 /*bString iSerial*/ - }; - return stringIserialDescriptor; -} - -uint8_t * HIDKeyboard::reportDesc() { - static uint8_t reportDescriptor[] = { - USAGE_PAGE(1), 0x01, // Generic Desktop - USAGE(1), 0x06, // Keyboard - COLLECTION(1), 0x01, // Application - - USAGE_PAGE(1), 0x07, // Key Codes - USAGE_MINIMUM(1), 0xE0, - USAGE_MAXIMUM(1), 0xE7, - LOGICAL_MINIMUM(1), 0x00, - LOGICAL_MAXIMUM(1), 0x01, - REPORT_SIZE(1), 0x01, - REPORT_COUNT(1), 0x08, - INPUT(1), 0x02, // Data, Variable, Absolute - - REPORT_COUNT(1), 0x01, - REPORT_SIZE(1), 0x08, - INPUT(1), 0x01, // Constant - - REPORT_COUNT(1), 0x05, - REPORT_SIZE(1), 0x01, - USAGE_PAGE(1), 0x08, // LEDs - USAGE_MINIMUM(1), 0x01, - USAGE_MAXIMUM(1), 0x05, - OUTPUT(1), 0x02, // Data, Variable, Absolute - - REPORT_COUNT(1), 0x01, - REPORT_SIZE(1), 0x03, - OUTPUT(1), 0x01, // Constant - - - REPORT_COUNT(1), 0x06, - REPORT_SIZE(1), 0x08, - LOGICAL_MINIMUM(1), 0x00, - LOGICAL_MAXIMUM(1), 0xFF, - USAGE_PAGE(1), 0x07, // Key Codes - USAGE_MINIMUM(1), 0x00, - USAGE_MAXIMUM(1), 0xFF, - INPUT(1), 0x00, // Data, Array - END_COLLECTION(0), - }; - reportLength = sizeof(reportDescriptor); - return reportDescriptor; -} - -uint16_t HIDKeyboard::reportDescLength() { - reportDesc(); - return reportLength; -} - -#define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \ - + (1 * INTERFACE_DESCRIPTOR_LENGTH) \ - + (1 * HID_DESCRIPTOR_LENGTH) \ - + (1 * ENDPOINT_DESCRIPTOR_LENGTH)) -uint8_t * HIDKeyboard::configurationDesc() { - static uint8_t configurationDescriptor[] = { - CONFIGURATION_DESCRIPTOR_LENGTH,// bLength - CONFIGURATION_DESCRIPTOR, // bDescriptorType - LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB) - MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB) - 0x01, // bNumInterfaces - DEFAULT_CONFIGURATION, // bConfigurationValue - 0x00, // iConfiguration - C_RESERVED | C_REMOTE_WAKEUP, // bmAttributes - C_POWER(100), // bMaxPowerHello World from Mbed - - INTERFACE_DESCRIPTOR_LENGTH, // bLength - INTERFACE_DESCRIPTOR, // bDescriptorType - 0x00, // bInterfaceNumber - 0x00, // bAlternateSetting - 0x01, // bNumEndpoints - HID_CLASS, // bInterfaceClass - 1, // bInterfaceSubClass (boot) - 1, // bInterfaceProtocol (keyboard) - 0x00, // iInterface - - HID_DESCRIPTOR_LENGTH, // bLength - HID_DESCRIPTOR, // bDescriptorType - LSB(HID_VERSION_1_11), // bcdHID (LSB) - MSB(HID_VERSION_1_11), // bcdHID (MSB) - 0x00, // bCountryCode - 0x01, // bNumDescriptors - REPORT_DESCRIPTOR, // bDescriptorType - (uint8_t)(LSB(reportDescLength())), // wDescriptorLength (LSB) - (uint8_t)(MSB(reportDescLength())), // wDescriptorLength (MSB) - - ENDPOINT_DESCRIPTOR_LENGTH, // bLength - ENDPOINT_DESCRIPTOR, // bDescriptorType - PHY_TO_DESC(EP1IN), // bEndpointAddress - E_INTERRUPT, // bmAttributes - LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) - MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) - 1, // bInterval (milliseconds) - }; - return configurationDescriptor; -} - -#if 0 -uint8_t * HIDKeyboard::deviceDesc() { - static uint8_t deviceDescriptor[] = { - DEVICE_DESCRIPTOR_LENGTH, /* bLength */ - DEVICE_DESCRIPTOR, /* bDescriptorType */ - LSB(USB_VERSION_2_0), /* bcdUSB (LSB) */ - MSB(USB_VERSION_2_0), /* bcdUSB (MSB) */ - 0x00, /* bDeviceClass */ - 0x00, /* bDeviceSubClass */ - 0x00, /* bDeviceprotocol */ - MAX_PACKET_SIZE_EP0, /* bMaxPacketSize0 */ - (uint8_t)(LSB(0xfeed)), /* idVendor (LSB) */ - (uint8_t)(MSB(0xfeed)), /* idVendor (MSB) */ - (uint8_t)(LSB(0x1bed)), /* idProduct (LSB) */ - (uint8_t)(MSB(0x1bed)), /* idProduct (MSB) */ - (uint8_t)(LSB(0x0002)), /* bcdDevice (LSB) */ - (uint8_t)(MSB(0x0002)), /* bcdDevice (MSB) */ - 0, /* iManufacturer */ - 0, /* iProduct */ - 0, /* iSerialNumber */ - 0x01 /* bNumConfigurations */ - }; - return deviceDescriptor; -} -#endif - -bool HIDKeyboard::USBCallback_request() { - bool success = false; - CONTROL_TRANSFER * transfer = getTransferPtr(); - uint8_t *hidDescriptor; - - // Process additional standard requests - - if ((transfer->setup.bmRequestType.Type == STANDARD_TYPE)) - { - switch (transfer->setup.bRequest) - { - case GET_DESCRIPTOR: - switch (DESCRIPTOR_TYPE(transfer->setup.wValue)) - { - case REPORT_DESCRIPTOR: - if ((reportDesc() != NULL) \ - && (reportDescLength() != 0)) - { - transfer->remaining = reportDescLength(); - transfer->ptr = reportDesc(); - transfer->direction = DEVICE_TO_HOST; - success = true; - } - break; - case HID_DESCRIPTOR: - // Find the HID descriptor, after the configuration descriptor - hidDescriptor = findDescriptor(HID_DESCRIPTOR); - if (hidDescriptor != NULL) - { - transfer->remaining = HID_DESCRIPTOR_LENGTH; - transfer->ptr = hidDescriptor; - transfer->direction = DEVICE_TO_HOST; - success = true; - } - break; - - default: - break; - } - break; - default: - break; - } - } - - // Process class-specific requests - if (transfer->setup.bmRequestType.Type == CLASS_TYPE) - { - switch (transfer->setup.bRequest) { - case SET_REPORT: - // LED indicator - // TODO: check Interface and Report length? - // if (transfer->setup.wIndex == INTERFACE_KEYBOAD) { } - // if (transfer->setup.wLength == 1) - - transfer->remaining = 1; - //transfer->ptr = ?? what ptr should be set when OUT(not used?) - transfer->direction = HOST_TO_DEVICE; - transfer->notify = true; /* notify with USBCallback_requestCompleted */ - success = true; - default: - break; - } - } - - return success; -} - -void HIDKeyboard::USBCallback_requestCompleted(uint8_t * buf, uint32_t length) -{ - if (length > 0) { - CONTROL_TRANSFER *transfer = getTransferPtr(); - if (transfer->setup.bmRequestType.Type == CLASS_TYPE) { - switch (transfer->setup.bRequest) { - case SET_REPORT: - led_state = buf[0]; - break; - default: - break; - } - } - } -} diff --git a/protocol/mbed/HIDKeyboard.h b/protocol/mbed/HIDKeyboard.h deleted file mode 100644 index c537e5ecee..0000000000 --- a/protocol/mbed/HIDKeyboard.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef HIDKEYBOARD_H - -#include "stdint.h" -#include "stdbool.h" -#include "USBHID.h" -#include "report.h" - - -class HIDKeyboard : public USBDevice { -public: - HIDKeyboard(uint16_t vendor_id = 0xFEED, uint16_t product_id = 0xabed, uint16_t product_release = 0x0001); - - bool sendReport(report_keyboard_t report); - uint8_t leds(void); -protected: - uint16_t reportLength; - virtual bool USBCallback_setConfiguration(uint8_t configuration); - virtual uint8_t * stringImanufacturerDesc(); - virtual uint8_t * stringIproductDesc(); - virtual uint8_t * stringIserialDesc(); - virtual uint16_t reportDescLength(); - virtual uint8_t * reportDesc(); - virtual uint8_t * configurationDesc(); - //virtual uint8_t * deviceDesc(); - virtual bool USBCallback_request(); - virtual void USBCallback_requestCompleted(uint8_t * buf, uint32_t length); -private: - uint8_t led_state; -}; - -#endif diff --git a/protocol/mbed/mbed_driver.cpp b/protocol/mbed/mbed_driver.cpp deleted file mode 100644 index 6c7b16e23d..0000000000 --- a/protocol/mbed/mbed_driver.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "HIDKeyboard.h" -#include "host.h" -#include "host_driver.h" -#include "mbed_driver.h" - -HIDKeyboard keyboard; - - -/* Host driver */ -static uint8_t keyboard_leds(void); -static void send_keyboard(report_keyboard_t *report); -static void send_mouse(report_mouse_t *report); -static void send_system(uint16_t data); -static void send_consumer(uint16_t data); - -host_driver_t mbed_driver = { - keyboard_leds, - send_keyboard, - send_mouse, - send_system, - send_consumer -}; - - -static uint8_t keyboard_leds(void) -{ - return keyboard.leds(); -} -static void send_keyboard(report_keyboard_t *report) -{ - keyboard.sendReport(*report); -} -static void send_mouse(report_mouse_t *report) -{ -} -static void send_system(uint16_t data) -{ -} -static void send_consumer(uint16_t data) -{ -} diff --git a/protocol/mbed/mbed_driver.h b/protocol/mbed/mbed_driver.h deleted file mode 100644 index dd1153b43a..0000000000 --- a/protocol/mbed/mbed_driver.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "host_driver.h" - -extern host_driver_t mbed_driver; diff --git a/protocol/news.c b/protocol/news.c deleted file mode 100644 index 00755a5e2e..0000000000 --- a/protocol/news.c +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 2012 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include -#include "news.h" - - -void news_init(void) -{ - NEWS_KBD_RX_INIT(); -} - -// RX ring buffer -#define RBUF_SIZE 8 -static uint8_t rbuf[RBUF_SIZE]; -static uint8_t rbuf_head = 0; -static uint8_t rbuf_tail = 0; - -uint8_t news_recv(void) -{ - uint8_t data = 0; - if (rbuf_head == rbuf_tail) { - return 0; - } - - data = rbuf[rbuf_tail]; - rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE; - return data; -} - -// USART RX complete interrupt -ISR(NEWS_KBD_RX_VECT) -{ - uint8_t next = (rbuf_head + 1) % RBUF_SIZE; - if (next != rbuf_tail) { - rbuf[rbuf_head] = NEWS_KBD_RX_DATA; - rbuf_head = next; - } -} - - -/* -SONY NEWS Keyboard Protocol -=========================== - -Resources ---------- - Mouse protocol of NWA-5461(Japanese) - http://groups.google.com/group/fj.sys.news/browse_thread/thread/a01b3e3ac6ae5b2d - - SONY NEWS Info(Japanese) - http://katsu.watanabe.name/doc/sonynews/ - - -Pinouts -------- - EIA 232 male connector from NWP-5461 - ------------- - \ 1 2 3 4 5 / - \ 6 7 8 9 / - --------- - 1 VCC - 2 BZ(Speaker) - 3 Keyboard Data(from keyboard MCU TxD) - 4 NC - 5 GND - 6 Unknown Input(to keyboard MCU RxD via schmitt trigger) - 7 Mouse Data(from Mouse Ext connector) - 8 Unknown Input(to Keyboard MCU Input via diode and buffer) - 9 FG - NOTE: Two LED on keyboard are controlled by pin 6,8? - - EIA 232 male connector from NWP-411A - ------------- - \ 1 2 3 4 5 / - \ 6 7 8 9 / - --------- - 1 VCC - 2 BZ(Speaker) - 3 Keyboard Data(from keyboard MCU TxD) - 4 NC - 5 GND - 6 NC - 7 Mouse Data(from Mouse Ext connector) - 8 NC - 9 FG - NOTE: These are just from my guess and not confirmed. - - -Signaling ---------- - ~~~~~~~~~~ ____XOO0X111X222X333X444X555X666X777~~~~ ~~~~~~~ - Idle Start LSB MSB Stop Idle - - Idle: High - Start bit: Low - Stop bit: High - Bit order: LSB first - - Baud rate: 9600 - Interface: TTL level(5V) UART - - NOTE: This is observed on NWP-5461 with its DIP switch all OFF. - - -Format ------- - MSB LSB - 7 6 5 4 3 2 1 0 bit - | | | | | | | | - | +-+-+-+-+-+-+-- scan code(00-7F) - +---------------- break flag: sets when released - - -Scan Codes ----------- - SONY NEWS NWP-5461 - ,---. ,------------------------, ,------------------------. ,---------. - | 7A| | 01 | 02 | 03 | 04 | 05 | | 06 | 07 | 08 | 09 | 0A | | 68 | 69 | ,-----------. - `---' `------------------------' `------------------------' `---------' | 64| 65| 52| - ,-------------------------------------------------------------. ,---. ,---------------| - | 0B| 0C| 0D| 0E| 0F| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19 | | 6A| | 4B| 4C| 4D| 4E| - |-------------------------------------------------------------| |---| |---------------| - | 1A | 1B| 1C| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| | | 6B| | 4F| 50| 51| 56| - |---------------------------------------------------------' | |---| |---------------| - | 28 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 35 | | 6C| | 53| 54| 55| | - |-------------------------------------------------------------| |---| |-----------| 5A| - | 36 | 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42 | | 6D| | 57| 59| 58| | - |-------------------------------------------------------------| |---| |---------------| - | 43 | 44 | 45 | 46 | 47 | 48| 49| 4A | | 6E| | 66| 5B| 5C| 5D| - `-------------------------------------------------------------' `---' `---------------' -*/ diff --git a/protocol/news.h b/protocol/news.h deleted file mode 100644 index 35e09c4d20..0000000000 --- a/protocol/news.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2012 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef NEWS_H -#define NEWS_H -/* - * Primitive PS/2 Library for AVR - */ - - -/* host role */ -void news_init(void); -uint8_t news_recv(void); - -/* device role */ - -#endif diff --git a/protocol/next_kbd.c b/protocol/next_kbd.c deleted file mode 100644 index a5a07a7a85..0000000000 --- a/protocol/next_kbd.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - -NeXT non-ADB Keyboard Protocol - -Copyright 2013, Benjamin Gould (bgould@github.com) - -Based on: -TMK firmware code Copyright 2011,2012 Jun WAKO -Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license - -Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB -Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html -Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/ - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include -#include -#include -#include -#include "next_kbd.h" -#include "debug.h" - -static inline void out_lo(void); -static inline void out_hi(void); -static inline void query(void); -static inline void reset(void); -static inline uint32_t response(void); - -#define out_hi_delay(intervals) do { out_hi(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define out_lo_delay(intervals) do { out_lo(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define query_delay(intervals) do { query(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); -#define reset_delay(intervals) do { reset(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); - -void next_kbd_init(void) -{ - out_hi(); - NEXT_KBD_IN_DDR &= ~(1< -Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license - -Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB -Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html -Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/ - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ - -#include - -#ifndef NEXT_KBD_H -#define NEXT_KBD_H - -#define NEXT_KBD_KMBUS_IDLE 0x300600 -#define NEXT_KBD_TIMING 50 - -extern uint8_t next_kbd_error; - -/* host role */ -void next_kbd_init(void); -void next_kbd_set_leds(bool left, bool right); -uint32_t next_kbd_recv(void); - -#endif diff --git a/protocol/pjrc.mk b/protocol/pjrc.mk deleted file mode 100644 index 36585de7df..0000000000 --- a/protocol/pjrc.mk +++ /dev/null @@ -1,26 +0,0 @@ -PJRC_DIR = protocol/pjrc - -SRC += $(PJRC_DIR)/main.c \ - $(PJRC_DIR)/pjrc.c \ - $(PJRC_DIR)/usb_keyboard.c \ - $(PJRC_DIR)/usb_debug.c \ - $(PJRC_DIR)/usb.c - -# Option modules -ifdef MOUSEKEY_ENABLE - SRC += $(PJRC_DIR)/usb_mouse.c -endif - -ifdef PS2_MOUSE_ENABLE - SRC += $(PJRC_DIR)/usb_mouse.c -endif - -ifdef EXTRAKEY_ENABLE - SRC += $(PJRC_DIR)/usb_extra.c -endif - -# Search Path -VPATH += $(TMK_DIR)/$(PJRC_DIR) - -# This indicates using LUFA stack -OPT_DEFS += -DPROTOCOL_PJRC diff --git a/protocol/pjrc/MEMO.txt b/protocol/pjrc/MEMO.txt deleted file mode 100644 index b0f0598313..0000000000 --- a/protocol/pjrc/MEMO.txt +++ /dev/null @@ -1,25 +0,0 @@ -Endpoint configuration ----------------------- -0 Control endpoint -1 keyboard -2 mouse -3 debug -4 extra key(consumer/system) -5 nkro keyboard(supported only on ATmega32U4/16U4 and AT90USB64/128) - - -ATmega32U4/16U4, AT90USB64/128 -• Endpoint 0:programmable size FIFO up to 64 bytes, default control endpoint -• Endpoints 1 programmable size FIFO up to 256 bytes in ping-pong mode. -• Endpoints 2 to 6: programmable size FIFO up to 64 bytes in ping-pong mode. - -AT90USB82/162, ATmega8U2/16U2/32U2 -• Endpoint 0:programmable size FIFO up to 64 bytes, default control endpoint -• Endpoints 1 and 2: programmable size FIFO up to 64 bytes. -• Endpoints 3 and 4: programmable size FIFO up to 64 bytes with ping-pong mode. - -ping-pong mode means double buffer feature. - - -NOTE: ATmega8U2/16U2/32U2 is not supported with PJRC stack at this time. -TODO: Macro definition for ATmega8U2/16U2/32U2 in usb.h diff --git a/protocol/pjrc/main.c b/protocol/pjrc/main.c deleted file mode 100644 index e7bdcc059a..0000000000 --- a/protocol/pjrc/main.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Keyboard example with debug channel, for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_keyboard.html - * Copyright (c) 2008 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include "keyboard.h" -#include "usb.h" -#include "matrix.h" -#include "print.h" -#include "debug.h" -#include "sendchar.h" -#include "util.h" -#include "suspend.h" -#include "host.h" -#include "pjrc.h" - - -#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) - - -int main(void) -{ - // set for 16 MHz clock - CPU_PRESCALE(0); - - // Initialize the USB, and then wait for the host to set configuration. - // If the Teensy is powered without a PC connected to the USB port, - // this will wait forever. - usb_init(); - while (!usb_configured()) /* wait */ ; - - print_set_sendchar(sendchar); - - keyboard_init(); - host_set_driver(pjrc_driver()); -#ifdef SLEEP_LED_ENABLE - sleep_led_init(); -#endif - while (1) { - while (suspend) { - suspend_power_down(); - if (remote_wakeup && suspend_wakeup_condition()) { - usb_remote_wakeup(); - } - } - - keyboard_task(); - } -} diff --git a/protocol/pjrc/pjrc.c b/protocol/pjrc/pjrc.c deleted file mode 100644 index 0562a12ffa..0000000000 --- a/protocol/pjrc/pjrc.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include "usb_keyboard.h" -#include "usb_mouse.h" -#include "usb_extra.h" -#include "host_driver.h" -#include "pjrc.h" - - -/*------------------------------------------------------------------* - * Host driver - *------------------------------------------------------------------*/ -static uint8_t keyboard_leds(void); -static void send_keyboard(report_keyboard_t *report); -static void send_mouse(report_mouse_t *report); -static void send_system(uint16_t data); -static void send_consumer(uint16_t data); - -static host_driver_t driver = { - keyboard_leds, - send_keyboard, - send_mouse, - send_system, - send_consumer -}; - -host_driver_t *pjrc_driver(void) -{ - return &driver; -} - -static uint8_t keyboard_leds(void) { - return usb_keyboard_leds; -} - -static void send_keyboard(report_keyboard_t *report) -{ - usb_keyboard_send_report(report); -} - -static void send_mouse(report_mouse_t *report) -{ -#ifdef MOUSE_ENABLE - usb_mouse_send(report->x, report->y, report->v, report->h, report->buttons); -#endif -} - -static void send_system(uint16_t data) -{ -#ifdef EXTRAKEY_ENABLE - usb_extra_system_send(data); -#endif -} - -static void send_consumer(uint16_t data) -{ -#ifdef EXTRAKEY_ENABLE - usb_extra_consumer_send(data); -#endif -} diff --git a/protocol/pjrc/pjrc.h b/protocol/pjrc/pjrc.h deleted file mode 100644 index 06e79626fc..0000000000 --- a/protocol/pjrc/pjrc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef PJRC_H -#define PJRC_H - -#include "host_driver.h" - - -host_driver_t *pjrc_driver(void); - -#endif diff --git a/protocol/pjrc/usb.c b/protocol/pjrc/usb.c deleted file mode 100644 index 1e6ba8719a..0000000000 --- a/protocol/pjrc/usb.c +++ /dev/null @@ -1,1002 +0,0 @@ -/* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_keyboard.html - * Copyright (c) 2009 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include "usb.h" -#include "usb_keyboard.h" -#include "usb_mouse.h" -#include "usb_debug.h" -#include "usb_extra.h" -#include "led.h" -#include "print.h" -#include "util.h" -#ifdef SLEEP_LED_ENABLE -#include "sleep_led.h" -#endif -#include "suspend.h" -#include "action.h" -#include "action_util.h" - - -/************************************************************************** - * - * Configurable Options - * - **************************************************************************/ - -// You can change these to give your code its own name. -#ifndef MANUFACTURER -# define STR_MANUFACTURER L"t.m.k." -#else -# define STR_MANUFACTURER LSTR(MANUFACTURER) -#endif -#ifndef PRODUCT -# define STR_PRODUCT L"t.m.k. keyboard" -#else -# define STR_PRODUCT LSTR(PRODUCT) -#endif - - -// Mac OS-X and Linux automatically load the correct drivers. On -// Windows, even though the driver is supplied by Microsoft, an -// INF file is needed to load the driver. These numbers need to -// match the INF file. -#ifndef VENDOR_ID -# define VENDOR_ID 0xFEED -#endif - -#ifndef PRODUCT_ID -# define PRODUCT_ID 0xBABE -#endif - -#ifndef DEVICE_VER -# define DEVICE_VER 0x0100 -#endif - - -// USB devices are supposed to implment a halt feature, which is -// rarely (if ever) used. If you comment this line out, the halt -// code will be removed, saving 102 bytes of space (gcc 4.3.0). -// This is not strictly USB compliant, but works with all major -// operating systems. -#define SUPPORT_ENDPOINT_HALT - - - -/************************************************************************** - * - * Endpoint Buffer Configuration - * - **************************************************************************/ - -#define ENDPOINT0_SIZE 32 - -bool remote_wakeup = false; -bool suspend = false; - -// 0:control endpoint is enabled automatically by controller. -static const uint8_t PROGMEM endpoint_config_table[] = { - // enable, UECFG0X(type, direction), UECFG1X(size, bank, allocation) - 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(KBD_SIZE) | KBD_BUFFER, // 1 -#ifdef MOUSE_ENABLE - 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(MOUSE_SIZE) | MOUSE_BUFFER, // 2 -#else - 0, // 2 -#endif -#ifdef CONSOLE_ENABLE - 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER, // 3 -#else - 0, -#endif -#ifdef EXTRAKEY_ENABLE - 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(EXTRA_SIZE) | EXTRA_BUFFER, // 4 -#else - 0, // 4 -#endif -#ifdef NKRO_ENABLE - 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(KBD2_SIZE) | KBD2_BUFFER, // 5 -#else - 0, // 5 -#endif - 0, // 6 -}; - - -/************************************************************************** - * - * Descriptor Data - * - **************************************************************************/ - -// Descriptors are the data that your computer reads when it auto-detects -// this USB device (called "enumeration" in USB lingo). The most commonly -// changed items are editable at the top of this file. Changing things -// in here should only be done by those who've read chapter 9 of the USB -// spec and relevant portions of any USB class specifications! - - -static const uint8_t PROGMEM device_descriptor[] = { - 18, // bLength - 1, // bDescriptorType - 0x00, 0x02, // bcdUSB - 0, // bDeviceClass - 0, // bDeviceSubClass - 0, // bDeviceProtocol - ENDPOINT0_SIZE, // bMaxPacketSize0 - LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor - LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct - LSB(DEVICE_VER), MSB(DEVICE_VER), // bcdDevice - 1, // iManufacturer - 2, // iProduct - 0, // iSerialNumber - 1 // bNumConfigurations -}; - -// Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60 -static const uint8_t PROGMEM keyboard_hid_report_desc[] = { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application), - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte - 0x95, 0x01, // Report Count (1), - 0x75, 0x08, // Report Size (8), - 0x81, 0x03, // Input (Constant), ;Reserved byte - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x91, 0x03, // Output (Constant), ;LED report padding - 0x95, KBD_REPORT_KEYS, // Report Count (), - 0x75, 0x08, // Report Size (8), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0xFF, // Logical Maximum(255), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, 0xFF, // Usage Maximum (255), - 0x81, 0x00, // Input (Data, Array), - 0xc0 // End Collection -}; -#ifdef NKRO_ENABLE -static const uint8_t PROGMEM keyboard2_hid_report_desc[] = { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application), - // bitmap of modifiers - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte - // LED output report - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x91, 0x03, // Output (Constant), - // bitmap of keys - 0x95, KBD2_REPORT_KEYS*8, // Report Count (), - 0x75, 0x01, // Report Size (1), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum(1), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, KBD2_REPORT_KEYS*8-1, // Usage Maximum (), - 0x81, 0x02, // Input (Data, Variable, Absolute), - 0xc0 // End Collection -}; -#endif - -#ifdef MOUSE_ENABLE -// Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension -// http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 -// http://www.keil.com/forum/15671/ -// http://www.microsoft.com/whdc/device/input/wheel.mspx -static const uint8_t PROGMEM mouse_hid_report_desc[] = { - /* mouse */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - //0x85, REPORT_ID_MOUSE, // REPORT_ID (1) - 0x09, 0x01, // USAGE (Pointer) - 0xa1, 0x00, // COLLECTION (Physical) - // ---------------------------- Buttons - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x05, // USAGE_MAXIMUM (Button 5) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x05, // REPORT_COUNT (5) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x75, 0x03, // REPORT_SIZE (3) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - // ---------------------------- X,Y position - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x02, // REPORT_COUNT (2) - 0x81, 0x06, // INPUT (Data,Var,Rel) - // ---------------------------- Vertical wheel - 0x09, 0x38, // USAGE (Wheel) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x35, 0x00, // PHYSICAL_MINIMUM (0) - reset physical - 0x45, 0x00, // PHYSICAL_MAXIMUM (0) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x06, // INPUT (Data,Var,Rel) - // ---------------------------- Horizontal wheel - 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) - 0x0a, 0x38, 0x02, // USAGE (AC Pan) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x06, // INPUT (Data,Var,Rel) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION -}; -#endif - -static const uint8_t PROGMEM debug_hid_report_desc[] = { - 0x06, 0x31, 0xFF, // Usage Page 0xFF31 (vendor defined) - 0x09, 0x74, // Usage 0x74 - 0xA1, 0x53, // Collection 0x53 - 0x75, 0x08, // report size = 8 bits - 0x15, 0x00, // logical minimum = 0 - 0x26, 0xFF, 0x00, // logical maximum = 255 - 0x95, DEBUG_TX_SIZE, // report count - 0x09, 0x75, // usage - 0x81, 0x02, // Input (array) - 0xC0 // end collection -}; - -#ifdef EXTRAKEY_ENABLE -// audio controls & system controls -// http://www.microsoft.com/whdc/archive/w2kbd.mspx -static const uint8_t PROGMEM extra_hid_report_desc[] = { - /* system control */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x80, // USAGE (System Control) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) - 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) - 0x19, 0x01, // USAGE_MINIMUM (0x1) - 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x00, // INPUT (Data,Array,Abs) - 0xc0, // END_COLLECTION - /* consumer */ - 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) - 0x09, 0x01, // USAGE (Consumer Control) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_CONSUMER, // REPORT_ID (3) - 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x26, 0x9c, 0x02, // LOGICAL_MAXIMUM (0x29c) - 0x19, 0x01, // USAGE_MINIMUM (0x1) - 0x2a, 0x9c, 0x02, // USAGE_MAXIMUM (0x29c) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x00, // INPUT (Data,Array,Abs) - 0xc0, // END_COLLECTION -}; -#endif - -#define KBD_HID_DESC_NUM 0 -#define KBD_HID_DESC_OFFSET (9+(9+9+7)*KBD_HID_DESC_NUM+9) - -#ifdef MOUSE_ENABLE -# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 1) -# define MOUSE_HID_DESC_OFFSET (9+(9+9+7)*MOUSE_HID_DESC_NUM+9) -#else -# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 0) -#endif - -#ifdef CONSOLE_ENABLE -#define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1) -#define DEBUG_HID_DESC_OFFSET (9+(9+9+7)*DEBUG_HID_DESC_NUM+9) -#else -# define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 0) -#endif - -#ifdef EXTRAKEY_ENABLE -# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 1) -# define EXTRA_HID_DESC_OFFSET (9+(9+9+7)*EXTRA_HID_DESC_NUM+9) -#else -# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 0) -#endif - -#ifdef NKRO_ENABLE -# define KBD2_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 1) -# define KBD2_HID_DESC_OFFSET (9+(9+9+7)*EXTRA_HID_DESC_NUM+9) -#else -# define KBD2_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 0) -#endif - -#define NUM_INTERFACES (KBD2_HID_DESC_NUM + 1) -#define CONFIG1_DESC_SIZE (9+(9+9+7)*NUM_INTERFACES) -static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = { - // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10 - 9, // bLength; - 2, // bDescriptorType; - LSB(CONFIG1_DESC_SIZE), // wTotalLength - MSB(CONFIG1_DESC_SIZE), - NUM_INTERFACES, // bNumInterfaces - 1, // bConfigurationValue - 0, // iConfiguration - 0xA0, // bmAttributes - 50, // bMaxPower - - // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 - 9, // bLength - 4, // bDescriptorType - KBD_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass (0x03 = HID) - 0x01, // bInterfaceSubClass (0x01 = Boot) - 0x01, // bInterfaceProtocol (0x01 = Keyboard) - 0, // iInterface - // HID descriptor, HID 1.11 spec, section 6.2.1 - 9, // bLength - 0x21, // bDescriptorType - 0x11, 0x01, // bcdHID - 0, // bCountryCode - 1, // bNumDescriptors - 0x22, // bDescriptorType - sizeof(keyboard_hid_report_desc), // wDescriptorLength - 0, - // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 - 7, // bLength - 5, // bDescriptorType - KBD_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (0x03=intr) - KBD_SIZE, 0, // wMaxPacketSize - 10, // bInterval - -#ifdef MOUSE_ENABLE - // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 - 9, // bLength - 4, // bDescriptorType - MOUSE_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass (0x03 = HID) - // ThinkPad T23 BIOS doesn't work with boot mouse. - 0x00, // bInterfaceSubClass (0x01 = Boot) - 0x00, // bInterfaceProtocol (0x02 = Mouse) -/* - 0x01, // bInterfaceSubClass (0x01 = Boot) - 0x02, // bInterfaceProtocol (0x02 = Mouse) -*/ - 0, // iInterface - // HID descriptor, HID 1.11 spec, section 6.2.1 - 9, // bLength - 0x21, // bDescriptorType - 0x11, 0x01, // bcdHID - 0, // bCountryCode - 1, // bNumDescriptors - 0x22, // bDescriptorType - sizeof(mouse_hid_report_desc), // wDescriptorLength - 0, - // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 - 7, // bLength - 5, // bDescriptorType - MOUSE_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (0x03=intr) - MOUSE_SIZE, 0, // wMaxPacketSize - 1, // bInterval -#endif - -#ifdef CONSOLE_ENABLE - // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 - 9, // bLength - 4, // bDescriptorType - DEBUG_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass (0x03 = HID) - 0x00, // bInterfaceSubClass - 0x00, // bInterfaceProtocol - 0, // iInterface - // HID descriptor, HID 1.11 spec, section 6.2.1 - 9, // bLength - 0x21, // bDescriptorType - 0x11, 0x01, // bcdHID - 0, // bCountryCode - 1, // bNumDescriptors - 0x22, // bDescriptorType - sizeof(debug_hid_report_desc), // wDescriptorLength - 0, - // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 - 7, // bLength - 5, // bDescriptorType - DEBUG_TX_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (0x03=intr) - DEBUG_TX_SIZE, 0, // wMaxPacketSize - 1, // bInterval -#endif - -#ifdef EXTRAKEY_ENABLE - // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 - 9, // bLength - 4, // bDescriptorType - EXTRA_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass (0x03 = HID) - 0x00, // bInterfaceSubClass - 0x00, // bInterfaceProtocol - 0, // iInterface - // HID descriptor, HID 1.11 spec, section 6.2.1 - 9, // bLength - 0x21, // bDescriptorType - 0x11, 0x01, // bcdHID - 0, // bCountryCode - 1, // bNumDescriptors - 0x22, // bDescriptorType - sizeof(extra_hid_report_desc), // wDescriptorLength - 0, - // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 - 7, // bLength - 5, // bDescriptorType - EXTRA_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (0x03=intr) - EXTRA_SIZE, 0, // wMaxPacketSize - 10, // bInterval -#endif - -#ifdef NKRO_ENABLE - // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 - 9, // bLength - 4, // bDescriptorType - KBD2_INTERFACE, // bInterfaceNumber - 0, // bAlternateSetting - 1, // bNumEndpoints - 0x03, // bInterfaceClass (0x03 = HID) - 0x00, // bInterfaceSubClass (0x01 = Boot) - 0x00, // bInterfaceProtocol (0x01 = Keyboard) - 0, // iInterface - // HID descriptor, HID 1.11 spec, section 6.2.1 - 9, // bLength - 0x21, // bDescriptorType - 0x11, 0x01, // bcdHID - 0, // bCountryCode - 1, // bNumDescriptors - 0x22, // bDescriptorType - sizeof(keyboard2_hid_report_desc), // wDescriptorLength - 0, - // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 - 7, // bLength - 5, // bDescriptorType - KBD2_ENDPOINT | 0x80, // bEndpointAddress - 0x03, // bmAttributes (0x03=intr) - KBD2_SIZE, 0, // wMaxPacketSize - 1, // bInterval -#endif -}; - -// If you're desperate for a little extra code memory, these strings -// can be completely removed if iManufacturer, iProduct, iSerialNumber -// in the device desciptor are changed to zeros. -struct usb_string_descriptor_struct { - uint8_t bLength; - uint8_t bDescriptorType; - int16_t wString[]; -}; -static const struct usb_string_descriptor_struct PROGMEM string0 = { - 4, - 3, - {0x0409} -}; -static const struct usb_string_descriptor_struct PROGMEM string1 = { - sizeof(STR_MANUFACTURER), - 3, - STR_MANUFACTURER -}; -static const struct usb_string_descriptor_struct PROGMEM string2 = { - sizeof(STR_PRODUCT), - 3, - STR_PRODUCT -}; - -// This table defines which descriptor data is sent for each specific -// request from the host (in wValue and wIndex). -static const struct descriptor_list_struct { - uint16_t wValue; // descriptor type - uint16_t wIndex; - const uint8_t *addr; - uint8_t length; -} PROGMEM descriptor_list[] = { - // DEVICE descriptor - {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)}, - // CONFIGURATION descriptor - {0x0200, 0x0000, config1_descriptor, sizeof(config1_descriptor)}, - // HID/REPORT descriptors - {0x2100, KBD_INTERFACE, config1_descriptor+KBD_HID_DESC_OFFSET, 9}, - {0x2200, KBD_INTERFACE, keyboard_hid_report_desc, sizeof(keyboard_hid_report_desc)}, -#ifdef MOUSE_ENABLE - {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9}, - {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)}, -#endif -#ifdef CONSOLE_ENABLE - {0x2100, DEBUG_INTERFACE, config1_descriptor+DEBUG_HID_DESC_OFFSET, 9}, - {0x2200, DEBUG_INTERFACE, debug_hid_report_desc, sizeof(debug_hid_report_desc)}, -#endif -#ifdef EXTRAKEY_ENABLE - {0x2100, EXTRA_INTERFACE, config1_descriptor+EXTRA_HID_DESC_OFFSET, 9}, - {0x2200, EXTRA_INTERFACE, extra_hid_report_desc, sizeof(extra_hid_report_desc)}, -#endif -#ifdef NKRO_ENABLE - {0x2100, KBD2_INTERFACE, config1_descriptor+KBD2_HID_DESC_OFFSET, 9}, - {0x2200, KBD2_INTERFACE, keyboard2_hid_report_desc, sizeof(keyboard2_hid_report_desc)}, -#endif - // STRING descriptors - {0x0300, 0x0000, (const uint8_t *)&string0, 4}, - {0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)}, - {0x0302, 0x0409, (const uint8_t *)&string2, sizeof(STR_PRODUCT)} -}; -#define NUM_DESC_LIST (sizeof(descriptor_list)/sizeof(struct descriptor_list_struct)) - - -/************************************************************************** - * - * Variables - these are the only non-stack RAM usage - * - **************************************************************************/ - -// zero when we are not configured, non-zero when enumerated -static volatile uint8_t usb_configuration=0; - - -/************************************************************************** - * - * Public Functions - these are the API intended for the user - * - **************************************************************************/ - - -// initialize USB -void usb_init(void) -{ - HW_CONFIG(); - USB_FREEZE(); // enable USB - PLL_CONFIG(); // config PLL - while (!(PLLCSR & (1<mods; - UEDATX = 0; - uint8_t keys = keyboard_protocol ? KBD_REPORT_KEYS : 6; - for (uint8_t i=0; ikeys[i]; - } - UEINTX = 0x3A; -*/ - } - } - } - } -} - - - -// Misc functions to wait for ready and send/receive packets -static inline void usb_wait_in_ready(void) -{ - while (!(UEINTX & (1<= NUM_DESC_LIST) { - UECONX = (1< desc_length) len = desc_length; - do { - // wait for host ready for IN packet - do { - i = UEINTX; - } while (!(i & ((1<= 1 && i <= MAX_ENDPOINT) { - usb_send_in(); - UENUM = i; - if (bRequest == SET_FEATURE) { - UECONX = (1<mods; - UEDATX = 0; - for (i=0; i<6; i++) { - UEDATX = keyboard_report->keys[i]; - } - usb_send_in(); - return; - } - if (bRequest == HID_GET_IDLE) { - usb_wait_in_ready(); - UEDATX = keyboard_idle; - usb_send_in(); - return; - } - if (bRequest == HID_GET_PROTOCOL) { - usb_wait_in_ready(); - UEDATX = keyboard_protocol; - usb_send_in(); - return; - } - } - if (bmRequestType == 0x21) { - if (bRequest == HID_SET_REPORT) { - usb_wait_receive_out(); - usb_keyboard_leds = UEDATX; - usb_ack_out(); - usb_send_in(); - return; - } - if (bRequest == HID_SET_IDLE) { - keyboard_idle = (wValue >> 8); - usb_keyboard_idle_count = 0; - //usb_wait_in_ready(); - usb_send_in(); - return; - } - if (bRequest == HID_SET_PROTOCOL) { - keyboard_protocol = wValue; -#ifdef NKRO_ENABLE - keyboard_nkro = !!keyboard_protocol; -#endif - clear_keyboard(); - //usb_wait_in_ready(); - usb_send_in(); - return; - } - } - } -#ifdef MOUSE_ENABLE - if (wIndex == MOUSE_INTERFACE) { - if (bmRequestType == 0xA1) { - if (bRequest == HID_GET_REPORT) { - if (wValue == HID_REPORT_INPUT) { - usb_wait_in_ready(); - UEDATX = 0; - UEDATX = 0; - UEDATX = 0; - UEDATX = 0; - usb_send_in(); - return; - } - if (wValue == HID_REPORT_FEATURE) { - usb_wait_in_ready(); - UEDATX = 0x05; - usb_send_in(); - return; - } - } - if (bRequest == HID_GET_PROTOCOL) { - usb_wait_in_ready(); - UEDATX = usb_mouse_protocol; - usb_send_in(); - return; - } - } - if (bmRequestType == 0x21) { - if (bRequest == HID_SET_PROTOCOL) { - usb_mouse_protocol = wValue; - usb_send_in(); - return; - } - } - } -#endif - if (wIndex == DEBUG_INTERFACE) { - if (bRequest == HID_GET_REPORT && bmRequestType == 0xA1) { - len = wLength; - do { - // wait for host ready for IN packet - do { - i = UEINTX; - } while (!(i & ((1< -#include -#include - - -extern bool remote_wakeup; -extern bool suspend; - -void usb_init(void); // initialize everything -uint8_t usb_configured(void); // is the USB port configured -void usb_remote_wakeup(void); - - -#define EP_TYPE_CONTROL 0x00 -#define EP_TYPE_BULK_IN 0x81 -#define EP_TYPE_BULK_OUT 0x80 -#define EP_TYPE_INTERRUPT_IN 0xC1 -#define EP_TYPE_INTERRUPT_OUT 0xC0 -#define EP_TYPE_ISOCHRONOUS_IN 0x41 -#define EP_TYPE_ISOCHRONOUS_OUT 0x40 - -#define EP_SINGLE_BUFFER 0x02 -#define EP_DOUBLE_BUFFER 0x06 - -#define EP_SIZE(s) ((s) == 64 ? 0x30 : \ - ((s) == 32 ? 0x20 : \ - ((s) == 16 ? 0x10 : \ - 0x00))) - -#if defined (__AVR_AT90USB162__) || defined (__AVR_AT90USB82__) -# define MAX_ENDPOINT 4 -# define UERST_MASK 0x1E -#else -# define MAX_ENDPOINT 6 -# define UERST_MASK 0x7E -#endif - -#define LSB(n) (n & 255) -#define MSB(n) ((n >> 8) & 255) - -#if defined(__AVR_AT90USB162__) -#define HW_CONFIG() -#define PLL_CONFIG() (PLLCSR = ((1< -#include "sendchar.h" -#include "usb_debug.h" - - -// the time remaining before we transmit any partially full -// packet, or send a zero length packet. -volatile uint8_t debug_flush_timer=0; - - -int8_t sendchar(uint8_t c) -{ - static uint8_t previous_timeout=0; - uint8_t timeout, intr_state; - - // if we're not online (enumerated and configured), error - if (!usb_configured()) return -1; - // interrupts are disabled so these functions can be - // used from the main program or interrupt context, - // even both in the same program! - intr_state = SREG; - cli(); - UENUM = DEBUG_TX_ENDPOINT; - // if we gave up due to timeout before, don't wait again - if (previous_timeout) { - if (!(UEINTX & (1< -#include "usb.h" - - -#define DEBUG_INTERFACE 2 -#define DEBUG_TX_ENDPOINT 3 -#define DEBUG_TX_SIZE 32 -#define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER - - -extern volatile uint8_t debug_flush_timer; - - -void usb_debug_flush_output(void); // immediately transmit any buffered output - -#endif diff --git a/protocol/pjrc/usb_extra.c b/protocol/pjrc/usb_extra.c deleted file mode 100644 index fe1f422c0d..0000000000 --- a/protocol/pjrc/usb_extra.c +++ /dev/null @@ -1,70 +0,0 @@ -/* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_keyboard.html - * Copyright (c) 2009 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include -#include "host.h" -#include "usb_extra.h" - - -int8_t usb_extra_send(uint8_t report_id, uint16_t data) -{ - uint8_t intr_state, timeout; - - if (!usb_configured()) return -1; - intr_state = SREG; - cli(); - UENUM = EXTRA_ENDPOINT; - timeout = UDFNUML + 50; - while (1) { - // are we ready to transmit? - if (UEINTX & (1<>8)&0xFF; - - UEINTX = 0x3A; - SREG = intr_state; - return 0; -} - -int8_t usb_extra_consumer_send(uint16_t bits) -{ - return usb_extra_send(REPORT_ID_CONSUMER, bits); -} - -int8_t usb_extra_system_send(uint16_t bits) -{ - return usb_extra_send(REPORT_ID_SYSTEM, bits); -} diff --git a/protocol/pjrc/usb_extra.h b/protocol/pjrc/usb_extra.h deleted file mode 100644 index 042ac48373..0000000000 --- a/protocol/pjrc/usb_extra.h +++ /dev/null @@ -1,46 +0,0 @@ -/* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_keyboard.html - * Copyright (c) 2009 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef USB_EXTRA_H -#define USB_EXTRA_H 1 -/* - * Enhanced keyboard features for Windows: - * Audio control and System control - * - * http://www.microsoft.com/whdc/archive/w2kbd.mspx - */ - -#include -#include "usb.h" - - -#define EXTRA_INTERFACE 3 -#define EXTRA_ENDPOINT 4 -#define EXTRA_SIZE 8 -#define EXTRA_BUFFER EP_DOUBLE_BUFFER - - -int8_t usb_extra_consumer_send(uint16_t bits); -int8_t usb_extra_system_send(uint16_t bits); - -#endif diff --git a/protocol/pjrc/usb_keyboard.c b/protocol/pjrc/usb_keyboard.c deleted file mode 100644 index 4b87b5d7b5..0000000000 --- a/protocol/pjrc/usb_keyboard.c +++ /dev/null @@ -1,110 +0,0 @@ -/* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_keyboard.html - * Copyright (c) 2009 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include -#include "keycode.h" -#include "usb_keyboard.h" -#include "print.h" -#include "debug.h" -#include "util.h" -#include "host.h" - - -// protocol setting from the host. We use exactly the same report -// either way, so this variable only stores the setting since we -// are required to be able to report which setting is in use. -uint8_t keyboard_protocol=1; - -// the idle configuration, how often we send the report to the -// host (ms * 4) even when it hasn't changed -// Windows and Linux set 0 while OS X sets 6(24ms) by SET_IDLE request. -uint8_t keyboard_idle=125; - -// count until idle timeout -uint8_t usb_keyboard_idle_count=0; - -// 1=num lock, 2=caps lock, 4=scroll lock, 8=compose, 16=kana -volatile uint8_t usb_keyboard_leds=0; - - -static inline int8_t send_report(report_keyboard_t *report, uint8_t endpoint, uint8_t keys_start, uint8_t keys_end); - - -int8_t usb_keyboard_send_report(report_keyboard_t *report) -{ - int8_t result = 0; - -#ifdef NKRO_ENABLE - if (keyboard_nkro) - result = send_report(report, KBD2_ENDPOINT, 0, KBD2_SIZE); - else -#endif - { - result = send_report(report, KBD_ENDPOINT, 0, KBD_SIZE); - } - - if (result) return result; - usb_keyboard_idle_count = 0; - usb_keyboard_print_report(report); - return 0; -} - -void usb_keyboard_print_report(report_keyboard_t *report) -{ - if (!debug_keyboard) return; - print("keys: "); - for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); } - print(" mods: "); phex(report->mods); print("\n"); -} - - -static inline int8_t send_report(report_keyboard_t *report, uint8_t endpoint, uint8_t keys_start, uint8_t keys_end) -{ - uint8_t intr_state, timeout; - - if (!usb_configured()) return -1; - intr_state = SREG; - cli(); - UENUM = endpoint; - timeout = UDFNUML + 50; - while (1) { - // are we ready to transmit? - if (UEINTX & (1<raw[i]; - } - UEINTX = 0x3A; - SREG = intr_state; - return 0; -} diff --git a/protocol/pjrc/usb_keyboard.h b/protocol/pjrc/usb_keyboard.h deleted file mode 100644 index 9b798e9a86..0000000000 --- a/protocol/pjrc/usb_keyboard.h +++ /dev/null @@ -1,40 +0,0 @@ -/* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_keyboard.html - * Copyright (c) 2009 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef USB_KEYBOARD_H -#define USB_KEYBOARD_H 1 - -#include -#include -#include "usb.h" -#include "host.h" - - -extern uint8_t usb_keyboard_idle_count; -extern volatile uint8_t usb_keyboard_leds; - - -int8_t usb_keyboard_send_report(report_keyboard_t *report); -void usb_keyboard_print_report(report_keyboard_t *report); - -#endif diff --git a/protocol/pjrc/usb_mouse.c b/protocol/pjrc/usb_mouse.c deleted file mode 100644 index d81db756f3..0000000000 --- a/protocol/pjrc/usb_mouse.c +++ /dev/null @@ -1,81 +0,0 @@ -/* USB Mouse Plus Debug Channel Example for Teensy USB Development Board - * http://www.pjrc.com/teensy/usb_mouse.html - * Copyright (c) 2009 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include -#include "usb_mouse.h" -#include "print.h" -#include "debug.h" - - -uint8_t usb_mouse_protocol=1; - - -int8_t usb_mouse_send(int8_t x, int8_t y, int8_t wheel_v, int8_t wheel_h, uint8_t buttons) -{ - uint8_t intr_state, timeout; - - if (!usb_configured()) return -1; - if (x == -128) x = -127; - if (y == -128) y = -127; - if (wheel_v == -128) wheel_v = -127; - if (wheel_h == -128) wheel_h = -127; - intr_state = SREG; - cli(); - UENUM = MOUSE_ENDPOINT; - timeout = UDFNUML + 50; - while (1) { - // are we ready to transmit? - if (UEINTX & (1< -#include -#include "usb.h" - - -#define MOUSE_INTERFACE 1 -#define MOUSE_ENDPOINT 2 -#define MOUSE_SIZE 8 -#define MOUSE_BUFFER EP_SINGLE_BUFFER - -#define MOUSE_BTN1 (1<<0) -#define MOUSE_BTN2 (1<<1) -#define MOUSE_BTN3 (1<<2) -#define MOUSE_BTN4 (1<<3) -#define MOUSE_BTN5 (1<<4) - - -extern uint8_t usb_mouse_protocol; - - -int8_t usb_mouse_send(int8_t x, int8_t y, int8_t wheel_v, int8_t wheel_h, uint8_t buttons); -void usb_mouse_print(int8_t x, int8_t y, int8_t wheel_v, int8_t wheel_h, uint8_t buttons); - -#endif diff --git a/protocol/ps2.h b/protocol/ps2.h deleted file mode 100644 index acde679cf4..0000000000 --- a/protocol/ps2.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright 2010,2011,2012,2013 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef PS2_H -#define PS2_H - -#include -#include "wait.h" -#include "ps2_io.h" -#include "print.h" - -/* - * Primitive PS/2 Library for AVR - * - * PS/2 Resources - * -------------- - * [1] The PS/2 Mouse/Keyboard Protocol - * http://www.computer-engineering.org/ps2protocol/ - * Concise and thorough primer of PS/2 protocol. - * - * [2] Keyboard and Auxiliary Device Controller - * http://www.mcamafia.de/pdf/ibm_hitrc07.pdf - * Signal Timing and Format - * - * [3] Keyboards(101- and 102-key) - * http://www.mcamafia.de/pdf/ibm_hitrc11.pdf - * Keyboard Layout, Scan Code Set, POR, and Commands. - * - * [4] PS/2 Reference Manuals - * http://www.mcamafia.de/pdf/ibm_hitrc07.pdf - * Collection of IBM Personal System/2 documents. - * - * [5] TrackPoint Engineering Specifications for version 3E - * https://web.archive.org/web/20100526161812/http://wwwcssrv.almaden.ibm.com/trackpoint/download.html - */ -#define PS2_ACK 0xFA -#define PS2_RESEND 0xFE -#define PS2_SET_LED 0xED - -// TODO: error numbers -#define PS2_ERR_NONE 0 -#define PS2_ERR_STARTBIT1 1 -#define PS2_ERR_STARTBIT2 2 -#define PS2_ERR_STARTBIT3 3 -#define PS2_ERR_PARITY 0x10 -#define PS2_ERR_NODATA 0x20 - -#define PS2_LED_SCROLL_LOCK 0 -#define PS2_LED_NUM_LOCK 1 -#define PS2_LED_CAPS_LOCK 2 - - -extern uint8_t ps2_error; - -void ps2_host_init(void); -uint8_t ps2_host_send(uint8_t data); -uint8_t ps2_host_recv_response(void); -uint8_t ps2_host_recv(void); -void ps2_host_set_led(uint8_t usb_led); - - -/*-------------------------------------------------------------------- - * static functions - *------------------------------------------------------------------*/ -static inline uint16_t wait_clock_lo(uint16_t us) -{ - while (clock_in() && us) { asm(""); wait_us(1); us--; } - return us; -} -static inline uint16_t wait_clock_hi(uint16_t us) -{ - while (!clock_in() && us) { asm(""); wait_us(1); us--; } - return us; -} -static inline uint16_t wait_data_lo(uint16_t us) -{ - while (data_in() && us) { asm(""); wait_us(1); us--; } - return us; -} -static inline uint16_t wait_data_hi(uint16_t us) -{ - while (!data_in() && us) { asm(""); wait_us(1); us--; } - return us; -} - -/* idle state that device can send */ -static inline void idle(void) -{ - clock_hi(); - data_hi(); -} - -/* inhibit device to send */ -static inline void inhibit(void) -{ - clock_lo(); - data_hi(); -} - -#endif diff --git a/protocol/ps2_busywait.c b/protocol/ps2_busywait.c deleted file mode 100644 index a64933219e..0000000000 --- a/protocol/ps2_busywait.c +++ /dev/null @@ -1,189 +0,0 @@ -/* -Copyright 2010,2011,2012,2013 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * PS/2 protocol busywait version - */ - -#include -#include "wait.h" -#include "ps2.h" -#include "ps2_io.h" -#include "debug.h" - - -#define WAIT(stat, us, err) do { \ - if (!wait_##stat(us)) { \ - ps2_error = err; \ - goto ERROR; \ - } \ -} while (0) - - -uint8_t ps2_error = PS2_ERR_NONE; - - -void ps2_host_init(void) -{ - clock_init(); - data_init(); - - // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20) - wait_ms(2500); - - inhibit(); -} - -uint8_t ps2_host_send(uint8_t data) -{ - bool parity = true; - ps2_error = PS2_ERR_NONE; - - /* terminate a transmission if we have */ - inhibit(); - wait_us(100); // 100us [4]p.13, [5]p.50 - - /* 'Request to Send' and Start bit */ - data_lo(); - clock_hi(); - WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 - - /* Data bit */ - for (uint8_t i = 0; i < 8; i++) { - wait_us(15); - if (data&(1< PS2_ERR_STARTBIT3) { - xprintf("x%02X\n", ps2_error); - } - inhibit(); - return 0; -} - -/* send LED state to keyboard */ -void ps2_host_set_led(uint8_t led) -{ - ps2_host_send(0xED); - ps2_host_send(led); -} diff --git a/protocol/ps2_interrupt.c b/protocol/ps2_interrupt.c deleted file mode 100644 index 8114442bac..0000000000 --- a/protocol/ps2_interrupt.c +++ /dev/null @@ -1,279 +0,0 @@ -/* -Copyright 2010,2011,2012,2013 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * PS/2 protocol Pin interrupt version - */ - -#include -#include -#include -#include "ps2.h" -#include "ps2_io.h" -#include "print.h" - - -#define WAIT(stat, us, err) do { \ - if (!wait_##stat(us)) { \ - ps2_error = err; \ - goto ERROR; \ - } \ -} while (0) - - -uint8_t ps2_error = PS2_ERR_NONE; - - -static inline uint8_t pbuf_dequeue(void); -static inline void pbuf_enqueue(uint8_t data); -static inline bool pbuf_has_data(void); -static inline void pbuf_clear(void); - - -void ps2_host_init(void) -{ - idle(); - PS2_INT_INIT(); - PS2_INT_ON(); - // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20) - //_delay_ms(2500); -} - -uint8_t ps2_host_send(uint8_t data) -{ - bool parity = true; - ps2_error = PS2_ERR_NONE; - - PS2_INT_OFF(); - - /* terminate a transmission if we have */ - inhibit(); - _delay_us(100); // 100us [4]p.13, [5]p.50 - - /* 'Request to Send' and Start bit */ - data_lo(); - clock_hi(); - WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 - - /* Data bit[2-9] */ - for (uint8_t i = 0; i < 8; i++) { - _delay_us(15); - if (data&(1<>= 1; - if (data_in()) { - data |= 0x80; - parity++; - } - break; - case PARITY: - if (data_in()) { - if (!(parity & 0x01)) - goto ERROR; - } else { - if (parity & 0x01) - goto ERROR; - } - break; - case STOP: - if (!data_in()) - goto ERROR; - pbuf_enqueue(data); - goto DONE; - break; - default: - goto ERROR; - } - goto RETURN; -ERROR: - ps2_error = state; -DONE: - state = INIT; - data = 0; - parity = 1; -RETURN: - return; -} - -/* send LED state to keyboard */ -void ps2_host_set_led(uint8_t led) -{ - ps2_host_send(0xED); - ps2_host_send(led); -} - - -/*-------------------------------------------------------------------- - * Ring buffer to store scan codes from keyboard - *------------------------------------------------------------------*/ -#define PBUF_SIZE 32 -static uint8_t pbuf[PBUF_SIZE]; -static uint8_t pbuf_head = 0; -static uint8_t pbuf_tail = 0; -static inline void pbuf_enqueue(uint8_t data) -{ - uint8_t sreg = SREG; - cli(); - uint8_t next = (pbuf_head + 1) % PBUF_SIZE; - if (next != pbuf_tail) { - pbuf[pbuf_head] = data; - pbuf_head = next; - } else { - print("pbuf: full\n"); - } - SREG = sreg; -} -static inline uint8_t pbuf_dequeue(void) -{ - uint8_t val = 0; - - uint8_t sreg = SREG; - cli(); - if (pbuf_head != pbuf_tail) { - val = pbuf[pbuf_tail]; - pbuf_tail = (pbuf_tail + 1) % PBUF_SIZE; - } - SREG = sreg; - - return val; -} -static inline bool pbuf_has_data(void) -{ - uint8_t sreg = SREG; - cli(); - bool has_data = (pbuf_head != pbuf_tail); - SREG = sreg; - return has_data; -} -static inline void pbuf_clear(void) -{ - uint8_t sreg = SREG; - cli(); - pbuf_head = pbuf_tail = 0; - SREG = sreg; -} - diff --git a/protocol/ps2_io.h b/protocol/ps2_io.h deleted file mode 100644 index a46a358e7c..0000000000 --- a/protocol/ps2_io.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef PS2_IO_H -#define PS2_IO_H - - -void clock_init(void); -void clock_lo(void); -void clock_hi(void); -bool clock_in(void); - -void data_init(void); -void data_lo(void); -void data_hi(void); -bool data_in(void); - -#endif diff --git a/protocol/ps2_io_avr.c b/protocol/ps2_io_avr.c deleted file mode 100644 index ed462345ba..0000000000 --- a/protocol/ps2_io_avr.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include - -/* Check port settings for clock and data line */ -#if !(defined(PS2_CLOCK_PORT) && \ - defined(PS2_CLOCK_PIN) && \ - defined(PS2_CLOCK_DDR) && \ - defined(PS2_CLOCK_BIT)) -# error "PS/2 clock port setting is required in config.h" -#endif - -#if !(defined(PS2_DATA_PORT) && \ - defined(PS2_DATA_PIN) && \ - defined(PS2_DATA_DDR) && \ - defined(PS2_DATA_BIT)) -# error "PS/2 data port setting is required in config.h" -#endif - - -/* - * Clock - */ -void clock_init(void) -{ -} - -void clock_lo(void) -{ - PS2_CLOCK_PORT &= ~(1< -#include "ps2_io.h" -#include "gpio_api.h" - - -static gpio_t clock; -static gpio_t data; - -/* - * Clock - */ -void clock_init(void) -{ - gpio_init(&clock, P0_9); - gpio_mode(&clock, OpenDrain|PullNone); -} - -void clock_lo(void) -{ - gpio_dir(&clock, PIN_OUTPUT); - gpio_write(&clock, 0); -} -void clock_hi(void) -{ - gpio_dir(&clock, PIN_OUTPUT); - gpio_write(&clock, 1); -} - -bool clock_in(void) -{ - gpio_dir(&clock, PIN_INPUT); - return gpio_read(&clock); -} - -/* - * Data - */ -void data_init(void) -{ - gpio_init(&data, P0_8); - gpio_mode(&data, OpenDrain|PullNone); -} - -void data_lo(void) -{ - gpio_dir(&data, PIN_OUTPUT); - gpio_write(&data, 0); -} - -void data_hi(void) -{ - gpio_dir(&data, PIN_OUTPUT); - gpio_write(&data, 1); -} - -bool data_in(void) -{ - gpio_dir(&data, PIN_INPUT); - return gpio_read(&data); -} diff --git a/protocol/ps2_mouse.c b/protocol/ps2_mouse.c deleted file mode 100644 index c3e8b3c1c3..0000000000 --- a/protocol/ps2_mouse.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -Copyright 2011,2013 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include -#include -#include "ps2.h" -#include "ps2_mouse.h" -#include "report.h" -#include "host.h" -#include "timer.h" -#include "print.h" -#include "debug.h" - - -static report_mouse_t mouse_report = {}; - - -static void print_usb_data(void); - - -/* supports only 3 button mouse at this time */ -uint8_t ps2_mouse_init(void) { - uint8_t rcv; - - ps2_host_init(); - - _delay_ms(1000); // wait for powering up - - // send Reset - rcv = ps2_host_send(0xFF); - print("ps2_mouse_init: send Reset: "); - phex(rcv); phex(ps2_error); print("\n"); - - // read completion code of BAT - rcv = ps2_host_recv_response(); - print("ps2_mouse_init: read BAT: "); - phex(rcv); phex(ps2_error); print("\n"); - - // read Device ID - rcv = ps2_host_recv_response(); - print("ps2_mouse_init: read DevID: "); - phex(rcv); phex(ps2_error); print("\n"); - - // send Set Remote mode - rcv = ps2_host_send(0xF0); - print("ps2_mouse_init: send 0xF0: "); - phex(rcv); phex(ps2_error); print("\n"); - - return 0; -} - -#define X_IS_NEG (mouse_report.buttons & (1< - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef PS2_MOUSE_H -#define PS2_MOUSE_H - -#include - -#define PS2_MOUSE_READ_DATA 0xEB - -/* - * Data format: - * byte|7 6 5 4 3 2 1 0 - * ----+-------------------------------------------------------------- - * 0|Yovflw Xovflw Ysign Xsign 1 Middle Right Left - * 1| X movement(0-255) - * 2| Y movement(0-255) - */ -#define PS2_MOUSE_BTN_MASK 0x07 -#define PS2_MOUSE_BTN_LEFT 0 -#define PS2_MOUSE_BTN_RIGHT 1 -#define PS2_MOUSE_BTN_MIDDLE 2 -#define PS2_MOUSE_X_SIGN 4 -#define PS2_MOUSE_Y_SIGN 5 -#define PS2_MOUSE_X_OVFLW 6 -#define PS2_MOUSE_Y_OVFLW 7 - - -/* - * Scroll by mouse move with pressing button - */ -/* mouse button to start scrolling; set 0 to disable scroll */ -#ifndef PS2_MOUSE_SCROLL_BTN_MASK -#define PS2_MOUSE_SCROLL_BTN_MASK (1< - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * PS/2 protocol USART version - */ - -#include -#include -#include -#include "ps2.h" -#include "ps2_io.h" -#include "print.h" - - -#define WAIT(stat, us, err) do { \ - if (!wait_##stat(us)) { \ - ps2_error = err; \ - goto ERROR; \ - } \ -} while (0) - - -uint8_t ps2_error = PS2_ERR_NONE; - - -static inline uint8_t pbuf_dequeue(void); -static inline void pbuf_enqueue(uint8_t data); -static inline bool pbuf_has_data(void); -static inline void pbuf_clear(void); - - -void ps2_host_init(void) -{ - idle(); // without this many USART errors occur when cable is disconnected - PS2_USART_INIT(); - PS2_USART_RX_INT_ON(); - // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20) - //_delay_ms(2500); -} - -uint8_t ps2_host_send(uint8_t data) -{ - bool parity = true; - ps2_error = PS2_ERR_NONE; - - PS2_USART_OFF(); - - /* terminate a transmission if we have */ - inhibit(); - _delay_us(100); // [4]p.13 - - /* 'Request to Send' and Start bit */ - data_lo(); - clock_hi(); - WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 - - /* Data bit[2-9] */ - for (uint8_t i = 0; i < 8; i++) { - _delay_us(15); - if (data&(1< - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef SERIAL_H -#define SERIAL_H - -/* host role */ -void serial_init(void); -uint8_t serial_recv(void); -int16_t serial_recv2(void); -void serial_send(uint8_t data); - -#endif diff --git a/protocol/serial_mouse.h b/protocol/serial_mouse.h deleted file mode 100644 index 226314fc0e..0000000000 --- a/protocol/serial_mouse.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2014 Robin Haberkorn - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef SERIAL_MOUSE_H -#define SERIAL_MOUSE_H - -#include - -#include "serial.h" - -static inline uint8_t serial_mouse_init(void) -{ - serial_init(); - return 0; -} - -void serial_mouse_task(void); - -#endif diff --git a/protocol/serial_mouse_microsoft.c b/protocol/serial_mouse_microsoft.c deleted file mode 100644 index ab74b7cdd3..0000000000 --- a/protocol/serial_mouse_microsoft.c +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright 2014 Robin Haberkorn - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include -#include - -#include "serial.h" -#include "serial_mouse.h" -#include "report.h" -#include "host.h" -#include "timer.h" -#include "print.h" -#include "debug.h" - -#ifdef MAX -#undef MAX -#endif -#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) - -static void print_usb_data(const report_mouse_t *report); - -void serial_mouse_task(void) -{ - /* 3 byte ring buffer */ - static uint8_t buffer[3]; - static int buffer_cur = 0; - - static report_mouse_t report = {}; - - int16_t rcv; - - rcv = serial_recv2(); - if (rcv < 0) - /* no new data */ - return; - - if (debug_mouse) - xprintf("serial_mouse: byte: %04X\n", rcv); - - /* - * If bit 6 is one, this signals the beginning - * of a 3 byte sequence/packet. - */ - if (rcv & (1 << 6)) - buffer_cur = 0; - - buffer[buffer_cur] = (uint8_t)rcv; - - if (buffer_cur == 0 && buffer[buffer_cur] == 0x20) { - /* - * Logitech extension: This must be a follow-up on - * the last 3-byte packet signaling a middle button click - */ - report.buttons |= MOUSE_BTN3; - report.x = report.y = 0; - - print_usb_data(&report); - host_mouse_send(&report); - return; - } - - buffer_cur++; - - if (buffer_cur < 3) - return; - buffer_cur = 0; - - /* - * parse 3 byte packet. - * NOTE: We only get a complete packet - * if the mouse moved or the button states - * change. - */ - report.buttons = 0; - if (buffer[0] & (1 << 5)) - report.buttons |= MOUSE_BTN1; - if (buffer[0] & (1 << 4)) - report.buttons |= MOUSE_BTN2; - - report.x = (buffer[0] << 6) | buffer[1]; - report.y = ((buffer[0] << 4) & 0xC0) | buffer[2]; - - /* USB HID uses values from -127 to 127 only */ - report.x = MAX(report.x, -127); - report.y = MAX(report.y, -127); - -#if 0 - if (!report.buttons && !report.x && !report.y) { - /* - * Microsoft extension: Middle mouse button pressed - * FIXME: I don't know how exactly this extension works. - */ - report.buttons |= MOUSE_BTN3; - } -#endif - - print_usb_data(&report); - host_mouse_send(&report); -} - -static void print_usb_data(const report_mouse_t *report) -{ - if (!debug_mouse) - return; - - xprintf("serial_mouse usb: [%02X|%d %d %d %d]\n", - report->buttons, report->x, report->y, - report->v, report->h); -} diff --git a/protocol/serial_mouse_mousesystems.c b/protocol/serial_mouse_mousesystems.c deleted file mode 100644 index cfe8996216..0000000000 --- a/protocol/serial_mouse_mousesystems.c +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2014 Robin Haberkorn - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include -#include - -#include "serial.h" -#include "serial_mouse.h" -#include "report.h" -#include "host.h" -#include "timer.h" -#include "print.h" -#include "debug.h" - -#ifdef MAX -#undef MAX -#endif -#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) - -//#define SERIAL_MOUSE_CENTER_SCROLL - -static void print_usb_data(const report_mouse_t *report); - -void serial_mouse_task(void) -{ - /* 5 byte ring buffer */ - static uint8_t buffer[5]; - static int buffer_cur = 0; - - int16_t rcv; - - report_mouse_t report = {0, 0, 0, 0, 0}; - - rcv = serial_recv2(); - if (rcv < 0) - /* no new data */ - return; - - if (debug_mouse) - xprintf("serial_mouse: byte: %04X\n", rcv); - - /* - * Synchronization: mouse(4) says that all - * bytes but the first one in the packet have - * bit 7 == 0, but this is untrue. - * Therefore we discard all bytes up to the - * first one with the characteristic bit pattern. - */ - if (buffer_cur == 0 && (rcv >> 3) != 0x10) - return; - - buffer[buffer_cur++] = (uint8_t)rcv; - - if (buffer_cur < 5) - return; - buffer_cur = 0; - -#ifdef SERIAL_MOUSE_CENTER_SCROLL - if ((buffer[0] & 0x7) == 0x5 && (buffer[1] || buffer[2])) { - /* USB HID uses only values from -127 to 127 */ - report.h = MAX((int8_t)buffer[1], -127); - report.v = MAX((int8_t)buffer[2], -127); - - print_usb_data(&report); - host_mouse_send(&report); - - if (buffer[3] || buffer[4]) { - report.h = MAX((int8_t)buffer[3], -127); - report.v = MAX((int8_t)buffer[4], -127); - - print_usb_data(&report); - host_mouse_send(&report); - } - - return; - } -#endif - - /* - * parse 5 byte packet. - * NOTE: We only get a complete packet - * if the mouse moved or the button states - * change. - */ - if (!(buffer[0] & (1 << 2))) - report.buttons |= MOUSE_BTN1; - if (!(buffer[0] & (1 << 1))) - report.buttons |= MOUSE_BTN3; - if (!(buffer[0] & (1 << 0))) - report.buttons |= MOUSE_BTN2; - - /* USB HID uses only values from -127 to 127 */ - report.x = MAX((int8_t)buffer[1], -127); - report.y = MAX(-(int8_t)buffer[2], -127); - - print_usb_data(&report); - host_mouse_send(&report); - - if (buffer[3] || buffer[4]) { - report.x = MAX((int8_t)buffer[3], -127); - report.y = MAX(-(int8_t)buffer[4], -127); - - print_usb_data(&report); - host_mouse_send(&report); - } -} - -static void print_usb_data(const report_mouse_t *report) -{ - if (!debug_mouse) - return; - - xprintf("serial_mouse usb: [%02X|%d %d %d %d]\n", - report->buttons, report->x, report->y, - report->v, report->h); -} diff --git a/protocol/serial_soft.c b/protocol/serial_soft.c deleted file mode 100644 index 44822b7e43..0000000000 --- a/protocol/serial_soft.c +++ /dev/null @@ -1,240 +0,0 @@ -/* -Copyright 2012 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include -#include -#include "serial.h" - -/* - * Stupid Inefficient Busy-wait Software Serial - * which is still useful for negative logic signal like Sun protocol - * if it is not supported by hardware UART. - * - * TODO: delay is not accurate enough. Instruction cycle should be counted and inline assemby is needed. - */ - -#define WAIT_US (1000000L/SERIAL_SOFT_BAUD) - -#ifdef SERIAL_SOFT_LOGIC_NEGATIVE - #define SERIAL_SOFT_RXD_IN() !(SERIAL_SOFT_RXD_READ()) - #define SERIAL_SOFT_TXD_ON() SERIAL_SOFT_TXD_LO() - #define SERIAL_SOFT_TXD_OFF() SERIAL_SOFT_TXD_HI() -#else - #define SERIAL_SOFT_RXD_IN() !!(SERIAL_SOFT_RXD_READ()) - #define SERIAL_SOFT_TXD_ON() SERIAL_SOFT_TXD_HI() - #define SERIAL_SOFT_TXD_OFF() SERIAL_SOFT_TXD_LO() -#endif - -#ifdef SERIAL_SOFT_PARITY_EVEN - #define SERIAL_SOFT_PARITY_VAL 0 -#elif defined(SERIAL_SOFT_PARITY_ODD) - #define SERIAL_SOFT_PARITY_VAL 1 -#endif - -/* debug for signal timing, see debug pin with oscilloscope */ -#define SERIAL_SOFT_DEBUG -#ifdef SERIAL_SOFT_DEBUG - #define SERIAL_SOFT_DEBUG_INIT() (DDRD |= 1<<7) - #define SERIAL_SOFT_DEBUG_TGL() (PORTD ^= 1<<7) -#else - #define SERIAL_SOFT_DEBUG_INIT() - #define SERIAL_SOFT_DEBUG_TGL() -#endif - - -void serial_init(void) -{ - SERIAL_SOFT_DEBUG_INIT(); - - SERIAL_SOFT_RXD_INIT(); - SERIAL_SOFT_TXD_INIT(); -} - -/* RX ring buffer */ -#define RBUF_SIZE 8 -static uint8_t rbuf[RBUF_SIZE]; -static uint8_t rbuf_head = 0; -static uint8_t rbuf_tail = 0; - - -uint8_t serial_recv(void) -{ - uint8_t data = 0; - if (rbuf_head == rbuf_tail) { - return 0; - } - - data = rbuf[rbuf_tail]; - rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE; - return data; -} - -int16_t serial_recv2(void) -{ - uint8_t data = 0; - if (rbuf_head == rbuf_tail) { - return -1; - } - - data = rbuf[rbuf_tail]; - rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE; - return data; -} - -void serial_send(uint8_t data) -{ - /* signal state: IDLE: ON, START: OFF, STOP: ON, DATA0: OFF, DATA1: ON */ - -#ifdef SERIAL_SOFT_BIT_ORDER_MSB - #ifdef SERIAL_SOFT_DATA_7BIT - uint8_t mask = 0x40; - #else - uint8_t mask = 0x80; - #endif -#else - uint8_t mask = 0x01; -#endif - - uint8_t parity = 0; - - /* start bit */ - SERIAL_SOFT_TXD_OFF(); - _delay_us(WAIT_US); - -#ifdef SERIAL_SOFT_DATA_7BIT - while (mask&0x7F) { -#else - while (mask&0xFF) { -#endif - if (data&mask) { - SERIAL_SOFT_TXD_ON(); - parity ^= 1; - } else { - SERIAL_SOFT_TXD_OFF(); - } - _delay_us(WAIT_US); - -#ifdef SERIAL_SOFT_BIT_ORDER_MSB - mask >>= 1; -#else - mask <<= 1; -#endif - } - -#if defined(SERIAL_SOFT_PARITY_EVEN) || defined(SERIAL_SOFT_PARITY_ODD) - /* to center of parity bit */ - if (parity != SERIAL_SOFT_PARITY_VAL) { - SERIAL_SOFT_TXD_ON(); - } else { - SERIAL_SOFT_TXD_OFF(); - } - _delay_us(WAIT_US); -#endif - - /* stop bit */ - SERIAL_SOFT_TXD_ON(); - _delay_us(WAIT_US); -} - -/* detect edge of start bit */ -ISR(SERIAL_SOFT_RXD_VECT) -{ - SERIAL_SOFT_DEBUG_TGL(); - SERIAL_SOFT_RXD_INT_ENTER() - - uint8_t data = 0; - -#ifdef SERIAL_SOFT_BIT_ORDER_MSB - #ifdef SERIAL_SOFT_DATA_7BIT - uint8_t mask = 0x40; - #else - uint8_t mask = 0x80; - #endif -#else - uint8_t mask = 0x01; -#endif - - uint8_t parity = 0; - - /* to center of start bit */ - _delay_us(WAIT_US/2); - SERIAL_SOFT_DEBUG_TGL(); - do { - /* to center of next bit */ - _delay_us(WAIT_US); - - SERIAL_SOFT_DEBUG_TGL(); - if (SERIAL_SOFT_RXD_IN()) { - data |= mask; - parity ^= 1; - } -#ifdef SERIAL_SOFT_BIT_ORDER_MSB - mask >>= 1; -#else - mask <<= 1; -#endif -#ifdef SERIAL_SOFT_DATA_7BIT - } while (mask&0x7F); -#else - } while (mask&0xFF); -#endif - -#if defined(SERIAL_SOFT_PARITY_EVEN) || defined(SERIAL_SOFT_PARITY_ODD) - /* to center of parity bit */ - _delay_us(WAIT_US); - if (SERIAL_SOFT_RXD_IN()) { parity ^= 1; } - SERIAL_SOFT_DEBUG_TGL(); -#endif - - /* to center of stop bit */ - _delay_us(WAIT_US); - - uint8_t next = (rbuf_head + 1) % RBUF_SIZE; -#if defined(SERIAL_SOFT_PARITY_EVEN) || defined(SERIAL_SOFT_PARITY_ODD) - if ((parity == SERIAL_SOFT_PARITY_VAL) && next != rbuf_tail) { -#else - if (next != rbuf_tail) { -#endif - rbuf[rbuf_head] = data; - rbuf_head = next; - } - - SERIAL_SOFT_RXD_INT_EXIT(); - SERIAL_SOFT_DEBUG_TGL(); -} diff --git a/protocol/serial_uart.c b/protocol/serial_uart.c deleted file mode 100644 index 35df27fd6e..0000000000 --- a/protocol/serial_uart.c +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 2013 Jun WAKO - -This software is licensed with a Modified BSD License. -All of this is supposed to be Free Software, Open Source, DFSG-free, -GPL-compatible, and OK to use in both free and proprietary applications. -Additions and corrections to this file are welcome. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -* Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include -#include "serial.h" - - -#if defined(SERIAL_UART_RTS_LO) && defined(SERIAL_UART_RTS_HI) - // Buffer state - // Empty: RBUF_SPACE == RBUF_SIZE(head==tail) - // Last 1 space: RBUF_SPACE == 2 - // Full: RBUF_SPACE == 1(last cell of rbuf be never used.) - #define RBUF_SPACE() (rbuf_head < rbuf_tail ? (rbuf_tail - rbuf_head) : (RBUF_SIZE - rbuf_head + rbuf_tail)) - // allow to send - #define rbuf_check_rts_lo() do { if (RBUF_SPACE() > 2) SERIAL_UART_RTS_LO(); } while (0) - // prohibit to send - #define rbuf_check_rts_hi() do { if (RBUF_SPACE() <= 2) SERIAL_UART_RTS_HI(); } while (0) -#else - #define rbuf_check_rts_lo() - #define rbuf_check_rts_hi() -#endif - - -void serial_init(void) -{ - SERIAL_UART_INIT(); -} - -// RX ring buffer -#define RBUF_SIZE 256 -static uint8_t rbuf[RBUF_SIZE]; -static uint8_t rbuf_head = 0; -static uint8_t rbuf_tail = 0; - -uint8_t serial_recv(void) -{ - uint8_t data = 0; - if (rbuf_head == rbuf_tail) { - return 0; - } - - data = rbuf[rbuf_tail]; - rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE; - rbuf_check_rts_lo(); - return data; -} - -int16_t serial_recv2(void) -{ - uint8_t data = 0; - if (rbuf_head == rbuf_tail) { - return -1; - } - - data = rbuf[rbuf_tail]; - rbuf_tail = (rbuf_tail + 1) % RBUF_SIZE; - rbuf_check_rts_lo(); - return data; -} - -void serial_send(uint8_t data) -{ - while (!SERIAL_UART_TXD_READY) ; - SERIAL_UART_DATA = data; -} - -// USART RX complete interrupt -ISR(SERIAL_UART_RXD_VECT) -{ - uint8_t next = (rbuf_head + 1) % RBUF_SIZE; - if (next != rbuf_tail) { - rbuf[rbuf_head] = SERIAL_UART_DATA; - rbuf_head = next; - } - rbuf_check_rts_hi(); -} diff --git a/protocol/usb_hid.mk b/protocol/usb_hid.mk deleted file mode 100644 index 1f79bda3bd..0000000000 --- a/protocol/usb_hid.mk +++ /dev/null @@ -1,74 +0,0 @@ -USB_HID_DIR = protocol/usb_hid - - -# -# USB Host Shield -# -USB_HOST_SHIELD_DIR = $(USB_HID_DIR)/USB_Host_Shield_2.0 -USB_HOST_SHIELD_SRC = \ - $(USB_HOST_SHIELD_DIR)/Usb.cpp \ - $(USB_HOST_SHIELD_DIR)/hid.cpp \ - $(USB_HOST_SHIELD_DIR)/usbhub.cpp \ - $(USB_HOST_SHIELD_DIR)/parsetools.cpp \ - $(USB_HOST_SHIELD_DIR)/message.cpp - - - -# -# Arduino -# -ARDUINO_DIR = $(USB_HID_DIR)/arduino-1.0.1 -ARDUINO_CORES_DIR = $(ARDUINO_DIR)/cores/arduino -ARDUINO_CORES_SRC = \ - $(ARDUINO_CORES_DIR)/Print.cpp \ - $(ARDUINO_CORES_DIR)/Stream.cpp - -# replaced with override_Serial.c -# $(ARDUINO_CORES_DIR)/CDC.cpp \ -# $(ARDUINO_CORES_DIR)/HID.cpp \ -# $(ARDUINO_CORES_DIR)/USBCore.cpp \ - -# replaced with override_wiring.c and common/timer.c -# $(ARDUINO_CORES_DIR)/wiring.c \ - - - -# -# HID parser -# -SRC += $(USB_HID_DIR)/parser.cpp - -# replace arduino/CDC.cpp -SRC += $(USB_HID_DIR)/override_Serial.cpp - -# replace arduino/wiring.c -SRC += $(USB_HID_DIR)/override_wiring.c -SRC += common/avr/timer.c - -SRC += $(USB_HOST_SHIELD_SRC) -SRC += $(ARDUINO_CORES_SRC) - - -OPT_DEFS += -DARDUINO=101 -# Arduino USBCore needs USB_VID and USB_PID. -#OPT_DEFS += -DARDUINO=101 -DUSB_VID=0x2341 -DUSB_PID=0x8036 - - - -# -# Search Path -# -VPATH += $(TMK_DIR)/$(USB_HID_DIR) -VPATH += $(TMK_DIR)/$(USB_HOST_SHIELD_DIR) - -# for #include "Arduino.h" -VPATH += $(TMK_DIR)/$(ARDUINO_CORES_DIR) - -# for #include "pins_arduino.h" -VPATH += $(TMK_DIR)/$(ARDUINO_DIR)/variants/leonardo - -# ad hoc workaround for compile problem on Windows: -# Windows doesn't know difference between common/print.h and arduino/Print.h. -# On Linux no problem. -# Change file name common/print.h to console.h ? -VPATH := $(TMK_DIR)/common $(VPATH) diff --git a/protocol/usb_hid/README b/protocol/usb_hid/README deleted file mode 100644 index 0d2efc2aa2..0000000000 --- a/protocol/usb_hid/README +++ /dev/null @@ -1,47 +0,0 @@ -USB HID protocol -================ -Host side of USB HID keyboard protocol implementation. -Only standard HID Boot mode is supported at this time. This means most of normal keyboards are supported while proprietary >6KRO and NKRO is not. - -Third party Libraries ---------------------- -USB_Host_Shield_2.0 - Circuits@Home repository is git-submoduled. Do git submodule init & update to get the content. - https://github.com/felis/USB_Host_Shield_2.0 - -arduino-1.0.1 - Arduino files copied from: - https://github.com/arduino/Arduino/hardware/arduino/{cores,variants} - - -Test build ----------- -In test directory; - $ make - $ DEV=/dev/ttyACM0 make program - -You can see HID keyboard reports on debug output. - - -Restriction and Bug -------------------- -Not supported/confirmed yet. - Hub, suspend, keyboard LED - -Switching power on VBUS: - To power reset device. - http://www.circuitsathome.com/camera-control/simulating-cable-disconnect-on-usb-host-shield-2-0 - This is needed for a device which are not initilized with 'USB Bus Reset'(long SE0) - -Can't bus-reset a keyboard which already attached on bus properly. - Slow start up of Leonardo's bootloader causes this? - Need to unplug/plug a keyboard after firmware starts up. - MAX3421E doesn't work SAMPLEBUS well to know whether device connected or not. - -Keyboard with other endpoints than boot keyboard may go wrong. - On my keyboard with mouse key the converter locks up when using mouse key function. - -Can't compile on Windows filesystem. - On Linux no problem. - Windows doesn't know difference between common/print.h and arduino/Print.h. - Change file name common/print.h to console.h ? diff --git a/protocol/usb_hid/USB_Host_Shield_2.0 b/protocol/usb_hid/USB_Host_Shield_2.0 deleted file mode 160000 index 7c2e6c1bcd..0000000000 --- a/protocol/usb_hid/USB_Host_Shield_2.0 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7c2e6c1bcdcc22cfdbd82edd9d8fc4c4276ead47 diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h deleted file mode 100644 index 830c9952fb..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef Arduino_h -#define Arduino_h - -#include -#include -#include - -#include -#include -#include - -#include "binary.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#define HIGH 0x1 -#define LOW 0x0 - -#define INPUT 0x0 -#define OUTPUT 0x1 -#define INPUT_PULLUP 0x2 - -#define true 0x1 -#define false 0x0 - -#define PI 3.1415926535897932384626433832795 -#define HALF_PI 1.5707963267948966192313216916398 -#define TWO_PI 6.283185307179586476925286766559 -#define DEG_TO_RAD 0.017453292519943295769236907684886 -#define RAD_TO_DEG 57.295779513082320876798154814105 - -#define SERIAL 0x0 -#define DISPLAY 0x1 - -#define LSBFIRST 0 -#define MSBFIRST 1 - -#define CHANGE 1 -#define FALLING 2 -#define RISING 3 - -#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) -#define DEFAULT 0 -#define EXTERNAL 1 -#define INTERNAL 2 -#else -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) -#define INTERNAL1V1 2 -#define INTERNAL2V56 3 -#else -#define INTERNAL 3 -#endif -#define DEFAULT 1 -#define EXTERNAL 0 -#endif - -// undefine stdlib's abs if encountered -#ifdef abs -#undef abs -#endif - -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) -#define abs(x) ((x)>0?(x):-(x)) -#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) -#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) -#define radians(deg) ((deg)*DEG_TO_RAD) -#define degrees(rad) ((rad)*RAD_TO_DEG) -#define sq(x) ((x)*(x)) - -#define interrupts() sei() -#define noInterrupts() cli() - -#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) -#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) -#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) - -#define lowByte(w) ((uint8_t) ((w) & 0xff)) -#define highByte(w) ((uint8_t) ((w) >> 8)) - -#define bitRead(value, bit) (((value) >> (bit)) & 0x01) -#define bitSet(value, bit) ((value) |= (1UL << (bit))) -#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) -#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) - - -typedef unsigned int word; - -#define bit(b) (1UL << (b)) - -typedef uint8_t boolean; -typedef uint8_t byte; - -void init(void); - -void pinMode(uint8_t, uint8_t); -void digitalWrite(uint8_t, uint8_t); -int digitalRead(uint8_t); -int analogRead(uint8_t); -void analogReference(uint8_t mode); -void analogWrite(uint8_t, int); - -unsigned long millis(void); -unsigned long micros(void); -void delay(unsigned long); -void delayMicroseconds(unsigned int us); -unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout); - -void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); -uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder); - -void attachInterrupt(uint8_t, void (*)(void), int mode); -void detachInterrupt(uint8_t); - -void setup(void); -void loop(void); - -// Get the bit location within the hardware port of the given virtual pin. -// This comes from the pins_*.c file for the active board configuration. - -#define analogInPinToBit(P) (P) - -// On the ATmega1280, the addresses of some of the port registers are -// greater than 255, so we can't store them in uint8_t's. -extern const uint16_t PROGMEM port_to_mode_PGM[]; -extern const uint16_t PROGMEM port_to_input_PGM[]; -extern const uint16_t PROGMEM port_to_output_PGM[]; - -extern const uint8_t PROGMEM digital_pin_to_port_PGM[]; -// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[]; -extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]; -extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; - -// Get the bit location within the hardware port of the given virtual pin. -// This comes from the pins_*.c file for the active board configuration. -// -// These perform slightly better as macros compared to inline functions -// -#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) -#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) ) -#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) ) -#define analogInPinToBit(P) (P) -#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) ) -#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) ) -#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) ) - -#define NOT_A_PIN 0 -#define NOT_A_PORT 0 - -#ifdef ARDUINO_MAIN -#define PA 1 -#define PB 2 -#define PC 3 -#define PD 4 -#define PE 5 -#define PF 6 -#define PG 7 -#define PH 8 -#define PJ 10 -#define PK 11 -#define PL 12 -#endif - -#define NOT_ON_TIMER 0 -#define TIMER0A 1 -#define TIMER0B 2 -#define TIMER1A 3 -#define TIMER1B 4 -#define TIMER2 5 -#define TIMER2A 6 -#define TIMER2B 7 - -#define TIMER3A 8 -#define TIMER3B 9 -#define TIMER3C 10 -#define TIMER4A 11 -#define TIMER4B 12 -#define TIMER4C 13 -#define TIMER4D 14 -#define TIMER5A 15 -#define TIMER5B 16 -#define TIMER5C 17 - -#ifdef __cplusplus -} // extern "C" -#endif - -#ifdef __cplusplus -#include "WCharacter.h" -#include "WString.h" -#include "HardwareSerial.h" - -uint16_t makeWord(uint16_t w); -uint16_t makeWord(byte h, byte l); - -#define word(...) makeWord(__VA_ARGS__) - -unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); - -void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); -void noTone(uint8_t _pin); - -// WMath prototypes -long random(long); -long random(long, long); -void randomSeed(unsigned int); -long map(long, long, long, long, long); - -#endif - -#include "pins_arduino.h" - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp deleted file mode 100644 index 1ee3a488a5..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp +++ /dev/null @@ -1,233 +0,0 @@ - - -/* Copyright (c) 2011, Peter Barrett -** -** Permission to use, copy, modify, and/or distribute this software for -** any purpose with or without fee is hereby granted, provided that the -** above copyright notice and this permission notice appear in all copies. -** -** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR -** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -** SOFTWARE. -*/ - -#include "Platform.h" -#include "USBAPI.h" -#include - -#if defined(USBCON) -#ifdef CDC_ENABLED - -#if (RAMEND < 1000) -#define SERIAL_BUFFER_SIZE 16 -#else -#define SERIAL_BUFFER_SIZE 64 -#endif - -struct ring_buffer -{ - unsigned char buffer[SERIAL_BUFFER_SIZE]; - volatile int head; - volatile int tail; -}; - -ring_buffer cdc_rx_buffer = { { 0 }, 0, 0}; - -typedef struct -{ - u32 dwDTERate; - u8 bCharFormat; - u8 bParityType; - u8 bDataBits; - u8 lineState; -} LineInfo; - -static volatile LineInfo _usbLineInfo = { 57600, 0x00, 0x00, 0x00, 0x00 }; - -#define WEAK __attribute__ ((weak)) - -extern const CDCDescriptor _cdcInterface PROGMEM; -const CDCDescriptor _cdcInterface = -{ - D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1), - - // CDC communication interface - D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0), - D_CDCCS(CDC_HEADER,0x10,0x01), // Header (1.10 bcd) - D_CDCCS(CDC_CALL_MANAGEMENT,1,1), // Device handles call management (not) - D_CDCCS4(CDC_ABSTRACT_CONTROL_MANAGEMENT,6), // SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported - D_CDCCS(CDC_UNION,CDC_ACM_INTERFACE,CDC_DATA_INTERFACE), // Communication interface is master, data interface is slave 0 - D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_ACM),USB_ENDPOINT_TYPE_INTERRUPT,0x10,0x40), - - // CDC data interface - D_INTERFACE(CDC_DATA_INTERFACE,2,CDC_DATA_INTERFACE_CLASS,0,0), - D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,0x40,0), - D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,0x40,0) -}; - -int WEAK CDC_GetInterface(u8* interfaceNum) -{ - interfaceNum[0] += 2; // uses 2 - return USB_SendControl(TRANSFER_PGM,&_cdcInterface,sizeof(_cdcInterface)); -} - -bool WEAK CDC_Setup(Setup& setup) -{ - u8 r = setup.bRequest; - u8 requestType = setup.bmRequestType; - - if (REQUEST_DEVICETOHOST_CLASS_INTERFACE == requestType) - { - if (CDC_GET_LINE_CODING == r) - { - USB_SendControl(0,(void*)&_usbLineInfo,7); - return true; - } - } - - if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType) - { - if (CDC_SET_LINE_CODING == r) - { - USB_RecvControl((void*)&_usbLineInfo,7); - return true; - } - - if (CDC_SET_CONTROL_LINE_STATE == r) - { - _usbLineInfo.lineState = setup.wValueL; - - // auto-reset into the bootloader is triggered when the port, already - // open at 1200 bps, is closed. this is the signal to start the watchdog - // with a relatively long period so it can finish housekeeping tasks - // like servicing endpoints before the sketch ends - if (1200 == _usbLineInfo.dwDTERate) { - // We check DTR state to determine if host port is open (bit 0 of lineState). - if ((_usbLineInfo.lineState & 0x01) == 0) { - *(uint16_t *)0x0800 = 0x7777; - wdt_enable(WDTO_120MS); - } else { - // Most OSs do some intermediate steps when configuring ports and DTR can - // twiggle more than once before stabilizing. - // To avoid spurious resets we set the watchdog to 250ms and eventually - // cancel if DTR goes back high. - - wdt_disable(); - wdt_reset(); - *(uint16_t *)0x0800 = 0x0; - } - } - return true; - } - } - return false; -} - - -int _serialPeek = -1; -void Serial_::begin(uint16_t baud_count) -{ -} - -void Serial_::end(void) -{ -} - -void Serial_::accept(void) -{ - ring_buffer *buffer = &cdc_rx_buffer; - int c = USB_Recv(CDC_RX); - int i = (unsigned int)(buffer->head+1) % SERIAL_BUFFER_SIZE; - - // if we should be storing the received character into the location - // just before the tail (meaning that the head would advance to the - // current location of the tail), we're about to overflow the buffer - // and so we don't write the character or advance the head. - if (i != buffer->tail) { - buffer->buffer[buffer->head] = c; - buffer->head = i; - } -} - -int Serial_::available(void) -{ - ring_buffer *buffer = &cdc_rx_buffer; - return (unsigned int)(SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % SERIAL_BUFFER_SIZE; -} - -int Serial_::peek(void) -{ - ring_buffer *buffer = &cdc_rx_buffer; - if (buffer->head == buffer->tail) { - return -1; - } else { - return buffer->buffer[buffer->tail]; - } -} - -int Serial_::read(void) -{ - ring_buffer *buffer = &cdc_rx_buffer; - // if the head isn't ahead of the tail, we don't have any characters - if (buffer->head == buffer->tail) { - return -1; - } else { - unsigned char c = buffer->buffer[buffer->tail]; - buffer->tail = (unsigned int)(buffer->tail + 1) % SERIAL_BUFFER_SIZE; - return c; - } -} - -void Serial_::flush(void) -{ - USB_Flush(CDC_TX); -} - -size_t Serial_::write(uint8_t c) -{ - /* only try to send bytes if the high-level CDC connection itself - is open (not just the pipe) - the OS should set lineState when the port - is opened and clear lineState when the port is closed. - bytes sent before the user opens the connection or after - the connection is closed are lost - just like with a UART. */ - - // TODO - ZE - check behavior on different OSes and test what happens if an - // open connection isn't broken cleanly (cable is yanked out, host dies - // or locks up, or host virtual serial port hangs) - if (_usbLineInfo.lineState > 0) { - int r = USB_Send(CDC_TX,&c,1); - if (r > 0) { - return r; - } else { - setWriteError(); - return 0; - } - } - setWriteError(); - return 0; -} - -// This operator is a convenient way for a sketch to check whether the -// port has actually been configured and opened by the host (as opposed -// to just being connected to the host). It can be used, for example, in -// setup() before printing to ensure that an application on the host is -// actually ready to receive and display the data. -// We add a short delay before returning to fix a bug observed by Federico -// where the port is configured (lineState != 0) but not quite opened. -Serial_::operator bool() { - bool result = false; - if (_usbLineInfo.lineState > 0) - result = true; - delay(10); - return result; -} - -Serial_ Serial; - -#endif -#endif /* if defined(USBCON) */ diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h deleted file mode 100644 index ea134838a2..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef client_h -#define client_h -#include "Print.h" -#include "Stream.h" -#include "IPAddress.h" - -class Client : public Stream { - -public: - virtual int connect(IPAddress ip, uint16_t port) =0; - virtual int connect(const char *host, uint16_t port) =0; - virtual size_t write(uint8_t) =0; - virtual size_t write(const uint8_t *buf, size_t size) =0; - virtual int available() = 0; - virtual int read() = 0; - virtual int read(uint8_t *buf, size_t size) = 0; - virtual int peek() = 0; - virtual void flush() = 0; - virtual void stop() = 0; - virtual uint8_t connected() = 0; - virtual operator bool() = 0; -protected: - uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; -}; - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp deleted file mode 100644 index ac63608449..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp +++ /dev/null @@ -1,520 +0,0 @@ - - -/* Copyright (c) 2011, Peter Barrett -** -** Permission to use, copy, modify, and/or distribute this software for -** any purpose with or without fee is hereby granted, provided that the -** above copyright notice and this permission notice appear in all copies. -** -** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR -** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -** SOFTWARE. -*/ - -#include "Platform.h" -#include "USBAPI.h" -#include "USBDesc.h" - -#if defined(USBCON) -#ifdef HID_ENABLED - -//#define RAWHID_ENABLED - -// Singletons for mouse and keyboard - -Mouse_ Mouse; -Keyboard_ Keyboard; - -//================================================================================ -//================================================================================ - -// HID report descriptor - -#define LSB(_x) ((_x) & 0xFF) -#define MSB(_x) ((_x) >> 8) - -#define RAWHID_USAGE_PAGE 0xFFC0 -#define RAWHID_USAGE 0x0C00 -#define RAWHID_TX_SIZE 64 -#define RAWHID_RX_SIZE 64 - -extern const u8 _hidReportDescriptor[] PROGMEM; -const u8 _hidReportDescriptor[] = { - - // Mouse - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 54 - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - 0x09, 0x01, // USAGE (Pointer) - 0xa1, 0x00, // COLLECTION (Physical) - 0x85, 0x01, // REPORT_ID (1) - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x03, // USAGE_MAXIMUM (Button 3) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x95, 0x03, // REPORT_COUNT (3) - 0x75, 0x01, // REPORT_SIZE (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x01, // REPORT_COUNT (1) - 0x75, 0x05, // REPORT_SIZE (5) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x09, 0x38, // USAGE (Wheel) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x03, // REPORT_COUNT (3) - 0x81, 0x06, // INPUT (Data,Var,Rel) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION - - // Keyboard - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 47 - 0x09, 0x06, // USAGE (Keyboard) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, 0x02, // REPORT_ID (2) - 0x05, 0x07, // USAGE_PAGE (Keyboard) - - 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) - 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - - 0x95, 0x08, // REPORT_COUNT (8) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x01, // REPORT_COUNT (1) - 0x75, 0x08, // REPORT_SIZE (8) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - - 0x95, 0x06, // REPORT_COUNT (6) - 0x75, 0x08, // REPORT_SIZE (8) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x65, // LOGICAL_MAXIMUM (101) - 0x05, 0x07, // USAGE_PAGE (Keyboard) - - 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) - 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) - 0x81, 0x00, // INPUT (Data,Ary,Abs) - 0xc0, // END_COLLECTION - -#if RAWHID_ENABLED - // RAW HID - 0x06, LSB(RAWHID_USAGE_PAGE), MSB(RAWHID_USAGE_PAGE), // 30 - 0x0A, LSB(RAWHID_USAGE), MSB(RAWHID_USAGE), - - 0xA1, 0x01, // Collection 0x01 - 0x85, 0x03, // REPORT_ID (3) - 0x75, 0x08, // report size = 8 bits - 0x15, 0x00, // logical minimum = 0 - 0x26, 0xFF, 0x00, // logical maximum = 255 - - 0x95, 64, // report count TX - 0x09, 0x01, // usage - 0x81, 0x02, // Input (array) - - 0x95, 64, // report count RX - 0x09, 0x02, // usage - 0x91, 0x02, // Output (array) - 0xC0 // end collection -#endif -}; - -extern const HIDDescriptor _hidInterface PROGMEM; -const HIDDescriptor _hidInterface = -{ - D_INTERFACE(HID_INTERFACE,1,3,0,0), - D_HIDREPORT(sizeof(_hidReportDescriptor)), - D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x01) -}; - -//================================================================================ -//================================================================================ -// Driver - -u8 _hid_protocol = 1; -u8 _hid_idle = 1; - -#define WEAK __attribute__ ((weak)) - -int WEAK HID_GetInterface(u8* interfaceNum) -{ - interfaceNum[0] += 1; // uses 1 - return USB_SendControl(TRANSFER_PGM,&_hidInterface,sizeof(_hidInterface)); -} - -int WEAK HID_GetDescriptor(int i) -{ - return USB_SendControl(TRANSFER_PGM,_hidReportDescriptor,sizeof(_hidReportDescriptor)); -} - -void WEAK HID_SendReport(u8 id, const void* data, int len) -{ - USB_Send(HID_TX, &id, 1); - USB_Send(HID_TX | TRANSFER_RELEASE,data,len); -} - -bool WEAK HID_Setup(Setup& setup) -{ - u8 r = setup.bRequest; - u8 requestType = setup.bmRequestType; - if (REQUEST_DEVICETOHOST_CLASS_INTERFACE == requestType) - { - if (HID_GET_REPORT == r) - { - //HID_GetReport(); - return true; - } - if (HID_GET_PROTOCOL == r) - { - //Send8(_hid_protocol); // TODO - return true; - } - } - - if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType) - { - if (HID_SET_PROTOCOL == r) - { - _hid_protocol = setup.wValueL; - return true; - } - - if (HID_SET_IDLE == r) - { - _hid_idle = setup.wValueL; - return true; - } - } - return false; -} - -//================================================================================ -//================================================================================ -// Mouse - -Mouse_::Mouse_(void) : _buttons(0) -{ -} - -void Mouse_::begin(void) -{ -} - -void Mouse_::end(void) -{ -} - -void Mouse_::click(uint8_t b) -{ - _buttons = b; - move(0,0,0); - _buttons = 0; - move(0,0,0); -} - -void Mouse_::move(signed char x, signed char y, signed char wheel) -{ - u8 m[4]; - m[0] = _buttons; - m[1] = x; - m[2] = y; - m[3] = wheel; - HID_SendReport(1,m,4); -} - -void Mouse_::buttons(uint8_t b) -{ - if (b != _buttons) - { - _buttons = b; - move(0,0,0); - } -} - -void Mouse_::press(uint8_t b) -{ - buttons(_buttons | b); -} - -void Mouse_::release(uint8_t b) -{ - buttons(_buttons & ~b); -} - -bool Mouse_::isPressed(uint8_t b) -{ - if ((b & _buttons) > 0) - return true; - return false; -} - -//================================================================================ -//================================================================================ -// Keyboard - -Keyboard_::Keyboard_(void) -{ -} - -void Keyboard_::begin(void) -{ -} - -void Keyboard_::end(void) -{ -} - -void Keyboard_::sendReport(KeyReport* keys) -{ - HID_SendReport(2,keys,sizeof(KeyReport)); -} - -extern -const uint8_t _asciimap[128] PROGMEM; - -#define SHIFT 0x80 -const uint8_t _asciimap[128] = -{ - 0x00, // NUL - 0x00, // SOH - 0x00, // STX - 0x00, // ETX - 0x00, // EOT - 0x00, // ENQ - 0x00, // ACK - 0x00, // BEL - 0x2a, // BS Backspace - 0x2b, // TAB Tab - 0x28, // LF Enter - 0x00, // VT - 0x00, // FF - 0x00, // CR - 0x00, // SO - 0x00, // SI - 0x00, // DEL - 0x00, // DC1 - 0x00, // DC2 - 0x00, // DC3 - 0x00, // DC4 - 0x00, // NAK - 0x00, // SYN - 0x00, // ETB - 0x00, // CAN - 0x00, // EM - 0x00, // SUB - 0x00, // ESC - 0x00, // FS - 0x00, // GS - 0x00, // RS - 0x00, // US - - 0x2c, // ' ' - 0x1e|SHIFT, // ! - 0x34|SHIFT, // " - 0x20|SHIFT, // # - 0x21|SHIFT, // $ - 0x22|SHIFT, // % - 0x24|SHIFT, // & - 0x34, // ' - 0x26|SHIFT, // ( - 0x27|SHIFT, // ) - 0x25|SHIFT, // * - 0x2e|SHIFT, // + - 0x36, // , - 0x2d, // - - 0x37, // . - 0x38, // / - 0x27, // 0 - 0x1e, // 1 - 0x1f, // 2 - 0x20, // 3 - 0x21, // 4 - 0x22, // 5 - 0x23, // 6 - 0x24, // 7 - 0x25, // 8 - 0x26, // 9 - 0x33|SHIFT, // : - 0x33, // ; - 0x36|SHIFT, // < - 0x2e, // = - 0x37|SHIFT, // > - 0x38|SHIFT, // ? - 0x1f|SHIFT, // @ - 0x04|SHIFT, // A - 0x05|SHIFT, // B - 0x06|SHIFT, // C - 0x07|SHIFT, // D - 0x08|SHIFT, // E - 0x09|SHIFT, // F - 0x0a|SHIFT, // G - 0x0b|SHIFT, // H - 0x0c|SHIFT, // I - 0x0d|SHIFT, // J - 0x0e|SHIFT, // K - 0x0f|SHIFT, // L - 0x10|SHIFT, // M - 0x11|SHIFT, // N - 0x12|SHIFT, // O - 0x13|SHIFT, // P - 0x14|SHIFT, // Q - 0x15|SHIFT, // R - 0x16|SHIFT, // S - 0x17|SHIFT, // T - 0x18|SHIFT, // U - 0x19|SHIFT, // V - 0x1a|SHIFT, // W - 0x1b|SHIFT, // X - 0x1c|SHIFT, // Y - 0x1d|SHIFT, // Z - 0x2f, // [ - 0x31, // bslash - 0x30, // ] - 0x23|SHIFT, // ^ - 0x2d|SHIFT, // _ - 0x35, // ` - 0x04, // a - 0x05, // b - 0x06, // c - 0x07, // d - 0x08, // e - 0x09, // f - 0x0a, // g - 0x0b, // h - 0x0c, // i - 0x0d, // j - 0x0e, // k - 0x0f, // l - 0x10, // m - 0x11, // n - 0x12, // o - 0x13, // p - 0x14, // q - 0x15, // r - 0x16, // s - 0x17, // t - 0x18, // u - 0x19, // v - 0x1a, // w - 0x1b, // x - 0x1c, // y - 0x1d, // z - 0x2f|SHIFT, // - 0x31|SHIFT, // | - 0x30|SHIFT, // } - 0x35|SHIFT, // ~ - 0 // DEL -}; - -uint8_t USBPutChar(uint8_t c); - -// press() adds the specified key (printing, non-printing, or modifier) -// to the persistent key report and sends the report. Because of the way -// USB HID works, the host acts like the key remains pressed until we -// call release(), releaseAll(), or otherwise clear the report and resend. -size_t Keyboard_::press(uint8_t k) -{ - uint8_t i; - if (k >= 136) { // it's a non-printing key (not a modifier) - k = k - 136; - } else if (k >= 128) { // it's a modifier key - _keyReport.modifiers |= (1<<(k-128)); - k = 0; - } else { // it's a printing key - k = pgm_read_byte(_asciimap + k); - if (!k) { - setWriteError(); - return 0; - } - if (k & 0x80) { // it's a capital letter or other character reached with shift - _keyReport.modifiers |= 0x02; // the left shift modifier - k &= 0x7F; - } - } - - // Add k to the key report only if it's not already present - // and if there is an empty slot. - if (_keyReport.keys[0] != k && _keyReport.keys[1] != k && - _keyReport.keys[2] != k && _keyReport.keys[3] != k && - _keyReport.keys[4] != k && _keyReport.keys[5] != k) { - - for (i=0; i<6; i++) { - if (_keyReport.keys[i] == 0x00) { - _keyReport.keys[i] = k; - break; - } - } - if (i == 6) { - setWriteError(); - return 0; - } - } - sendReport(&_keyReport); - return 1; -} - -// release() takes the specified key out of the persistent key report and -// sends the report. This tells the OS the key is no longer pressed and that -// it shouldn't be repeated any more. -size_t Keyboard_::release(uint8_t k) -{ - uint8_t i; - if (k >= 136) { // it's a non-printing key (not a modifier) - k = k - 136; - } else if (k >= 128) { // it's a modifier key - _keyReport.modifiers &= ~(1<<(k-128)); - k = 0; - } else { // it's a printing key - k = pgm_read_byte(_asciimap + k); - if (!k) { - return 0; - } - if (k & 0x80) { // it's a capital letter or other character reached with shift - _keyReport.modifiers &= ~(0x02); // the left shift modifier - k &= 0x7F; - } - } - - // Test the key report to see if k is present. Clear it if it exists. - // Check all positions in case the key is present more than once (which it shouldn't be) - for (i=0; i<6; i++) { - if (0 != k && _keyReport.keys[i] == k) { - _keyReport.keys[i] = 0x00; - } - } - - sendReport(&_keyReport); - return 1; -} - -void Keyboard_::releaseAll(void) -{ - _keyReport.keys[0] = 0; - _keyReport.keys[1] = 0; - _keyReport.keys[2] = 0; - _keyReport.keys[3] = 0; - _keyReport.keys[4] = 0; - _keyReport.keys[5] = 0; - _keyReport.modifiers = 0; - sendReport(&_keyReport); -} - -size_t Keyboard_::write(uint8_t c) -{ - uint8_t p = press(c); // Keydown - uint8_t r = release(c); // Keyup - return (p); // just return the result of press() since release() almost always returns 1 -} - -#endif - -#endif /* if defined(USBCON) */ \ No newline at end of file diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp deleted file mode 100644 index f40ddee060..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - HardwareSerial.cpp - Hardware serial library for Wiring - Copyright (c) 2006 Nicholas Zambetti. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Modified 23 November 2006 by David A. Mellis - Modified 28 September 2010 by Mark Sproul -*/ - -#include -#include -#include -#include -#include "Arduino.h" -#include "wiring_private.h" - -// this next line disables the entire HardwareSerial.cpp, -// this is so I can support Attiny series and any other chip without a uart -#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H) - -#include "HardwareSerial.h" - -// Define constants and variables for buffering incoming serial data. We're -// using a ring buffer (I think), in which head is the index of the location -// to which to write the next incoming character and tail is the index of the -// location from which to read. -#if (RAMEND < 1000) - #define SERIAL_BUFFER_SIZE 16 -#else - #define SERIAL_BUFFER_SIZE 64 -#endif - -struct ring_buffer -{ - unsigned char buffer[SERIAL_BUFFER_SIZE]; - volatile unsigned int head; - volatile unsigned int tail; -}; - -#if defined(USBCON) - ring_buffer rx_buffer = { { 0 }, 0, 0}; - ring_buffer tx_buffer = { { 0 }, 0, 0}; -#endif -#if defined(UBRRH) || defined(UBRR0H) - ring_buffer rx_buffer = { { 0 }, 0, 0 }; - ring_buffer tx_buffer = { { 0 }, 0, 0 }; -#endif -#if defined(UBRR1H) - ring_buffer rx_buffer1 = { { 0 }, 0, 0 }; - ring_buffer tx_buffer1 = { { 0 }, 0, 0 }; -#endif -#if defined(UBRR2H) - ring_buffer rx_buffer2 = { { 0 }, 0, 0 }; - ring_buffer tx_buffer2 = { { 0 }, 0, 0 }; -#endif -#if defined(UBRR3H) - ring_buffer rx_buffer3 = { { 0 }, 0, 0 }; - ring_buffer tx_buffer3 = { { 0 }, 0, 0 }; -#endif - -inline void store_char(unsigned char c, ring_buffer *buffer) -{ - int i = (unsigned int)(buffer->head + 1) % SERIAL_BUFFER_SIZE; - - // if we should be storing the received character into the location - // just before the tail (meaning that the head would advance to the - // current location of the tail), we're about to overflow the buffer - // and so we don't write the character or advance the head. - if (i != buffer->tail) { - buffer->buffer[buffer->head] = c; - buffer->head = i; - } -} - -#if !defined(USART0_RX_vect) && defined(USART1_RX_vect) -// do nothing - on the 32u4 the first USART is USART1 -#else -#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \ - !defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \ - !defined(SIG_UART_RECV) - #error "Don't know what the Data Received vector is called for the first UART" -#else - void serialEvent() __attribute__((weak)); - void serialEvent() {} - #define serialEvent_implemented -#if defined(USART_RX_vect) - SIGNAL(USART_RX_vect) -#elif defined(SIG_USART0_RECV) - SIGNAL(SIG_USART0_RECV) -#elif defined(SIG_UART0_RECV) - SIGNAL(SIG_UART0_RECV) -#elif defined(USART0_RX_vect) - SIGNAL(USART0_RX_vect) -#elif defined(SIG_UART_RECV) - SIGNAL(SIG_UART_RECV) -#endif - { - #if defined(UDR0) - unsigned char c = UDR0; - #elif defined(UDR) - unsigned char c = UDR; - #else - #error UDR not defined - #endif - store_char(c, &rx_buffer); - } -#endif -#endif - -#if defined(USART1_RX_vect) - void serialEvent1() __attribute__((weak)); - void serialEvent1() {} - #define serialEvent1_implemented - SIGNAL(USART1_RX_vect) - { - unsigned char c = UDR1; - store_char(c, &rx_buffer1); - } -#elif defined(SIG_USART1_RECV) - #error SIG_USART1_RECV -#endif - -#if defined(USART2_RX_vect) && defined(UDR2) - void serialEvent2() __attribute__((weak)); - void serialEvent2() {} - #define serialEvent2_implemented - SIGNAL(USART2_RX_vect) - { - unsigned char c = UDR2; - store_char(c, &rx_buffer2); - } -#elif defined(SIG_USART2_RECV) - #error SIG_USART2_RECV -#endif - -#if defined(USART3_RX_vect) && defined(UDR3) - void serialEvent3() __attribute__((weak)); - void serialEvent3() {} - #define serialEvent3_implemented - SIGNAL(USART3_RX_vect) - { - unsigned char c = UDR3; - store_char(c, &rx_buffer3); - } -#elif defined(SIG_USART3_RECV) - #error SIG_USART3_RECV -#endif - -void serialEventRun(void) -{ -#ifdef serialEvent_implemented - if (Serial.available()) serialEvent(); -#endif -#ifdef serialEvent1_implemented - if (Serial1.available()) serialEvent1(); -#endif -#ifdef serialEvent2_implemented - if (Serial2.available()) serialEvent2(); -#endif -#ifdef serialEvent3_implemented - if (Serial3.available()) serialEvent3(); -#endif -} - - -#if !defined(USART0_UDRE_vect) && defined(USART1_UDRE_vect) -// do nothing - on the 32u4 the first USART is USART1 -#else -#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect) - #error "Don't know what the Data Register Empty vector is called for the first UART" -#else -#if defined(UART0_UDRE_vect) -ISR(UART0_UDRE_vect) -#elif defined(UART_UDRE_vect) -ISR(UART_UDRE_vect) -#elif defined(USART0_UDRE_vect) -ISR(USART0_UDRE_vect) -#elif defined(USART_UDRE_vect) -ISR(USART_UDRE_vect) -#endif -{ - if (tx_buffer.head == tx_buffer.tail) { - // Buffer empty, so disable interrupts -#if defined(UCSR0B) - cbi(UCSR0B, UDRIE0); -#else - cbi(UCSRB, UDRIE); -#endif - } - else { - // There is more data in the output buffer. Send the next byte - unsigned char c = tx_buffer.buffer[tx_buffer.tail]; - tx_buffer.tail = (tx_buffer.tail + 1) % SERIAL_BUFFER_SIZE; - - #if defined(UDR0) - UDR0 = c; - #elif defined(UDR) - UDR = c; - #else - #error UDR not defined - #endif - } -} -#endif -#endif - -#ifdef USART1_UDRE_vect -ISR(USART1_UDRE_vect) -{ - if (tx_buffer1.head == tx_buffer1.tail) { - // Buffer empty, so disable interrupts - cbi(UCSR1B, UDRIE1); - } - else { - // There is more data in the output buffer. Send the next byte - unsigned char c = tx_buffer1.buffer[tx_buffer1.tail]; - tx_buffer1.tail = (tx_buffer1.tail + 1) % SERIAL_BUFFER_SIZE; - - UDR1 = c; - } -} -#endif - -#ifdef USART2_UDRE_vect -ISR(USART2_UDRE_vect) -{ - if (tx_buffer2.head == tx_buffer2.tail) { - // Buffer empty, so disable interrupts - cbi(UCSR2B, UDRIE2); - } - else { - // There is more data in the output buffer. Send the next byte - unsigned char c = tx_buffer2.buffer[tx_buffer2.tail]; - tx_buffer2.tail = (tx_buffer2.tail + 1) % SERIAL_BUFFER_SIZE; - - UDR2 = c; - } -} -#endif - -#ifdef USART3_UDRE_vect -ISR(USART3_UDRE_vect) -{ - if (tx_buffer3.head == tx_buffer3.tail) { - // Buffer empty, so disable interrupts - cbi(UCSR3B, UDRIE3); - } - else { - // There is more data in the output buffer. Send the next byte - unsigned char c = tx_buffer3.buffer[tx_buffer3.tail]; - tx_buffer3.tail = (tx_buffer3.tail + 1) % SERIAL_BUFFER_SIZE; - - UDR3 = c; - } -} -#endif - - -// Constructors //////////////////////////////////////////////////////////////// - -HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer, - volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, - volatile uint8_t *ucsra, volatile uint8_t *ucsrb, - volatile uint8_t *udr, - uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x) -{ - _rx_buffer = rx_buffer; - _tx_buffer = tx_buffer; - _ubrrh = ubrrh; - _ubrrl = ubrrl; - _ucsra = ucsra; - _ucsrb = ucsrb; - _udr = udr; - _rxen = rxen; - _txen = txen; - _rxcie = rxcie; - _udrie = udrie; - _u2x = u2x; -} - -// Public Methods ////////////////////////////////////////////////////////////// - -void HardwareSerial::begin(unsigned long baud) -{ - uint16_t baud_setting; - bool use_u2x = true; - -#if F_CPU == 16000000UL - // hardcoded exception for compatibility with the bootloader shipped - // with the Duemilanove and previous boards and the firmware on the 8U2 - // on the Uno and Mega 2560. - if (baud == 57600) { - use_u2x = false; - } -#endif - -try_again: - - if (use_u2x) { - *_ucsra = 1 << _u2x; - baud_setting = (F_CPU / 4 / baud - 1) / 2; - } else { - *_ucsra = 0; - baud_setting = (F_CPU / 8 / baud - 1) / 2; - } - - if ((baud_setting > 4095) && use_u2x) - { - use_u2x = false; - goto try_again; - } - - // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register) - *_ubrrh = baud_setting >> 8; - *_ubrrl = baud_setting; - - sbi(*_ucsrb, _rxen); - sbi(*_ucsrb, _txen); - sbi(*_ucsrb, _rxcie); - cbi(*_ucsrb, _udrie); -} - -void HardwareSerial::end() -{ - // wait for transmission of outgoing data - while (_tx_buffer->head != _tx_buffer->tail) - ; - - cbi(*_ucsrb, _rxen); - cbi(*_ucsrb, _txen); - cbi(*_ucsrb, _rxcie); - cbi(*_ucsrb, _udrie); - - // clear any received data - _rx_buffer->head = _rx_buffer->tail; -} - -int HardwareSerial::available(void) -{ - return (unsigned int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % SERIAL_BUFFER_SIZE; -} - -int HardwareSerial::peek(void) -{ - if (_rx_buffer->head == _rx_buffer->tail) { - return -1; - } else { - return _rx_buffer->buffer[_rx_buffer->tail]; - } -} - -int HardwareSerial::read(void) -{ - // if the head isn't ahead of the tail, we don't have any characters - if (_rx_buffer->head == _rx_buffer->tail) { - return -1; - } else { - unsigned char c = _rx_buffer->buffer[_rx_buffer->tail]; - _rx_buffer->tail = (unsigned int)(_rx_buffer->tail + 1) % SERIAL_BUFFER_SIZE; - return c; - } -} - -void HardwareSerial::flush() -{ - while (_tx_buffer->head != _tx_buffer->tail) - ; -} - -size_t HardwareSerial::write(uint8_t c) -{ - int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE; - - // If the output buffer is full, there's nothing for it other than to - // wait for the interrupt handler to empty it a bit - // ???: return 0 here instead? - while (i == _tx_buffer->tail) - ; - - _tx_buffer->buffer[_tx_buffer->head] = c; - _tx_buffer->head = i; - - sbi(*_ucsrb, _udrie); - - return 1; -} - -HardwareSerial::operator bool() { - return true; -} - -// Preinstantiate Objects ////////////////////////////////////////////////////// - -#if defined(UBRRH) && defined(UBRRL) - HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRIE, U2X); -#elif defined(UBRR0H) && defined(UBRR0L) - HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRIE0, U2X0); -#elif defined(USBCON) - // do nothing - Serial object and buffers are initialized in CDC code -#else - #error no serial port defined (port 0) -#endif - -#if defined(UBRR1H) - HardwareSerial Serial1(&rx_buffer1, &tx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UDR1, RXEN1, TXEN1, RXCIE1, UDRIE1, U2X1); -#endif -#if defined(UBRR2H) - HardwareSerial Serial2(&rx_buffer2, &tx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UDR2, RXEN2, TXEN2, RXCIE2, UDRIE2, U2X2); -#endif -#if defined(UBRR3H) - HardwareSerial Serial3(&rx_buffer3, &tx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UDR3, RXEN3, TXEN3, RXCIE3, UDRIE3, U2X3); -#endif - -#endif // whole file - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h deleted file mode 100644 index bf4924c6d4..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - HardwareSerial.h - Hardware serial library for Wiring - Copyright (c) 2006 Nicholas Zambetti. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Modified 28 September 2010 by Mark Sproul -*/ - -#ifndef HardwareSerial_h -#define HardwareSerial_h - -#include - -#include "Stream.h" - -struct ring_buffer; - -class HardwareSerial : public Stream -{ - private: - ring_buffer *_rx_buffer; - ring_buffer *_tx_buffer; - volatile uint8_t *_ubrrh; - volatile uint8_t *_ubrrl; - volatile uint8_t *_ucsra; - volatile uint8_t *_ucsrb; - volatile uint8_t *_udr; - uint8_t _rxen; - uint8_t _txen; - uint8_t _rxcie; - uint8_t _udrie; - uint8_t _u2x; - public: - HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer, - volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, - volatile uint8_t *ucsra, volatile uint8_t *ucsrb, - volatile uint8_t *udr, - uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x); - void begin(unsigned long); - void end(); - virtual int available(void); - virtual int peek(void); - virtual int read(void); - virtual void flush(void); - virtual size_t write(uint8_t); - using Print::write; // pull in write(str) and write(buf, size) from Print - operator bool(); -}; - -#if defined(UBRRH) || defined(UBRR0H) - extern HardwareSerial Serial; -#elif defined(USBCON) - #include "USBAPI.h" -// extern HardwareSerial Serial_; -#endif -#if defined(UBRR1H) - extern HardwareSerial Serial1; -#endif -#if defined(UBRR2H) - extern HardwareSerial Serial2; -#endif -#if defined(UBRR3H) - extern HardwareSerial Serial3; -#endif - -extern void serialEventRun(void) __attribute__((weak)); - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp deleted file mode 100644 index fe3deb77a2..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -#include -#include - -IPAddress::IPAddress() -{ - memset(_address, 0, sizeof(_address)); -} - -IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) -{ - _address[0] = first_octet; - _address[1] = second_octet; - _address[2] = third_octet; - _address[3] = fourth_octet; -} - -IPAddress::IPAddress(uint32_t address) -{ - memcpy(_address, &address, sizeof(_address)); -} - -IPAddress::IPAddress(const uint8_t *address) -{ - memcpy(_address, address, sizeof(_address)); -} - -IPAddress& IPAddress::operator=(const uint8_t *address) -{ - memcpy(_address, address, sizeof(_address)); - return *this; -} - -IPAddress& IPAddress::operator=(uint32_t address) -{ - memcpy(_address, (const uint8_t *)&address, sizeof(_address)); - return *this; -} - -bool IPAddress::operator==(const uint8_t* addr) -{ - return memcmp(addr, _address, sizeof(_address)) == 0; -} - -size_t IPAddress::printTo(Print& p) const -{ - size_t n = 0; - for (int i =0; i < 3; i++) - { - n += p.print(_address[i], DEC); - n += p.print('.'); - } - n += p.print(_address[3], DEC); - return n; -} - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h deleted file mode 100644 index 2585aec0e4..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * MIT License: - * Copyright (c) 2011 Adrian McEwen - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * adrianm@mcqn.com 1/1/2011 - */ - -#ifndef IPAddress_h -#define IPAddress_h - -#include - -// A class to make it easier to handle and pass around IP addresses - -class IPAddress : public Printable { -private: - uint8_t _address[4]; // IPv4 address - // Access the raw byte array containing the address. Because this returns a pointer - // to the internal structure rather than a copy of the address this function should only - // be used when you know that the usage of the returned uint8_t* will be transient and not - // stored. - uint8_t* raw_address() { return _address; }; - -public: - // Constructors - IPAddress(); - IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); - IPAddress(uint32_t address); - IPAddress(const uint8_t *address); - - // Overloaded cast operator to allow IPAddress objects to be used where a pointer - // to a four-byte uint8_t array is expected - operator uint32_t() { return *((uint32_t*)_address); }; - bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); }; - bool operator==(const uint8_t* addr); - - // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const { return _address[index]; }; - uint8_t& operator[](int index) { return _address[index]; }; - - // Overloaded copy operators to allow initialisation of IPAddress objects from other types - IPAddress& operator=(const uint8_t *address); - IPAddress& operator=(uint32_t address); - - virtual size_t printTo(Print& p) const; - - friend class EthernetClass; - friend class UDP; - friend class Client; - friend class Server; - friend class DhcpClass; - friend class DNSClient; -}; - -const IPAddress INADDR_NONE(0,0,0,0); - - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h deleted file mode 100644 index 8b8f742771..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifndef __PLATFORM_H__ -#define __PLATFORM_H__ - -#include -#include -#include -#include -#include - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned long u32; - -#include "Arduino.h" - -#if defined(USBCON) - #include "USBDesc.h" - #include "USBCore.h" - #include "USBAPI.h" -#endif /* if defined(USBCON) */ - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp deleted file mode 100644 index e541a6ce71..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - Print.cpp - Base class that provides print() and println() - Copyright (c) 2008 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Modified 23 November 2006 by David A. Mellis - */ - -#include -#include -#include -#include -#include "Arduino.h" - -#include "Print.h" - -// Public Methods ////////////////////////////////////////////////////////////// - -/* default implementation: may be overridden */ -size_t Print::write(const uint8_t *buffer, size_t size) -{ - size_t n = 0; - while (size--) { - n += write(*buffer++); - } - return n; -} - -size_t Print::print(const __FlashStringHelper *ifsh) -{ - const char PROGMEM *p = (const char PROGMEM *)ifsh; - size_t n = 0; - while (1) { - unsigned char c = pgm_read_byte(p++); - if (c == 0) break; - n += write(c); - } - return n; -} - -size_t Print::print(const String &s) -{ - size_t n = 0; - for (uint16_t i = 0; i < s.length(); i++) { - n += write(s[i]); - } - return n; -} - -size_t Print::print(const char str[]) -{ - return write(str); -} - -size_t Print::print(char c) -{ - return write(c); -} - -size_t Print::print(unsigned char b, int base) -{ - return print((unsigned long) b, base); -} - -size_t Print::print(int n, int base) -{ - return print((long) n, base); -} - -size_t Print::print(unsigned int n, int base) -{ - return print((unsigned long) n, base); -} - -size_t Print::print(long n, int base) -{ - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); - } else { - return printNumber(n, base); - } -} - -size_t Print::print(unsigned long n, int base) -{ - if (base == 0) return write(n); - else return printNumber(n, base); -} - -size_t Print::print(double n, int digits) -{ - return printFloat(n, digits); -} - -size_t Print::println(const __FlashStringHelper *ifsh) -{ - size_t n = print(ifsh); - n += println(); - return n; -} - -size_t Print::print(const Printable& x) -{ - return x.printTo(*this); -} - -size_t Print::println(void) -{ - size_t n = print('\r'); - n += print('\n'); - return n; -} - -size_t Print::println(const String &s) -{ - size_t n = print(s); - n += println(); - return n; -} - -size_t Print::println(const char c[]) -{ - size_t n = print(c); - n += println(); - return n; -} - -size_t Print::println(char c) -{ - size_t n = print(c); - n += println(); - return n; -} - -size_t Print::println(unsigned char b, int base) -{ - size_t n = print(b, base); - n += println(); - return n; -} - -size_t Print::println(int num, int base) -{ - size_t n = print(num, base); - n += println(); - return n; -} - -size_t Print::println(unsigned int num, int base) -{ - size_t n = print(num, base); - n += println(); - return n; -} - -size_t Print::println(long num, int base) -{ - size_t n = print(num, base); - n += println(); - return n; -} - -size_t Print::println(unsigned long num, int base) -{ - size_t n = print(num, base); - n += println(); - return n; -} - -size_t Print::println(double num, int digits) -{ - size_t n = print(num, digits); - n += println(); - return n; -} - -size_t Print::println(const Printable& x) -{ - size_t n = print(x); - n += println(); - return n; -} - -// Private Methods ///////////////////////////////////////////////////////////// - -size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. - char *str = &buf[sizeof(buf) - 1]; - - *str = '\0'; - - // prevent crash if called with base == 1 - if (base < 2) base = 10; - - do { - unsigned long m = n; - n /= base; - char c = m - base * n; - *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); - - return write(str); -} - -size_t Print::printFloat(double number, uint8_t digits) -{ - size_t n = 0; - - // Handle negative numbers - if (number < 0.0) - { - n += print('-'); - number = -number; - } - - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i=0; i 0) { - n += print("."); - } - - // Extract digits from the remainder one at a time - while (digits-- > 0) - { - remainder *= 10.0; - int toPrint = int(remainder); - n += print(toPrint); - remainder -= toPrint; - } - - return n; -} diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h deleted file mode 100644 index 1af6b723fc..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Print.h - Base class that provides print() and println() - Copyright (c) 2008 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef Print_h -#define Print_h - -#include -#include // for size_t - -#include "WString.h" -#include "Printable.h" - -#define DEC 10 -#define HEX 16 -#define OCT 8 -#define BIN 2 - -class Print -{ - private: - int write_error; - size_t printNumber(unsigned long, uint8_t); - size_t printFloat(double, uint8_t); - protected: - void setWriteError(int err = 1) { write_error = err; } - public: - Print() : write_error(0) {} - - int getWriteError() { return write_error; } - void clearWriteError() { setWriteError(0); } - - virtual size_t write(uint8_t) = 0; - size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); } - virtual size_t write(const uint8_t *buffer, size_t size); - - size_t print(const __FlashStringHelper *); - size_t print(const String &); - size_t print(const char[]); - size_t print(char); - size_t print(unsigned char, int = DEC); - size_t print(int, int = DEC); - size_t print(unsigned int, int = DEC); - size_t print(long, int = DEC); - size_t print(unsigned long, int = DEC); - size_t print(double, int = 2); - size_t print(const Printable&); - - size_t println(const __FlashStringHelper *); - size_t println(const String &s); - size_t println(const char[]); - size_t println(char); - size_t println(unsigned char, int = DEC); - size_t println(int, int = DEC); - size_t println(unsigned int, int = DEC); - size_t println(long, int = DEC); - size_t println(unsigned long, int = DEC); - size_t println(double, int = 2); - size_t println(const Printable&); - size_t println(void); -}; - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h deleted file mode 100644 index d03c9af62c..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Printable.h - Interface class that allows printing of complex types - Copyright (c) 2011 Adrian McEwen. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef Printable_h -#define Printable_h - -#include - -class Print; - -/** The Printable class provides a way for new classes to allow themselves to be printed. - By deriving from Printable and implementing the printTo method, it will then be possible - for users to print out instances of this class by passing them into the usual - Print::print and Print::println methods. -*/ - -class Printable -{ - public: - virtual size_t printTo(Print& p) const = 0; -}; - -#endif - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h deleted file mode 100644 index 9674c76269..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef server_h -#define server_h - -class Server : public Print { -public: - virtual void begin() =0; -}; - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp deleted file mode 100644 index aafb7fcf97..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - Stream.cpp - adds parsing methods to Stream class - Copyright (c) 2008 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Created July 2011 - parsing functions based on TextFinder library by Michael Margolis - */ - -#include "Arduino.h" -#include "Stream.h" - -#define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait -#define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field - -// private method to read stream with timeout -int Stream::timedRead() -{ - int c; - _startMillis = millis(); - do { - c = read(); - if (c >= 0) return c; - } while(millis() - _startMillis < _timeout); - return -1; // -1 indicates timeout -} - -// private method to peek stream with timeout -int Stream::timedPeek() -{ - int c; - _startMillis = millis(); - do { - c = peek(); - if (c >= 0) return c; - } while(millis() - _startMillis < _timeout); - return -1; // -1 indicates timeout -} - -// returns peek of the next digit in the stream or -1 if timeout -// discards non-numeric characters -int Stream::peekNextDigit() -{ - int c; - while (1) { - c = timedPeek(); - if (c < 0) return c; // timeout - if (c == '-') return c; - if (c >= '0' && c <= '9') return c; - read(); // discard non-numeric - } -} - -// Public Methods -////////////////////////////////////////////////////////////// - -void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait -{ - _timeout = timeout; -} - - // find returns true if the target string is found -bool Stream::find(char *target) -{ - return findUntil(target, NULL); -} - -// reads data from the stream until the target string of given length is found -// returns true if target string is found, false if timed out -bool Stream::find(char *target, size_t length) -{ - return findUntil(target, length, NULL, 0); -} - -// as find but search ends if the terminator string is found -bool Stream::findUntil(char *target, char *terminator) -{ - return findUntil(target, strlen(target), terminator, strlen(terminator)); -} - -// reads data from the stream until the target string of the given length is found -// search terminated if the terminator string is found -// returns true if target string is found, false if terminated or timed out -bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen) -{ - size_t index = 0; // maximum target string length is 64k bytes! - size_t termIndex = 0; - int c; - - if( *target == 0) - return true; // return true if target is a null string - while( (c = timedRead()) > 0){ - - if(c != target[index]) - index = 0; // reset index if any char does not match - - if( c == target[index]){ - //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); - if(++index >= targetLen){ // return true if all chars in the target match - return true; - } - } - - if(termLen > 0 && c == terminator[termIndex]){ - if(++termIndex >= termLen) - return false; // return false if terminate string found before target string - } - else - termIndex = 0; - } - return false; -} - - -// returns the first valid (long) integer value from the current position. -// initial characters that are not digits (or the minus sign) are skipped -// function is terminated by the first character that is not a digit. -long Stream::parseInt() -{ - return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) -} - -// as above but a given skipChar is ignored -// this allows format characters (typically commas) in values to be ignored -long Stream::parseInt(char skipChar) -{ - boolean isNegative = false; - long value = 0; - int c; - - c = peekNextDigit(); - // ignore non numeric leading characters - if(c < 0) - return 0; // zero returned if timeout - - do{ - if(c == skipChar) - ; // ignore this charactor - else if(c == '-') - isNegative = true; - else if(c >= '0' && c <= '9') // is c a digit? - value = value * 10 + c - '0'; - read(); // consume the character we got with peek - c = timedPeek(); - } - while( (c >= '0' && c <= '9') || c == skipChar ); - - if(isNegative) - value = -value; - return value; -} - - -// as parseInt but returns a floating point value -float Stream::parseFloat() -{ - return parseFloat(NO_SKIP_CHAR); -} - -// as above but the given skipChar is ignored -// this allows format characters (typically commas) in values to be ignored -float Stream::parseFloat(char skipChar){ - boolean isNegative = false; - boolean isFraction = false; - long value = 0; - char c; - float fraction = 1.0; - - c = peekNextDigit(); - // ignore non numeric leading characters - if(c < 0) - return 0; // zero returned if timeout - - do{ - if(c == skipChar) - ; // ignore - else if(c == '-') - isNegative = true; - else if (c == '.') - isFraction = true; - else if(c >= '0' && c <= '9') { // is c a digit? - value = value * 10 + c - '0'; - if(isFraction) - fraction *= 0.1; - } - read(); // consume the character we got with peek - c = timedPeek(); - } - while( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); - - if(isNegative) - value = -value; - if(isFraction) - return value * fraction; - else - return value; -} - -// read characters from stream into buffer -// terminates if length characters have been read, or timeout (see setTimeout) -// returns the number of characters placed in the buffer -// the buffer is NOT null terminated. -// -size_t Stream::readBytes(char *buffer, size_t length) -{ - size_t count = 0; - while (count < length) { - int c = timedRead(); - if (c < 0) break; - *buffer++ = (char)c; - count++; - } - return count; -} - - -// as readBytes with terminator character -// terminates if length characters have been read, timeout, or if the terminator character detected -// returns the number of characters placed in the buffer (0 means no valid data found) - -size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) -{ - if (length < 1) return 0; - size_t index = 0; - while (index < length) { - int c = timedRead(); - if (c < 0 || c == terminator) break; - *buffer++ = (char)c; - index++; - } - return index; // return number of characters, not including null terminator -} - -String Stream::readString() -{ - String ret; - int c = timedRead(); - while (c >= 0) - { - ret += (char)c; - c = timedRead(); - } - return ret; -} - -String Stream::readStringUntil(char terminator) -{ - String ret; - int c = timedRead(); - while (c >= 0 && c != terminator) - { - ret += (char)c; - c = timedRead(); - } - return ret; -} - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h deleted file mode 100644 index 58bbf752f3..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Stream.h - base class for character-based streams. - Copyright (c) 2010 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - parsing functions based on TextFinder library by Michael Margolis -*/ - -#ifndef Stream_h -#define Stream_h - -#include -#include "Print.h" - -// compatability macros for testing -/* -#define getInt() parseInt() -#define getInt(skipChar) parseInt(skipchar) -#define getFloat() parseFloat() -#define getFloat(skipChar) parseFloat(skipChar) -#define getString( pre_string, post_string, buffer, length) -readBytesBetween( pre_string, terminator, buffer, length) -*/ - -class Stream : public Print -{ - private: - unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read - unsigned long _startMillis; // used for timeout measurement - int timedRead(); // private method to read stream with timeout - int timedPeek(); // private method to peek stream with timeout - int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout - - public: - virtual int available() = 0; - virtual int read() = 0; - virtual int peek() = 0; - virtual void flush() = 0; - - Stream() {_timeout=1000;} - -// parsing methods - - void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second - - bool find(char *target); // reads data from the stream until the target string is found - // returns true if target string is found, false if timed out (see setTimeout) - - bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found - // returns true if target string is found, false if timed out - - bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found - - bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found - - - long parseInt(); // returns the first valid (long) integer value from the current position. - // initial characters that are not digits (or the minus sign) are skipped - // integer is terminated by the first character that is not a digit. - - float parseFloat(); // float version of parseInt - - size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer - // terminates if length characters have been read or timeout (see setTimeout) - // returns the number of characters placed in the buffer (0 means no valid data found) - - size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character - // terminates if length characters have been read, timeout, or if the terminator character detected - // returns the number of characters placed in the buffer (0 means no valid data found) - - // Arduino String functions to be added here - String readString(); - String readStringUntil(char terminator); - - protected: - long parseInt(char skipChar); // as above but the given skipChar is ignored - // as above but the given skipChar is ignored - // this allows format characters (typically commas) in values to be ignored - - float parseFloat(char skipChar); // as above but the given skipChar is ignored -}; - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp deleted file mode 100644 index 20eed3f483..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/* Tone.cpp - - A Tone Generator Library - - Written by Brett Hagman - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Version Modified By Date Comments -------- ----------- -------- -------- -0001 B Hagman 09/08/02 Initial coding -0002 B Hagman 09/08/18 Multiple pins -0003 B Hagman 09/08/18 Moved initialization from constructor to begin() -0004 B Hagman 09/09/26 Fixed problems with ATmega8 -0005 B Hagman 09/11/23 Scanned prescalars for best fit on 8 bit timers - 09/11/25 Changed pin toggle method to XOR - 09/11/25 Fixed timer0 from being excluded -0006 D Mellis 09/12/29 Replaced objects with functions -0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register -*************************************************/ - -#include -#include -#include "Arduino.h" -#include "pins_arduino.h" - -#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__) -#define TCCR2A TCCR2 -#define TCCR2B TCCR2 -#define COM2A1 COM21 -#define COM2A0 COM20 -#define OCR2A OCR2 -#define TIMSK2 TIMSK -#define OCIE2A OCIE2 -#define TIMER2_COMPA_vect TIMER2_COMP_vect -#define TIMSK1 TIMSK -#endif - -// timerx_toggle_count: -// > 0 - duration specified -// = 0 - stopped -// < 0 - infinitely (until stop() method called, or new play() called) - -#if !defined(__AVR_ATmega8__) -volatile long timer0_toggle_count; -volatile uint8_t *timer0_pin_port; -volatile uint8_t timer0_pin_mask; -#endif - -volatile long timer1_toggle_count; -volatile uint8_t *timer1_pin_port; -volatile uint8_t timer1_pin_mask; -volatile long timer2_toggle_count; -volatile uint8_t *timer2_pin_port; -volatile uint8_t timer2_pin_mask; - -#if defined(TIMSK3) -volatile long timer3_toggle_count; -volatile uint8_t *timer3_pin_port; -volatile uint8_t timer3_pin_mask; -#endif - -#if defined(TIMSK4) -volatile long timer4_toggle_count; -volatile uint8_t *timer4_pin_port; -volatile uint8_t timer4_pin_mask; -#endif - -#if defined(TIMSK5) -volatile long timer5_toggle_count; -volatile uint8_t *timer5_pin_port; -volatile uint8_t timer5_pin_mask; -#endif - - -// MLS: This does not make sense, the 3 options are the same -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) - -#define AVAILABLE_TONE_PINS 1 - -const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 3, 4, 5, 1, 0 */ }; -static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255, 255, 255, 255 */ }; - -#elif defined(__AVR_ATmega8__) - -#define AVAILABLE_TONE_PINS 1 - -const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1 */ }; -static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255 */ }; - -#else - -#define AVAILABLE_TONE_PINS 1 - -// Leave timer 0 to last. -const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1, 0 */ }; -static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255 */ }; - -#endif - - - -static int8_t toneBegin(uint8_t _pin) -{ - int8_t _timer = -1; - - // if we're already using the pin, the timer should be configured. - for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { - if (tone_pins[i] == _pin) { - return pgm_read_byte(tone_pin_to_timer_PGM + i); - } - } - - // search for an unused timer. - for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { - if (tone_pins[i] == 255) { - tone_pins[i] = _pin; - _timer = pgm_read_byte(tone_pin_to_timer_PGM + i); - break; - } - } - - if (_timer != -1) - { - // Set timer specific stuff - // All timers in CTC mode - // 8 bit timers will require changing prescalar values, - // whereas 16 bit timers are set to either ck/1 or ck/64 prescalar - switch (_timer) - { - #if defined(TCCR0A) && defined(TCCR0B) - case 0: - // 8 bit timer - TCCR0A = 0; - TCCR0B = 0; - bitWrite(TCCR0A, WGM01, 1); - bitWrite(TCCR0B, CS00, 1); - timer0_pin_port = portOutputRegister(digitalPinToPort(_pin)); - timer0_pin_mask = digitalPinToBitMask(_pin); - break; - #endif - - #if defined(TCCR1A) && defined(TCCR1B) && defined(WGM12) - case 1: - // 16 bit timer - TCCR1A = 0; - TCCR1B = 0; - bitWrite(TCCR1B, WGM12, 1); - bitWrite(TCCR1B, CS10, 1); - timer1_pin_port = portOutputRegister(digitalPinToPort(_pin)); - timer1_pin_mask = digitalPinToBitMask(_pin); - break; - #endif - - #if defined(TCCR2A) && defined(TCCR2B) - case 2: - // 8 bit timer - TCCR2A = 0; - TCCR2B = 0; - bitWrite(TCCR2A, WGM21, 1); - bitWrite(TCCR2B, CS20, 1); - timer2_pin_port = portOutputRegister(digitalPinToPort(_pin)); - timer2_pin_mask = digitalPinToBitMask(_pin); - break; - #endif - - #if defined(TCCR3A) && defined(TCCR3B) && defined(TIMSK3) - case 3: - // 16 bit timer - TCCR3A = 0; - TCCR3B = 0; - bitWrite(TCCR3B, WGM32, 1); - bitWrite(TCCR3B, CS30, 1); - timer3_pin_port = portOutputRegister(digitalPinToPort(_pin)); - timer3_pin_mask = digitalPinToBitMask(_pin); - break; - #endif - - #if defined(TCCR4A) && defined(TCCR4B) && defined(TIMSK4) - case 4: - // 16 bit timer - TCCR4A = 0; - TCCR4B = 0; - #if defined(WGM42) - bitWrite(TCCR4B, WGM42, 1); - #elif defined(CS43) - #warning this may not be correct - // atmega32u4 - bitWrite(TCCR4B, CS43, 1); - #endif - bitWrite(TCCR4B, CS40, 1); - timer4_pin_port = portOutputRegister(digitalPinToPort(_pin)); - timer4_pin_mask = digitalPinToBitMask(_pin); - break; - #endif - - #if defined(TCCR5A) && defined(TCCR5B) && defined(TIMSK5) - case 5: - // 16 bit timer - TCCR5A = 0; - TCCR5B = 0; - bitWrite(TCCR5B, WGM52, 1); - bitWrite(TCCR5B, CS50, 1); - timer5_pin_port = portOutputRegister(digitalPinToPort(_pin)); - timer5_pin_mask = digitalPinToBitMask(_pin); - break; - #endif - } - } - - return _timer; -} - - - -// frequency (in hertz) and duration (in milliseconds). - -void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) -{ - uint8_t prescalarbits = 0b001; - long toggle_count = 0; - uint32_t ocr = 0; - int8_t _timer; - - _timer = toneBegin(_pin); - - if (_timer >= 0) - { - // Set the pinMode as OUTPUT - pinMode(_pin, OUTPUT); - - // if we are using an 8 bit timer, scan through prescalars to find the best fit - if (_timer == 0 || _timer == 2) - { - ocr = F_CPU / frequency / 2 - 1; - prescalarbits = 0b001; // ck/1: same for both timers - if (ocr > 255) - { - ocr = F_CPU / frequency / 2 / 8 - 1; - prescalarbits = 0b010; // ck/8: same for both timers - - if (_timer == 2 && ocr > 255) - { - ocr = F_CPU / frequency / 2 / 32 - 1; - prescalarbits = 0b011; - } - - if (ocr > 255) - { - ocr = F_CPU / frequency / 2 / 64 - 1; - prescalarbits = _timer == 0 ? 0b011 : 0b100; - - if (_timer == 2 && ocr > 255) - { - ocr = F_CPU / frequency / 2 / 128 - 1; - prescalarbits = 0b101; - } - - if (ocr > 255) - { - ocr = F_CPU / frequency / 2 / 256 - 1; - prescalarbits = _timer == 0 ? 0b100 : 0b110; - if (ocr > 255) - { - // can't do any better than /1024 - ocr = F_CPU / frequency / 2 / 1024 - 1; - prescalarbits = _timer == 0 ? 0b101 : 0b111; - } - } - } - } - -#if defined(TCCR0B) - if (_timer == 0) - { - TCCR0B = prescalarbits; - } - else -#endif -#if defined(TCCR2B) - { - TCCR2B = prescalarbits; - } -#else - { - // dummy place holder to make the above ifdefs work - } -#endif - } - else - { - // two choices for the 16 bit timers: ck/1 or ck/64 - ocr = F_CPU / frequency / 2 - 1; - - prescalarbits = 0b001; - if (ocr > 0xffff) - { - ocr = F_CPU / frequency / 2 / 64 - 1; - prescalarbits = 0b011; - } - - if (_timer == 1) - { -#if defined(TCCR1B) - TCCR1B = (TCCR1B & 0b11111000) | prescalarbits; -#endif - } -#if defined(TCCR3B) - else if (_timer == 3) - TCCR3B = (TCCR3B & 0b11111000) | prescalarbits; -#endif -#if defined(TCCR4B) - else if (_timer == 4) - TCCR4B = (TCCR4B & 0b11111000) | prescalarbits; -#endif -#if defined(TCCR5B) - else if (_timer == 5) - TCCR5B = (TCCR5B & 0b11111000) | prescalarbits; -#endif - - } - - - // Calculate the toggle count - if (duration > 0) - { - toggle_count = 2 * frequency * duration / 1000; - } - else - { - toggle_count = -1; - } - - // Set the OCR for the given timer, - // set the toggle count, - // then turn on the interrupts - switch (_timer) - { - -#if defined(OCR0A) && defined(TIMSK0) && defined(OCIE0A) - case 0: - OCR0A = ocr; - timer0_toggle_count = toggle_count; - bitWrite(TIMSK0, OCIE0A, 1); - break; -#endif - - case 1: -#if defined(OCR1A) && defined(TIMSK1) && defined(OCIE1A) - OCR1A = ocr; - timer1_toggle_count = toggle_count; - bitWrite(TIMSK1, OCIE1A, 1); -#elif defined(OCR1A) && defined(TIMSK) && defined(OCIE1A) - // this combination is for at least the ATmega32 - OCR1A = ocr; - timer1_toggle_count = toggle_count; - bitWrite(TIMSK, OCIE1A, 1); -#endif - break; - -#if defined(OCR2A) && defined(TIMSK2) && defined(OCIE2A) - case 2: - OCR2A = ocr; - timer2_toggle_count = toggle_count; - bitWrite(TIMSK2, OCIE2A, 1); - break; -#endif - -#if defined(TIMSK3) - case 3: - OCR3A = ocr; - timer3_toggle_count = toggle_count; - bitWrite(TIMSK3, OCIE3A, 1); - break; -#endif - -#if defined(TIMSK4) - case 4: - OCR4A = ocr; - timer4_toggle_count = toggle_count; - bitWrite(TIMSK4, OCIE4A, 1); - break; -#endif - -#if defined(OCR5A) && defined(TIMSK5) && defined(OCIE5A) - case 5: - OCR5A = ocr; - timer5_toggle_count = toggle_count; - bitWrite(TIMSK5, OCIE5A, 1); - break; -#endif - - } - } -} - - -// XXX: this function only works properly for timer 2 (the only one we use -// currently). for the others, it should end the tone, but won't restore -// proper PWM functionality for the timer. -void disableTimer(uint8_t _timer) -{ - switch (_timer) - { - case 0: - #if defined(TIMSK0) - TIMSK0 = 0; - #elif defined(TIMSK) - TIMSK = 0; // atmega32 - #endif - break; - -#if defined(TIMSK1) && defined(OCIE1A) - case 1: - bitWrite(TIMSK1, OCIE1A, 0); - break; -#endif - - case 2: - #if defined(TIMSK2) && defined(OCIE2A) - bitWrite(TIMSK2, OCIE2A, 0); // disable interrupt - #endif - #if defined(TCCR2A) && defined(WGM20) - TCCR2A = (1 << WGM20); - #endif - #if defined(TCCR2B) && defined(CS22) - TCCR2B = (TCCR2B & 0b11111000) | (1 << CS22); - #endif - #if defined(OCR2A) - OCR2A = 0; - #endif - break; - -#if defined(TIMSK3) - case 3: - TIMSK3 = 0; - break; -#endif - -#if defined(TIMSK4) - case 4: - TIMSK4 = 0; - break; -#endif - -#if defined(TIMSK5) - case 5: - TIMSK5 = 0; - break; -#endif - } -} - - -void noTone(uint8_t _pin) -{ - int8_t _timer = -1; - - for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { - if (tone_pins[i] == _pin) { - _timer = pgm_read_byte(tone_pin_to_timer_PGM + i); - tone_pins[i] = 255; - } - } - - disableTimer(_timer); - - digitalWrite(_pin, 0); -} - -#if 0 -#if !defined(__AVR_ATmega8__) -ISR(TIMER0_COMPA_vect) -{ - if (timer0_toggle_count != 0) - { - // toggle the pin - *timer0_pin_port ^= timer0_pin_mask; - - if (timer0_toggle_count > 0) - timer0_toggle_count--; - } - else - { - disableTimer(0); - *timer0_pin_port &= ~(timer0_pin_mask); // keep pin low after stop - } -} -#endif - - -ISR(TIMER1_COMPA_vect) -{ - if (timer1_toggle_count != 0) - { - // toggle the pin - *timer1_pin_port ^= timer1_pin_mask; - - if (timer1_toggle_count > 0) - timer1_toggle_count--; - } - else - { - disableTimer(1); - *timer1_pin_port &= ~(timer1_pin_mask); // keep pin low after stop - } -} -#endif - - -ISR(TIMER2_COMPA_vect) -{ - - if (timer2_toggle_count != 0) - { - // toggle the pin - *timer2_pin_port ^= timer2_pin_mask; - - if (timer2_toggle_count > 0) - timer2_toggle_count--; - } - else - { - // need to call noTone() so that the tone_pins[] entry is reset, so the - // timer gets initialized next time we call tone(). - // XXX: this assumes timer 2 is always the first one used. - noTone(tone_pins[0]); -// disableTimer(2); -// *timer2_pin_port &= ~(timer2_pin_mask); // keep pin low after stop - } -} - - - -//#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#if 0 - -ISR(TIMER3_COMPA_vect) -{ - if (timer3_toggle_count != 0) - { - // toggle the pin - *timer3_pin_port ^= timer3_pin_mask; - - if (timer3_toggle_count > 0) - timer3_toggle_count--; - } - else - { - disableTimer(3); - *timer3_pin_port &= ~(timer3_pin_mask); // keep pin low after stop - } -} - -ISR(TIMER4_COMPA_vect) -{ - if (timer4_toggle_count != 0) - { - // toggle the pin - *timer4_pin_port ^= timer4_pin_mask; - - if (timer4_toggle_count > 0) - timer4_toggle_count--; - } - else - { - disableTimer(4); - *timer4_pin_port &= ~(timer4_pin_mask); // keep pin low after stop - } -} - -ISR(TIMER5_COMPA_vect) -{ - if (timer5_toggle_count != 0) - { - // toggle the pin - *timer5_pin_port ^= timer5_pin_mask; - - if (timer5_toggle_count > 0) - timer5_toggle_count--; - } - else - { - disableTimer(5); - *timer5_pin_port &= ~(timer5_pin_mask); // keep pin low after stop - } -} - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h deleted file mode 100644 index d5abdb690d..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h +++ /dev/null @@ -1,195 +0,0 @@ - - -#ifndef __USBAPI__ -#define __USBAPI__ - -#if defined(USBCON) - -//================================================================================ -//================================================================================ -// USB - -class USBDevice_ -{ -public: - USBDevice_(); - bool configured(); - - void attach(); - void detach(); // Serial port goes down too... - void poll(); -}; -extern USBDevice_ USBDevice; - -//================================================================================ -//================================================================================ -// Serial over CDC (Serial1 is the physical port) - -class Serial_ : public Stream -{ -private: - ring_buffer *_cdc_rx_buffer; -public: - void begin(uint16_t baud_count); - void end(void); - - virtual int available(void); - virtual void accept(void); - virtual int peek(void); - virtual int read(void); - virtual void flush(void); - virtual size_t write(uint8_t); - operator bool(); -}; -extern Serial_ Serial; - -//================================================================================ -//================================================================================ -// Mouse - -#define MOUSE_LEFT 1 -#define MOUSE_RIGHT 2 -#define MOUSE_MIDDLE 4 -#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE) - -class Mouse_ -{ -private: - uint8_t _buttons; - void buttons(uint8_t b); -public: - Mouse_(void); - void begin(void); - void end(void); - void click(uint8_t b = MOUSE_LEFT); - void move(signed char x, signed char y, signed char wheel = 0); - void press(uint8_t b = MOUSE_LEFT); // press LEFT by default - void release(uint8_t b = MOUSE_LEFT); // release LEFT by default - bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default -}; -extern Mouse_ Mouse; - -//================================================================================ -//================================================================================ -// Keyboard - -#define KEY_LEFT_CTRL 0x80 -#define KEY_LEFT_SHIFT 0x81 -#define KEY_LEFT_ALT 0x82 -#define KEY_LEFT_GUI 0x83 -#define KEY_RIGHT_CTRL 0x84 -#define KEY_RIGHT_SHIFT 0x85 -#define KEY_RIGHT_ALT 0x86 -#define KEY_RIGHT_GUI 0x87 - -#define KEY_UP_ARROW 0xDA -#define KEY_DOWN_ARROW 0xD9 -#define KEY_LEFT_ARROW 0xD8 -#define KEY_RIGHT_ARROW 0xD7 -#define KEY_BACKSPACE 0xB2 -#define KEY_TAB 0xB3 -#define KEY_RETURN 0xB0 -#define KEY_ESC 0xB1 -#define KEY_INSERT 0xD1 -#define KEY_DELETE 0xD4 -#define KEY_PAGE_UP 0xD3 -#define KEY_PAGE_DOWN 0xD6 -#define KEY_HOME 0xD2 -#define KEY_END 0xD5 -#define KEY_CAPS_LOCK 0xC1 -#define KEY_F1 0xC2 -#define KEY_F2 0xC3 -#define KEY_F3 0xC4 -#define KEY_F4 0xC5 -#define KEY_F5 0xC6 -#define KEY_F6 0xC7 -#define KEY_F7 0xC8 -#define KEY_F8 0xC9 -#define KEY_F9 0xCA -#define KEY_F10 0xCB -#define KEY_F11 0xCC -#define KEY_F12 0xCD - -// Low level key report: up to 6 keys and shift, ctrl etc at once -typedef struct -{ - uint8_t modifiers; - uint8_t reserved; - uint8_t keys[6]; -} KeyReport; - -class Keyboard_ : public Print -{ -private: - KeyReport _keyReport; - void sendReport(KeyReport* keys); -public: - Keyboard_(void); - void begin(void); - void end(void); - virtual size_t write(uint8_t k); - virtual size_t press(uint8_t k); - virtual size_t release(uint8_t k); - virtual void releaseAll(void); -}; -extern Keyboard_ Keyboard; - -//================================================================================ -//================================================================================ -// Low level API - -typedef struct -{ - uint8_t bmRequestType; - uint8_t bRequest; - uint8_t wValueL; - uint8_t wValueH; - uint16_t wIndex; - uint16_t wLength; -} Setup; - -//================================================================================ -//================================================================================ -// HID 'Driver' - -int HID_GetInterface(uint8_t* interfaceNum); -int HID_GetDescriptor(int i); -bool HID_Setup(Setup& setup); -void HID_SendReport(uint8_t id, const void* data, int len); - -//================================================================================ -//================================================================================ -// MSC 'Driver' - -int MSC_GetInterface(uint8_t* interfaceNum); -int MSC_GetDescriptor(int i); -bool MSC_Setup(Setup& setup); -bool MSC_Data(uint8_t rx,uint8_t tx); - -//================================================================================ -//================================================================================ -// CSC 'Driver' - -int CDC_GetInterface(uint8_t* interfaceNum); -int CDC_GetDescriptor(int i); -bool CDC_Setup(Setup& setup); - -//================================================================================ -//================================================================================ - -#define TRANSFER_PGM 0x80 -#define TRANSFER_RELEASE 0x40 -#define TRANSFER_ZERO 0x20 - -int USB_SendControl(uint8_t flags, const void* d, int len); -int USB_RecvControl(void* d, int len); - -uint8_t USB_Available(uint8_t ep); -int USB_Send(uint8_t ep, const void* data, int len); // blocking -int USB_Recv(uint8_t ep, void* data, int len); // non-blocking -int USB_Recv(uint8_t ep); // non-blocking -void USB_Flush(uint8_t ep); - -#endif - -#endif /* if defined(USBCON) */ \ No newline at end of file diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp deleted file mode 100644 index 6766be61ab..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp +++ /dev/null @@ -1,672 +0,0 @@ - - -/* Copyright (c) 2010, Peter Barrett -** -** Permission to use, copy, modify, and/or distribute this software for -** any purpose with or without fee is hereby granted, provided that the -** above copyright notice and this permission notice appear in all copies. -** -** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR -** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -** SOFTWARE. -*/ - -#include "Platform.h" -#include "USBAPI.h" -#include "USBDesc.h" - -#if defined(USBCON) - -#define EP_TYPE_CONTROL 0x00 -#define EP_TYPE_BULK_IN 0x81 -#define EP_TYPE_BULK_OUT 0x80 -#define EP_TYPE_INTERRUPT_IN 0xC1 -#define EP_TYPE_INTERRUPT_OUT 0xC0 -#define EP_TYPE_ISOCHRONOUS_IN 0x41 -#define EP_TYPE_ISOCHRONOUS_OUT 0x40 - -/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */ -#define TX_RX_LED_PULSE_MS 100 -volatile u8 TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ -volatile u8 RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ - -//================================================================== -//================================================================== - -extern const u16 STRING_LANGUAGE[] PROGMEM; -extern const u16 STRING_IPRODUCT[] PROGMEM; -extern const u16 STRING_IMANUFACTURER[] PROGMEM; -extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM; -extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM; - -const u16 STRING_LANGUAGE[2] = { - (3<<8) | (2+2), - 0x0409 // English -}; - -const u16 STRING_IPRODUCT[17] = { - (3<<8) | (2+2*16), -#if USB_PID == 0x8036 - 'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o' -#else - 'U','S','B',' ','I','O',' ','B','o','a','r','d',' ',' ',' ',' ' -#endif -}; - -const u16 STRING_IMANUFACTURER[12] = { - (3<<8) | (2+2*11), -#if USB_VID == 0x2341 - 'A','r','d','u','i','n','o',' ','L','L','C' -#else - 'U','n','k','n','o','w','n',' ',' ',' ',' ' -#endif -}; - -#ifdef CDC_ENABLED -#define DEVICE_CLASS 0x02 -#else -#define DEVICE_CLASS 0x00 -#endif - -// DEVICE DESCRIPTOR -const DeviceDescriptor USB_DeviceDescriptor = - D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); - -const DeviceDescriptor USB_DeviceDescriptorA = - D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); - -//================================================================== -//================================================================== - -volatile u8 _usbConfiguration = 0; - -static inline void WaitIN(void) -{ - while (!(UEINTX & (1< len) - n = len; - len -= n; - { - LockEP lock(ep); - if (ep & TRANSFER_ZERO) - { - while (n--) - Send8(0); - } - else if (ep & TRANSFER_PGM) - { - while (n--) - Send8(pgm_read_byte(data++)); - } - else - { - while (n--) - Send8(*data++); - } - if (!ReadWriteAllowed() || ((len == 0) && (ep & TRANSFER_RELEASE))) // Release full buffer - ReleaseTX(); - } - } - TXLED1; // light the TX LED - TxLEDPulse = TX_RX_LED_PULSE_MS; - return r; -} - -extern const u8 _initEndpoints[] PROGMEM; -const u8 _initEndpoints[] = -{ - 0, - -#ifdef CDC_ENABLED - EP_TYPE_INTERRUPT_IN, // CDC_ENDPOINT_ACM - EP_TYPE_BULK_OUT, // CDC_ENDPOINT_OUT - EP_TYPE_BULK_IN, // CDC_ENDPOINT_IN -#endif - -#ifdef HID_ENABLED - EP_TYPE_INTERRUPT_IN // HID_ENDPOINT_INT -#endif -}; - -#define EP_SINGLE_64 0x32 // EP0 -#define EP_DOUBLE_64 0x36 // Other endpoints - -static -void InitEP(u8 index, u8 type, u8 size) -{ - UENUM = index; - UECONX = 1; - UECFG0X = type; - UECFG1X = size; -} - -static -void InitEndpoints() -{ - for (u8 i = 1; i < sizeof(_initEndpoints); i++) - { - UENUM = i; - UECONX = 1; - UECFG0X = pgm_read_byte(_initEndpoints+i); - UECFG1X = EP_DOUBLE_64; - } - UERST = 0x7E; // And reset them - UERST = 0; -} - -// Handle CLASS_INTERFACE requests -static -bool ClassInterfaceRequest(Setup& setup) -{ - u8 i = setup.wIndex; - -#ifdef CDC_ENABLED - if (CDC_ACM_INTERFACE == i) - return CDC_Setup(setup); -#endif - -#ifdef HID_ENABLED - if (HID_INTERFACE == i) - return HID_Setup(setup); -#endif - return false; -} - -int _cmark; -int _cend; -void InitControl(int end) -{ - SetEP(0); - _cmark = 0; - _cend = end; -} - -static -bool SendControl(u8 d) -{ - if (_cmark < _cend) - { - if (!WaitForINOrOUT()) - return false; - Send8(d); - if (!((_cmark + 1) & 0x3F)) - ClearIN(); // Fifo is full, release this packet - } - _cmark++; - return true; -}; - -// Clipped by _cmark/_cend -int USB_SendControl(u8 flags, const void* d, int len) -{ - int sent = len; - const u8* data = (const u8*)d; - bool pgm = flags & TRANSFER_PGM; - while (len--) - { - u8 c = pgm ? pgm_read_byte(data++) : *data++; - if (!SendControl(c)) - return -1; - } - return sent; -} - -// Does not timeout or cross fifo boundaries -// Will only work for transfers <= 64 bytes -// TODO -int USB_RecvControl(void* d, int len) -{ - WaitOUT(); - Recv((u8*)d,len); - ClearOUT(); - return len; -} - -int SendInterfaces() -{ - int total = 0; - u8 interfaces = 0; - -#ifdef CDC_ENABLED - total = CDC_GetInterface(&interfaces); -#endif - -#ifdef HID_ENABLED - total += HID_GetInterface(&interfaces); -#endif - - return interfaces; -} - -// Construct a dynamic configuration descriptor -// This really needs dynamic endpoint allocation etc -// TODO -static -bool SendConfiguration(int maxlen) -{ - // Count and measure interfaces - InitControl(0); - int interfaces = SendInterfaces(); - ConfigDescriptor config = D_CONFIG(_cmark + sizeof(ConfigDescriptor),interfaces); - - // Now send them - InitControl(maxlen); - USB_SendControl(0,&config,sizeof(ConfigDescriptor)); - SendInterfaces(); - return true; -} - -u8 _cdcComposite = 0; - -static -bool SendDescriptor(Setup& setup) -{ - u8 t = setup.wValueH; - if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t) - return SendConfiguration(setup.wLength); - - InitControl(setup.wLength); -#ifdef HID_ENABLED - if (HID_REPORT_DESCRIPTOR_TYPE == t) - return HID_GetDescriptor(t); -#endif - - u8 desc_length = 0; - const u8* desc_addr = 0; - if (USB_DEVICE_DESCRIPTOR_TYPE == t) - { - if (setup.wLength == 8) - _cdcComposite = 1; - desc_addr = _cdcComposite ? (const u8*)&USB_DeviceDescriptorA : (const u8*)&USB_DeviceDescriptor; - } - else if (USB_STRING_DESCRIPTOR_TYPE == t) - { - if (setup.wValueL == 0) - desc_addr = (const u8*)&STRING_LANGUAGE; - else if (setup.wValueL == IPRODUCT) - desc_addr = (const u8*)&STRING_IPRODUCT; - else if (setup.wValueL == IMANUFACTURER) - desc_addr = (const u8*)&STRING_IMANUFACTURER; - else - return false; - } - - if (desc_addr == 0) - return false; - if (desc_length == 0) - desc_length = pgm_read_byte(desc_addr); - - USB_SendControl(TRANSFER_PGM,desc_addr,desc_length); - return true; -} - -// Endpoint 0 interrupt -ISR(USB_COM_vect) -{ - SetEP(0); - if (!ReceivedSetupInt()) - return; - - Setup setup; - Recv((u8*)&setup,8); - ClearSetupInt(); - - u8 requestType = setup.bmRequestType; - if (requestType & REQUEST_DEVICETOHOST) - WaitIN(); - else - ClearIN(); - - bool ok = true; - if (REQUEST_STANDARD == (requestType & REQUEST_TYPE)) - { - // Standard Requests - u8 r = setup.bRequest; - if (GET_STATUS == r) - { - Send8(0); // TODO - Send8(0); - } - else if (CLEAR_FEATURE == r) - { - } - else if (SET_FEATURE == r) - { - } - else if (SET_ADDRESS == r) - { - WaitIN(); - UDADDR = setup.wValueL | (1<> 8) & 0xFF) - -#define CDC_V1_10 0x0110 -#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 - -#define CDC_CALL_MANAGEMENT 0x01 -#define CDC_ABSTRACT_CONTROL_MODEL 0x02 -#define CDC_HEADER 0x00 -#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 -#define CDC_UNION 0x06 -#define CDC_CS_INTERFACE 0x24 -#define CDC_CS_ENDPOINT 0x25 -#define CDC_DATA_INTERFACE_CLASS 0x0A - -#define MSC_SUBCLASS_SCSI 0x06 -#define MSC_PROTOCOL_BULK_ONLY 0x50 - -#define HID_HID_DESCRIPTOR_TYPE 0x21 -#define HID_REPORT_DESCRIPTOR_TYPE 0x22 -#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 - - -// Device -typedef struct { - u8 len; // 18 - u8 dtype; // 1 USB_DEVICE_DESCRIPTOR_TYPE - u16 usbVersion; // 0x200 - u8 deviceClass; - u8 deviceSubClass; - u8 deviceProtocol; - u8 packetSize0; // Packet 0 - u16 idVendor; - u16 idProduct; - u16 deviceVersion; // 0x100 - u8 iManufacturer; - u8 iProduct; - u8 iSerialNumber; - u8 bNumConfigurations; -} DeviceDescriptor; - -// Config -typedef struct { - u8 len; // 9 - u8 dtype; // 2 - u16 clen; // total length - u8 numInterfaces; - u8 config; - u8 iconfig; - u8 attributes; - u8 maxPower; -} ConfigDescriptor; - -// String - -// Interface -typedef struct -{ - u8 len; // 9 - u8 dtype; // 4 - u8 number; - u8 alternate; - u8 numEndpoints; - u8 interfaceClass; - u8 interfaceSubClass; - u8 protocol; - u8 iInterface; -} InterfaceDescriptor; - -// Endpoint -typedef struct -{ - u8 len; // 7 - u8 dtype; // 5 - u8 addr; - u8 attr; - u16 packetSize; - u8 interval; -} EndpointDescriptor; - -// Interface Association Descriptor -// Used to bind 2 interfaces together in CDC compostite device -typedef struct -{ - u8 len; // 8 - u8 dtype; // 11 - u8 firstInterface; - u8 interfaceCount; - u8 functionClass; - u8 funtionSubClass; - u8 functionProtocol; - u8 iInterface; -} IADDescriptor; - -// CDC CS interface descriptor -typedef struct -{ - u8 len; // 5 - u8 dtype; // 0x24 - u8 subtype; - u8 d0; - u8 d1; -} CDCCSInterfaceDescriptor; - -typedef struct -{ - u8 len; // 4 - u8 dtype; // 0x24 - u8 subtype; - u8 d0; -} CDCCSInterfaceDescriptor4; - -typedef struct -{ - u8 len; - u8 dtype; // 0x24 - u8 subtype; // 1 - u8 bmCapabilities; - u8 bDataInterface; -} CMFunctionalDescriptor; - -typedef struct -{ - u8 len; - u8 dtype; // 0x24 - u8 subtype; // 1 - u8 bmCapabilities; -} ACMFunctionalDescriptor; - -typedef struct -{ - // IAD - IADDescriptor iad; // Only needed on compound device - - // Control - InterfaceDescriptor cif; // - CDCCSInterfaceDescriptor header; - CMFunctionalDescriptor callManagement; // Call Management - ACMFunctionalDescriptor controlManagement; // ACM - CDCCSInterfaceDescriptor functionalDescriptor; // CDC_UNION - EndpointDescriptor cifin; - - // Data - InterfaceDescriptor dif; - EndpointDescriptor in; - EndpointDescriptor out; -} CDCDescriptor; - -typedef struct -{ - InterfaceDescriptor msc; - EndpointDescriptor in; - EndpointDescriptor out; -} MSCDescriptor; - -typedef struct -{ - u8 len; // 9 - u8 dtype; // 0x21 - u8 addr; - u8 versionL; // 0x101 - u8 versionH; // 0x101 - u8 country; - u8 desctype; // 0x22 report - u8 descLenL; - u8 descLenH; -} HIDDescDescriptor; - -typedef struct -{ - InterfaceDescriptor hid; - HIDDescDescriptor desc; - EndpointDescriptor in; -} HIDDescriptor; - - -#define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \ - { 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } - -#define D_CONFIG(_totalLength,_interfaces) \ - { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) } - -#define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \ - { 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 } - -#define D_ENDPOINT(_addr,_attr,_packetSize, _interval) \ - { 7, 5, _addr,_attr,_packetSize, _interval } - -#define D_IAD(_firstInterface, _count, _class, _subClass, _protocol) \ - { 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 } - -#define D_HIDREPORT(_descriptorLength) \ - { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 } - -#define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 } -#define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 } - - -#endif \ No newline at end of file diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h deleted file mode 100644 index 900713e0f9..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h +++ /dev/null @@ -1,63 +0,0 @@ - - -/* Copyright (c) 2011, Peter Barrett -** -** Permission to use, copy, modify, and/or distribute this software for -** any purpose with or without fee is hereby granted, provided that the -** above copyright notice and this permission notice appear in all copies. -** -** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL -** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR -** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -** SOFTWARE. -*/ - -#define CDC_ENABLED -#define HID_ENABLED - - -#ifdef CDC_ENABLED -#define CDC_INTERFACE_COUNT 2 -#define CDC_ENPOINT_COUNT 3 -#else -#define CDC_INTERFACE_COUNT 0 -#define CDC_ENPOINT_COUNT 0 -#endif - -#ifdef HID_ENABLED -#define HID_INTERFACE_COUNT 1 -#define HID_ENPOINT_COUNT 1 -#else -#define HID_INTERFACE_COUNT 0 -#define HID_ENPOINT_COUNT 0 -#endif - -#define CDC_ACM_INTERFACE 0 // CDC ACM -#define CDC_DATA_INTERFACE 1 // CDC Data -#define CDC_FIRST_ENDPOINT 1 -#define CDC_ENDPOINT_ACM (CDC_FIRST_ENDPOINT) // CDC First -#define CDC_ENDPOINT_OUT (CDC_FIRST_ENDPOINT+1) -#define CDC_ENDPOINT_IN (CDC_FIRST_ENDPOINT+2) - -#define HID_INTERFACE (CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT) // HID Interface -#define HID_FIRST_ENDPOINT (CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT) -#define HID_ENDPOINT_INT (HID_FIRST_ENDPOINT) - -#define INTERFACE_COUNT (MSC_INTERFACE + MSC_INTERFACE_COUNT) - -#ifdef CDC_ENABLED -#define CDC_RX CDC_ENDPOINT_OUT -#define CDC_TX CDC_ENDPOINT_IN -#endif - -#ifdef HID_ENABLED -#define HID_TX HID_ENDPOINT_INT -#endif - -#define IMANUFACTURER 1 -#define IPRODUCT 2 - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h deleted file mode 100644 index dc5644b9df..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Udp.cpp: Library to send/receive UDP packets. - * - * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) - * 1) UDP does not guarantee the order in which assembled UDP packets are received. This - * might not happen often in practice, but in larger network topologies, a UDP - * packet can be received out of sequence. - * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being - * aware of it. Again, this may not be a concern in practice on small local networks. - * For more information, see http://www.cafeaulait.org/course/week12/35.html - * - * MIT License: - * Copyright (c) 2008 Bjoern Hartmann - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * bjoern@cs.stanford.edu 12/30/2008 - */ - -#ifndef udp_h -#define udp_h - -#include -#include - -class UDP : public Stream { - -public: - virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual void stop() =0; // Finish with the UDP socket - - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, uint16_t port) =0; - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char *host, uint16_t port) =0; - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket() =0; - // Write a single byte into the packet - virtual size_t write(uint8_t) =0; - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t *buffer, size_t size) =0; - - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket() =0; - // Number of bytes remaining in the current packet - virtual int available() =0; - // Read a single byte from the current packet - virtual int read() =0; - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char* buffer, size_t len) =0; - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char* buffer, size_t len) =0; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek() =0; - virtual void flush() =0; // Finish reading the current packet - - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP() =0; - // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort() =0; -protected: - uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; -}; - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h deleted file mode 100644 index 79733b50a5..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - WCharacter.h - Character utility functions for Wiring & Arduino - Copyright (c) 2010 Hernando Barragan. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef Character_h -#define Character_h - -#include - -// WCharacter.h prototypes -inline boolean isAlphaNumeric(int c) __attribute__((always_inline)); -inline boolean isAlpha(int c) __attribute__((always_inline)); -inline boolean isAscii(int c) __attribute__((always_inline)); -inline boolean isWhitespace(int c) __attribute__((always_inline)); -inline boolean isControl(int c) __attribute__((always_inline)); -inline boolean isDigit(int c) __attribute__((always_inline)); -inline boolean isGraph(int c) __attribute__((always_inline)); -inline boolean isLowerCase(int c) __attribute__((always_inline)); -inline boolean isPrintable(int c) __attribute__((always_inline)); -inline boolean isPunct(int c) __attribute__((always_inline)); -inline boolean isSpace(int c) __attribute__((always_inline)); -inline boolean isUpperCase(int c) __attribute__((always_inline)); -inline boolean isHexadecimalDigit(int c) __attribute__((always_inline)); -inline int toAscii(int c) __attribute__((always_inline)); -inline int toLowerCase(int c) __attribute__((always_inline)); -inline int toUpperCase(int c)__attribute__((always_inline)); - - -// Checks for an alphanumeric character. -// It is equivalent to (isalpha(c) || isdigit(c)). -inline boolean isAlphaNumeric(int c) -{ - return ( isalnum(c) == 0 ? false : true); -} - - -// Checks for an alphabetic character. -// It is equivalent to (isupper(c) || islower(c)). -inline boolean isAlpha(int c) -{ - return ( isalpha(c) == 0 ? false : true); -} - - -// Checks whether c is a 7-bit unsigned char value -// that fits into the ASCII character set. -inline boolean isAscii(int c) -{ - return ( isascii (c) == 0 ? false : true); -} - - -// Checks for a blank character, that is, a space or a tab. -inline boolean isWhitespace(int c) -{ - return ( isblank (c) == 0 ? false : true); -} - - -// Checks for a control character. -inline boolean isControl(int c) -{ - return ( iscntrl (c) == 0 ? false : true); -} - - -// Checks for a digit (0 through 9). -inline boolean isDigit(int c) -{ - return ( isdigit (c) == 0 ? false : true); -} - - -// Checks for any printable character except space. -inline boolean isGraph(int c) -{ - return ( isgraph (c) == 0 ? false : true); -} - - -// Checks for a lower-case character. -inline boolean isLowerCase(int c) -{ - return (islower (c) == 0 ? false : true); -} - - -// Checks for any printable character including space. -inline boolean isPrintable(int c) -{ - return ( isprint (c) == 0 ? false : true); -} - - -// Checks for any printable character which is not a space -// or an alphanumeric character. -inline boolean isPunct(int c) -{ - return ( ispunct (c) == 0 ? false : true); -} - - -// Checks for white-space characters. For the avr-libc library, -// these are: space, formfeed ('\f'), newline ('\n'), carriage -// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). -inline boolean isSpace(int c) -{ - return ( isspace (c) == 0 ? false : true); -} - - -// Checks for an uppercase letter. -inline boolean isUpperCase(int c) -{ - return ( isupper (c) == 0 ? false : true); -} - - -// Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7 -// 8 9 a b c d e f A B C D E F. -inline boolean isHexadecimalDigit(int c) -{ - return ( isxdigit (c) == 0 ? false : true); -} - - -// Converts c to a 7-bit unsigned char value that fits into the -// ASCII character set, by clearing the high-order bits. -inline int toAscii(int c) -{ - return toascii (c); -} - - -// Warning: -// Many people will be unhappy if you use this function. -// This function will convert accented letters into random -// characters. - -// Converts the letter c to lower case, if possible. -inline int toLowerCase(int c) -{ - return tolower (c); -} - - -// Converts the letter c to upper case, if possible. -inline int toUpperCase(int c) -{ - return toupper (c); -} - -#endif \ No newline at end of file diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c b/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c deleted file mode 100644 index 8f3ec847f1..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c +++ /dev/null @@ -1,298 +0,0 @@ -/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Wiring project - http://wiring.uniandes.edu.co - - Copyright (c) 2004-05 Hernando Barragan - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - Modified 24 November 2006 by David A. Mellis - Modified 1 August 2010 by Mark Sproul -*/ - -#include -#include -#include -#include -#include - -#include "wiring_private.h" - -static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; -// volatile static voidFuncPtr twiIntFunc; - -void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { - if(interruptNum < EXTERNAL_NUM_INTERRUPTS) { - intFunc[interruptNum] = userFunc; - - // Configure the interrupt mode (trigger on low input, any change, rising - // edge, or falling edge). The mode constants were chosen to correspond - // to the configuration bits in the hardware register, so we simply shift - // the mode into place. - - // Enable the interrupt. - - switch (interruptNum) { -#if defined(__AVR_ATmega32U4__) - // I hate doing this, but the register assignment differs between the 1280/2560 - // and the 32U4. Since avrlib defines registers PCMSK1 and PCMSK2 that aren't - // even present on the 32U4 this is the only way to distinguish between them. - case 0: - EICRA = (EICRA & ~((1<= howbig) { - return howsmall; - } - long diff = howbig - howsmall; - return random(diff) + howsmall; -} - -long map(long x, long in_min, long in_max, long out_min, long out_max) -{ - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; -} - -unsigned int makeWord(unsigned int w) { return w; } -unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } \ No newline at end of file diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp deleted file mode 100644 index c6839fc0d9..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp +++ /dev/null @@ -1,645 +0,0 @@ -/* - WString.cpp - String library for Wiring & Arduino - ...mostly rewritten by Paul Stoffregen... - Copyright (c) 2009-10 Hernando Barragan. All rights reserved. - Copyright 2011, Paul Stoffregen, paul@pjrc.com - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "WString.h" - - -/*********************************************/ -/* Constructors */ -/*********************************************/ - -String::String(const char *cstr) -{ - init(); - if (cstr) copy(cstr, strlen(cstr)); -} - -String::String(const String &value) -{ - init(); - *this = value; -} - -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -String::String(String &&rval) -{ - init(); - move(rval); -} -String::String(StringSumHelper &&rval) -{ - init(); - move(rval); -} -#endif - -String::String(char c) -{ - init(); - char buf[2]; - buf[0] = c; - buf[1] = 0; - *this = buf; -} - -String::String(unsigned char value, unsigned char base) -{ - init(); - char buf[9]; - utoa(value, buf, base); - *this = buf; -} - -String::String(int value, unsigned char base) -{ - init(); - char buf[18]; - itoa(value, buf, base); - *this = buf; -} - -String::String(unsigned int value, unsigned char base) -{ - init(); - char buf[17]; - utoa(value, buf, base); - *this = buf; -} - -String::String(long value, unsigned char base) -{ - init(); - char buf[34]; - ltoa(value, buf, base); - *this = buf; -} - -String::String(unsigned long value, unsigned char base) -{ - init(); - char buf[33]; - ultoa(value, buf, base); - *this = buf; -} - -String::~String() -{ - free(buffer); -} - -/*********************************************/ -/* Memory Management */ -/*********************************************/ - -inline void String::init(void) -{ - buffer = NULL; - capacity = 0; - len = 0; - flags = 0; -} - -void String::invalidate(void) -{ - if (buffer) free(buffer); - buffer = NULL; - capacity = len = 0; -} - -unsigned char String::reserve(unsigned int size) -{ - if (buffer && capacity >= size) return 1; - if (changeBuffer(size)) { - if (len == 0) buffer[0] = 0; - return 1; - } - return 0; -} - -unsigned char String::changeBuffer(unsigned int maxStrLen) -{ - char *newbuffer = (char *)realloc(buffer, maxStrLen + 1); - if (newbuffer) { - buffer = newbuffer; - capacity = maxStrLen; - return 1; - } - return 0; -} - -/*********************************************/ -/* Copy and Move */ -/*********************************************/ - -String & String::copy(const char *cstr, unsigned int length) -{ - if (!reserve(length)) { - invalidate(); - return *this; - } - len = length; - strcpy(buffer, cstr); - return *this; -} - -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -void String::move(String &rhs) -{ - if (buffer) { - if (capacity >= rhs.len) { - strcpy(buffer, rhs.buffer); - len = rhs.len; - rhs.len = 0; - return; - } else { - free(buffer); - } - } - buffer = rhs.buffer; - capacity = rhs.capacity; - len = rhs.len; - rhs.buffer = NULL; - rhs.capacity = 0; - rhs.len = 0; -} -#endif - -String & String::operator = (const String &rhs) -{ - if (this == &rhs) return *this; - - if (rhs.buffer) copy(rhs.buffer, rhs.len); - else invalidate(); - - return *this; -} - -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -String & String::operator = (String &&rval) -{ - if (this != &rval) move(rval); - return *this; -} - -String & String::operator = (StringSumHelper &&rval) -{ - if (this != &rval) move(rval); - return *this; -} -#endif - -String & String::operator = (const char *cstr) -{ - if (cstr) copy(cstr, strlen(cstr)); - else invalidate(); - - return *this; -} - -/*********************************************/ -/* concat */ -/*********************************************/ - -unsigned char String::concat(const String &s) -{ - return concat(s.buffer, s.len); -} - -unsigned char String::concat(const char *cstr, unsigned int length) -{ - unsigned int newlen = len + length; - if (!cstr) return 0; - if (length == 0) return 1; - if (!reserve(newlen)) return 0; - strcpy(buffer + len, cstr); - len = newlen; - return 1; -} - -unsigned char String::concat(const char *cstr) -{ - if (!cstr) return 0; - return concat(cstr, strlen(cstr)); -} - -unsigned char String::concat(char c) -{ - char buf[2]; - buf[0] = c; - buf[1] = 0; - return concat(buf, 1); -} - -unsigned char String::concat(unsigned char num) -{ - char buf[4]; - itoa(num, buf, 10); - return concat(buf, strlen(buf)); -} - -unsigned char String::concat(int num) -{ - char buf[7]; - itoa(num, buf, 10); - return concat(buf, strlen(buf)); -} - -unsigned char String::concat(unsigned int num) -{ - char buf[6]; - utoa(num, buf, 10); - return concat(buf, strlen(buf)); -} - -unsigned char String::concat(long num) -{ - char buf[12]; - ltoa(num, buf, 10); - return concat(buf, strlen(buf)); -} - -unsigned char String::concat(unsigned long num) -{ - char buf[11]; - ultoa(num, buf, 10); - return concat(buf, strlen(buf)); -} - -/*********************************************/ -/* Concatenate */ -/*********************************************/ - -StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(rhs.buffer, rhs.len)) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr) -{ - StringSumHelper &a = const_cast(lhs); - if (!cstr || !a.concat(cstr, strlen(cstr))) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, char c) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(c)) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char num) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(num)) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, int num) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(num)) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(num)) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, long num) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(num)) a.invalidate(); - return a; -} - -StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num) -{ - StringSumHelper &a = const_cast(lhs); - if (!a.concat(num)) a.invalidate(); - return a; -} - -/*********************************************/ -/* Comparison */ -/*********************************************/ - -int String::compareTo(const String &s) const -{ - if (!buffer || !s.buffer) { - if (s.buffer && s.len > 0) return 0 - *(unsigned char *)s.buffer; - if (buffer && len > 0) return *(unsigned char *)buffer; - return 0; - } - return strcmp(buffer, s.buffer); -} - -unsigned char String::equals(const String &s2) const -{ - return (len == s2.len && compareTo(s2) == 0); -} - -unsigned char String::equals(const char *cstr) const -{ - if (len == 0) return (cstr == NULL || *cstr == 0); - if (cstr == NULL) return buffer[0] == 0; - return strcmp(buffer, cstr) == 0; -} - -unsigned char String::operator<(const String &rhs) const -{ - return compareTo(rhs) < 0; -} - -unsigned char String::operator>(const String &rhs) const -{ - return compareTo(rhs) > 0; -} - -unsigned char String::operator<=(const String &rhs) const -{ - return compareTo(rhs) <= 0; -} - -unsigned char String::operator>=(const String &rhs) const -{ - return compareTo(rhs) >= 0; -} - -unsigned char String::equalsIgnoreCase( const String &s2 ) const -{ - if (this == &s2) return 1; - if (len != s2.len) return 0; - if (len == 0) return 1; - const char *p1 = buffer; - const char *p2 = s2.buffer; - while (*p1) { - if (tolower(*p1++) != tolower(*p2++)) return 0; - } - return 1; -} - -unsigned char String::startsWith( const String &s2 ) const -{ - if (len < s2.len) return 0; - return startsWith(s2, 0); -} - -unsigned char String::startsWith( const String &s2, unsigned int offset ) const -{ - if (offset > len - s2.len || !buffer || !s2.buffer) return 0; - return strncmp( &buffer[offset], s2.buffer, s2.len ) == 0; -} - -unsigned char String::endsWith( const String &s2 ) const -{ - if ( len < s2.len || !buffer || !s2.buffer) return 0; - return strcmp(&buffer[len - s2.len], s2.buffer) == 0; -} - -/*********************************************/ -/* Character Access */ -/*********************************************/ - -char String::charAt(unsigned int loc) const -{ - return operator[](loc); -} - -void String::setCharAt(unsigned int loc, char c) -{ - if (loc < len) buffer[loc] = c; -} - -char & String::operator[](unsigned int index) -{ - static char dummy_writable_char; - if (index >= len || !buffer) { - dummy_writable_char = 0; - return dummy_writable_char; - } - return buffer[index]; -} - -char String::operator[]( unsigned int index ) const -{ - if (index >= len || !buffer) return 0; - return buffer[index]; -} - -void String::getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index) const -{ - if (!bufsize || !buf) return; - if (index >= len) { - buf[0] = 0; - return; - } - unsigned int n = bufsize - 1; - if (n > len - index) n = len - index; - strncpy((char *)buf, buffer + index, n); - buf[n] = 0; -} - -/*********************************************/ -/* Search */ -/*********************************************/ - -int String::indexOf(char c) const -{ - return indexOf(c, 0); -} - -int String::indexOf( char ch, unsigned int fromIndex ) const -{ - if (fromIndex >= len) return -1; - const char* temp = strchr(buffer + fromIndex, ch); - if (temp == NULL) return -1; - return temp - buffer; -} - -int String::indexOf(const String &s2) const -{ - return indexOf(s2, 0); -} - -int String::indexOf(const String &s2, unsigned int fromIndex) const -{ - if (fromIndex >= len) return -1; - const char *found = strstr(buffer + fromIndex, s2.buffer); - if (found == NULL) return -1; - return found - buffer; -} - -int String::lastIndexOf( char theChar ) const -{ - return lastIndexOf(theChar, len - 1); -} - -int String::lastIndexOf(char ch, unsigned int fromIndex) const -{ - if (fromIndex >= len) return -1; - char tempchar = buffer[fromIndex + 1]; - buffer[fromIndex + 1] = '\0'; - char* temp = strrchr( buffer, ch ); - buffer[fromIndex + 1] = tempchar; - if (temp == NULL) return -1; - return temp - buffer; -} - -int String::lastIndexOf(const String &s2) const -{ - return lastIndexOf(s2, len - s2.len); -} - -int String::lastIndexOf(const String &s2, unsigned int fromIndex) const -{ - if (s2.len == 0 || len == 0 || s2.len > len) return -1; - if (fromIndex >= len) fromIndex = len - 1; - int found = -1; - for (char *p = buffer; p <= buffer + fromIndex; p++) { - p = strstr(p, s2.buffer); - if (!p) break; - if ((unsigned int)(p - buffer) <= fromIndex) found = p - buffer; - } - return found; -} - -String String::substring( unsigned int left ) const -{ - return substring(left, len); -} - -String String::substring(unsigned int left, unsigned int right) const -{ - if (left > right) { - unsigned int temp = right; - right = left; - left = temp; - } - String out; - if (left > len) return out; - if (right > len) right = len; - char temp = buffer[right]; // save the replaced character - buffer[right] = '\0'; - out = buffer + left; // pointer arithmetic - buffer[right] = temp; //restore character - return out; -} - -/*********************************************/ -/* Modification */ -/*********************************************/ - -void String::replace(char find, char replace) -{ - if (!buffer) return; - for (char *p = buffer; *p; p++) { - if (*p == find) *p = replace; - } -} - -void String::replace(const String& find, const String& replace) -{ - if (len == 0 || find.len == 0) return; - int diff = replace.len - find.len; - char *readFrom = buffer; - char *foundAt; - if (diff == 0) { - while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { - memcpy(foundAt, replace.buffer, replace.len); - readFrom = foundAt + replace.len; - } - } else if (diff < 0) { - char *writeTo = buffer; - while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { - unsigned int n = foundAt - readFrom; - memcpy(writeTo, readFrom, n); - writeTo += n; - memcpy(writeTo, replace.buffer, replace.len); - writeTo += replace.len; - readFrom = foundAt + find.len; - len += diff; - } - strcpy(writeTo, readFrom); - } else { - unsigned int size = len; // compute size needed for result - while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { - readFrom = foundAt + find.len; - size += diff; - } - if (size == len) return; - if (size > capacity && !changeBuffer(size)) return; // XXX: tell user! - int index = len - 1; - while (index >= 0 && (index = lastIndexOf(find, index)) >= 0) { - readFrom = buffer + index + find.len; - memmove(readFrom + diff, readFrom, len - (readFrom - buffer)); - len += diff; - buffer[len] = 0; - memcpy(buffer + index, replace.buffer, replace.len); - index--; - } - } -} - -void String::toLowerCase(void) -{ - if (!buffer) return; - for (char *p = buffer; *p; p++) { - *p = tolower(*p); - } -} - -void String::toUpperCase(void) -{ - if (!buffer) return; - for (char *p = buffer; *p; p++) { - *p = toupper(*p); - } -} - -void String::trim(void) -{ - if (!buffer || len == 0) return; - char *begin = buffer; - while (isspace(*begin)) begin++; - char *end = buffer + len - 1; - while (isspace(*end) && end >= begin) end--; - len = end + 1 - begin; - if (begin > buffer) memcpy(buffer, begin, len); - buffer[len] = 0; -} - -/*********************************************/ -/* Parsing / Conversion */ -/*********************************************/ - -long String::toInt(void) const -{ - if (buffer) return atol(buffer); - return 0; -} - - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h deleted file mode 100644 index 947325e5f5..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - WString.h - String library for Wiring & Arduino - ...mostly rewritten by Paul Stoffregen... - Copyright (c) 2009-10 Hernando Barragan. All right reserved. - Copyright 2011, Paul Stoffregen, paul@pjrc.com - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef String_class_h -#define String_class_h -#ifdef __cplusplus - -#include -#include -#include -#include - -// When compiling programs with this class, the following gcc parameters -// dramatically increase performance and memory (RAM) efficiency, typically -// with little or no increase in code size. -// -felide-constructors -// -std=c++0x - -class __FlashStringHelper; -#define F(string_literal) (reinterpret_cast(PSTR(string_literal))) - -// An inherited class for holding the result of a concatenation. These -// result objects are assumed to be writable by subsequent concatenations. -class StringSumHelper; - -// The string class -class String -{ - // use a function pointer to allow for "if (s)" without the - // complications of an operator bool(). for more information, see: - // http://www.artima.com/cppsource/safebool.html - typedef void (String::*StringIfHelperType)() const; - void StringIfHelper() const {} - -public: - // constructors - // creates a copy of the initial value. - // if the initial value is null or invalid, or if memory allocation - // fails, the string will be marked as invalid (i.e. "if (s)" will - // be false). - String(const char *cstr = ""); - String(const String &str); - #ifdef __GXX_EXPERIMENTAL_CXX0X__ - String(String &&rval); - String(StringSumHelper &&rval); - #endif - explicit String(char c); - explicit String(unsigned char, unsigned char base=10); - explicit String(int, unsigned char base=10); - explicit String(unsigned int, unsigned char base=10); - explicit String(long, unsigned char base=10); - explicit String(unsigned long, unsigned char base=10); - ~String(void); - - // memory management - // return true on success, false on failure (in which case, the string - // is left unchanged). reserve(0), if successful, will validate an - // invalid string (i.e., "if (s)" will be true afterwards) - unsigned char reserve(unsigned int size); - inline unsigned int length(void) const {return len;} - - // creates a copy of the assigned value. if the value is null or - // invalid, or if the memory allocation fails, the string will be - // marked as invalid ("if (s)" will be false). - String & operator = (const String &rhs); - String & operator = (const char *cstr); - #ifdef __GXX_EXPERIMENTAL_CXX0X__ - String & operator = (String &&rval); - String & operator = (StringSumHelper &&rval); - #endif - - // concatenate (works w/ built-in types) - - // returns true on success, false on failure (in which case, the string - // is left unchanged). if the argument is null or invalid, the - // concatenation is considered unsucessful. - unsigned char concat(const String &str); - unsigned char concat(const char *cstr); - unsigned char concat(char c); - unsigned char concat(unsigned char c); - unsigned char concat(int num); - unsigned char concat(unsigned int num); - unsigned char concat(long num); - unsigned char concat(unsigned long num); - - // if there's not enough memory for the concatenated value, the string - // will be left unchanged (but this isn't signalled in any way) - String & operator += (const String &rhs) {concat(rhs); return (*this);} - String & operator += (const char *cstr) {concat(cstr); return (*this);} - String & operator += (char c) {concat(c); return (*this);} - String & operator += (unsigned char num) {concat(num); return (*this);} - String & operator += (int num) {concat(num); return (*this);} - String & operator += (unsigned int num) {concat(num); return (*this);} - String & operator += (long num) {concat(num); return (*this);} - String & operator += (unsigned long num) {concat(num); return (*this);} - - friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs); - friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr); - friend StringSumHelper & operator + (const StringSumHelper &lhs, char c); - friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char num); - friend StringSumHelper & operator + (const StringSumHelper &lhs, int num); - friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num); - friend StringSumHelper & operator + (const StringSumHelper &lhs, long num); - friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num); - - // comparison (only works w/ Strings and "strings") - operator StringIfHelperType() const { return buffer ? &String::StringIfHelper : 0; } - int compareTo(const String &s) const; - unsigned char equals(const String &s) const; - unsigned char equals(const char *cstr) const; - unsigned char operator == (const String &rhs) const {return equals(rhs);} - unsigned char operator == (const char *cstr) const {return equals(cstr);} - unsigned char operator != (const String &rhs) const {return !equals(rhs);} - unsigned char operator != (const char *cstr) const {return !equals(cstr);} - unsigned char operator < (const String &rhs) const; - unsigned char operator > (const String &rhs) const; - unsigned char operator <= (const String &rhs) const; - unsigned char operator >= (const String &rhs) const; - unsigned char equalsIgnoreCase(const String &s) const; - unsigned char startsWith( const String &prefix) const; - unsigned char startsWith(const String &prefix, unsigned int offset) const; - unsigned char endsWith(const String &suffix) const; - - // character acccess - char charAt(unsigned int index) const; - void setCharAt(unsigned int index, char c); - char operator [] (unsigned int index) const; - char& operator [] (unsigned int index); - void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const; - void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const - {getBytes((unsigned char *)buf, bufsize, index);} - - // search - int indexOf( char ch ) const; - int indexOf( char ch, unsigned int fromIndex ) const; - int indexOf( const String &str ) const; - int indexOf( const String &str, unsigned int fromIndex ) const; - int lastIndexOf( char ch ) const; - int lastIndexOf( char ch, unsigned int fromIndex ) const; - int lastIndexOf( const String &str ) const; - int lastIndexOf( const String &str, unsigned int fromIndex ) const; - String substring( unsigned int beginIndex ) const; - String substring( unsigned int beginIndex, unsigned int endIndex ) const; - - // modification - void replace(char find, char replace); - void replace(const String& find, const String& replace); - void toLowerCase(void); - void toUpperCase(void); - void trim(void); - - // parsing/conversion - long toInt(void) const; - -protected: - char *buffer; // the actual char array - unsigned int capacity; // the array length minus one (for the '\0') - unsigned int len; // the String length (not counting the '\0') - unsigned char flags; // unused, for future features -protected: - void init(void); - void invalidate(void); - unsigned char changeBuffer(unsigned int maxStrLen); - unsigned char concat(const char *cstr, unsigned int length); - - // copy and move - String & copy(const char *cstr, unsigned int length); - #ifdef __GXX_EXPERIMENTAL_CXX0X__ - void move(String &rhs); - #endif -}; - -class StringSumHelper : public String -{ -public: - StringSumHelper(const String &s) : String(s) {} - StringSumHelper(const char *p) : String(p) {} - StringSumHelper(char c) : String(c) {} - StringSumHelper(unsigned char num) : String(num) {} - StringSumHelper(int num) : String(num) {} - StringSumHelper(unsigned int num) : String(num) {} - StringSumHelper(long num) : String(num) {} - StringSumHelper(unsigned long num) : String(num) {} -}; - -#endif // __cplusplus -#endif // String_class_h diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h deleted file mode 100644 index af1498033a..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h +++ /dev/null @@ -1,515 +0,0 @@ -#ifndef Binary_h -#define Binary_h - -#define B0 0 -#define B00 0 -#define B000 0 -#define B0000 0 -#define B00000 0 -#define B000000 0 -#define B0000000 0 -#define B00000000 0 -#define B1 1 -#define B01 1 -#define B001 1 -#define B0001 1 -#define B00001 1 -#define B000001 1 -#define B0000001 1 -#define B00000001 1 -#define B10 2 -#define B010 2 -#define B0010 2 -#define B00010 2 -#define B000010 2 -#define B0000010 2 -#define B00000010 2 -#define B11 3 -#define B011 3 -#define B0011 3 -#define B00011 3 -#define B000011 3 -#define B0000011 3 -#define B00000011 3 -#define B100 4 -#define B0100 4 -#define B00100 4 -#define B000100 4 -#define B0000100 4 -#define B00000100 4 -#define B101 5 -#define B0101 5 -#define B00101 5 -#define B000101 5 -#define B0000101 5 -#define B00000101 5 -#define B110 6 -#define B0110 6 -#define B00110 6 -#define B000110 6 -#define B0000110 6 -#define B00000110 6 -#define B111 7 -#define B0111 7 -#define B00111 7 -#define B000111 7 -#define B0000111 7 -#define B00000111 7 -#define B1000 8 -#define B01000 8 -#define B001000 8 -#define B0001000 8 -#define B00001000 8 -#define B1001 9 -#define B01001 9 -#define B001001 9 -#define B0001001 9 -#define B00001001 9 -#define B1010 10 -#define B01010 10 -#define B001010 10 -#define B0001010 10 -#define B00001010 10 -#define B1011 11 -#define B01011 11 -#define B001011 11 -#define B0001011 11 -#define B00001011 11 -#define B1100 12 -#define B01100 12 -#define B001100 12 -#define B0001100 12 -#define B00001100 12 -#define B1101 13 -#define B01101 13 -#define B001101 13 -#define B0001101 13 -#define B00001101 13 -#define B1110 14 -#define B01110 14 -#define B001110 14 -#define B0001110 14 -#define B00001110 14 -#define B1111 15 -#define B01111 15 -#define B001111 15 -#define B0001111 15 -#define B00001111 15 -#define B10000 16 -#define B010000 16 -#define B0010000 16 -#define B00010000 16 -#define B10001 17 -#define B010001 17 -#define B0010001 17 -#define B00010001 17 -#define B10010 18 -#define B010010 18 -#define B0010010 18 -#define B00010010 18 -#define B10011 19 -#define B010011 19 -#define B0010011 19 -#define B00010011 19 -#define B10100 20 -#define B010100 20 -#define B0010100 20 -#define B00010100 20 -#define B10101 21 -#define B010101 21 -#define B0010101 21 -#define B00010101 21 -#define B10110 22 -#define B010110 22 -#define B0010110 22 -#define B00010110 22 -#define B10111 23 -#define B010111 23 -#define B0010111 23 -#define B00010111 23 -#define B11000 24 -#define B011000 24 -#define B0011000 24 -#define B00011000 24 -#define B11001 25 -#define B011001 25 -#define B0011001 25 -#define B00011001 25 -#define B11010 26 -#define B011010 26 -#define B0011010 26 -#define B00011010 26 -#define B11011 27 -#define B011011 27 -#define B0011011 27 -#define B00011011 27 -#define B11100 28 -#define B011100 28 -#define B0011100 28 -#define B00011100 28 -#define B11101 29 -#define B011101 29 -#define B0011101 29 -#define B00011101 29 -#define B11110 30 -#define B011110 30 -#define B0011110 30 -#define B00011110 30 -#define B11111 31 -#define B011111 31 -#define B0011111 31 -#define B00011111 31 -#define B100000 32 -#define B0100000 32 -#define B00100000 32 -#define B100001 33 -#define B0100001 33 -#define B00100001 33 -#define B100010 34 -#define B0100010 34 -#define B00100010 34 -#define B100011 35 -#define B0100011 35 -#define B00100011 35 -#define B100100 36 -#define B0100100 36 -#define B00100100 36 -#define B100101 37 -#define B0100101 37 -#define B00100101 37 -#define B100110 38 -#define B0100110 38 -#define B00100110 38 -#define B100111 39 -#define B0100111 39 -#define B00100111 39 -#define B101000 40 -#define B0101000 40 -#define B00101000 40 -#define B101001 41 -#define B0101001 41 -#define B00101001 41 -#define B101010 42 -#define B0101010 42 -#define B00101010 42 -#define B101011 43 -#define B0101011 43 -#define B00101011 43 -#define B101100 44 -#define B0101100 44 -#define B00101100 44 -#define B101101 45 -#define B0101101 45 -#define B00101101 45 -#define B101110 46 -#define B0101110 46 -#define B00101110 46 -#define B101111 47 -#define B0101111 47 -#define B00101111 47 -#define B110000 48 -#define B0110000 48 -#define B00110000 48 -#define B110001 49 -#define B0110001 49 -#define B00110001 49 -#define B110010 50 -#define B0110010 50 -#define B00110010 50 -#define B110011 51 -#define B0110011 51 -#define B00110011 51 -#define B110100 52 -#define B0110100 52 -#define B00110100 52 -#define B110101 53 -#define B0110101 53 -#define B00110101 53 -#define B110110 54 -#define B0110110 54 -#define B00110110 54 -#define B110111 55 -#define B0110111 55 -#define B00110111 55 -#define B111000 56 -#define B0111000 56 -#define B00111000 56 -#define B111001 57 -#define B0111001 57 -#define B00111001 57 -#define B111010 58 -#define B0111010 58 -#define B00111010 58 -#define B111011 59 -#define B0111011 59 -#define B00111011 59 -#define B111100 60 -#define B0111100 60 -#define B00111100 60 -#define B111101 61 -#define B0111101 61 -#define B00111101 61 -#define B111110 62 -#define B0111110 62 -#define B00111110 62 -#define B111111 63 -#define B0111111 63 -#define B00111111 63 -#define B1000000 64 -#define B01000000 64 -#define B1000001 65 -#define B01000001 65 -#define B1000010 66 -#define B01000010 66 -#define B1000011 67 -#define B01000011 67 -#define B1000100 68 -#define B01000100 68 -#define B1000101 69 -#define B01000101 69 -#define B1000110 70 -#define B01000110 70 -#define B1000111 71 -#define B01000111 71 -#define B1001000 72 -#define B01001000 72 -#define B1001001 73 -#define B01001001 73 -#define B1001010 74 -#define B01001010 74 -#define B1001011 75 -#define B01001011 75 -#define B1001100 76 -#define B01001100 76 -#define B1001101 77 -#define B01001101 77 -#define B1001110 78 -#define B01001110 78 -#define B1001111 79 -#define B01001111 79 -#define B1010000 80 -#define B01010000 80 -#define B1010001 81 -#define B01010001 81 -#define B1010010 82 -#define B01010010 82 -#define B1010011 83 -#define B01010011 83 -#define B1010100 84 -#define B01010100 84 -#define B1010101 85 -#define B01010101 85 -#define B1010110 86 -#define B01010110 86 -#define B1010111 87 -#define B01010111 87 -#define B1011000 88 -#define B01011000 88 -#define B1011001 89 -#define B01011001 89 -#define B1011010 90 -#define B01011010 90 -#define B1011011 91 -#define B01011011 91 -#define B1011100 92 -#define B01011100 92 -#define B1011101 93 -#define B01011101 93 -#define B1011110 94 -#define B01011110 94 -#define B1011111 95 -#define B01011111 95 -#define B1100000 96 -#define B01100000 96 -#define B1100001 97 -#define B01100001 97 -#define B1100010 98 -#define B01100010 98 -#define B1100011 99 -#define B01100011 99 -#define B1100100 100 -#define B01100100 100 -#define B1100101 101 -#define B01100101 101 -#define B1100110 102 -#define B01100110 102 -#define B1100111 103 -#define B01100111 103 -#define B1101000 104 -#define B01101000 104 -#define B1101001 105 -#define B01101001 105 -#define B1101010 106 -#define B01101010 106 -#define B1101011 107 -#define B01101011 107 -#define B1101100 108 -#define B01101100 108 -#define B1101101 109 -#define B01101101 109 -#define B1101110 110 -#define B01101110 110 -#define B1101111 111 -#define B01101111 111 -#define B1110000 112 -#define B01110000 112 -#define B1110001 113 -#define B01110001 113 -#define B1110010 114 -#define B01110010 114 -#define B1110011 115 -#define B01110011 115 -#define B1110100 116 -#define B01110100 116 -#define B1110101 117 -#define B01110101 117 -#define B1110110 118 -#define B01110110 118 -#define B1110111 119 -#define B01110111 119 -#define B1111000 120 -#define B01111000 120 -#define B1111001 121 -#define B01111001 121 -#define B1111010 122 -#define B01111010 122 -#define B1111011 123 -#define B01111011 123 -#define B1111100 124 -#define B01111100 124 -#define B1111101 125 -#define B01111101 125 -#define B1111110 126 -#define B01111110 126 -#define B1111111 127 -#define B01111111 127 -#define B10000000 128 -#define B10000001 129 -#define B10000010 130 -#define B10000011 131 -#define B10000100 132 -#define B10000101 133 -#define B10000110 134 -#define B10000111 135 -#define B10001000 136 -#define B10001001 137 -#define B10001010 138 -#define B10001011 139 -#define B10001100 140 -#define B10001101 141 -#define B10001110 142 -#define B10001111 143 -#define B10010000 144 -#define B10010001 145 -#define B10010010 146 -#define B10010011 147 -#define B10010100 148 -#define B10010101 149 -#define B10010110 150 -#define B10010111 151 -#define B10011000 152 -#define B10011001 153 -#define B10011010 154 -#define B10011011 155 -#define B10011100 156 -#define B10011101 157 -#define B10011110 158 -#define B10011111 159 -#define B10100000 160 -#define B10100001 161 -#define B10100010 162 -#define B10100011 163 -#define B10100100 164 -#define B10100101 165 -#define B10100110 166 -#define B10100111 167 -#define B10101000 168 -#define B10101001 169 -#define B10101010 170 -#define B10101011 171 -#define B10101100 172 -#define B10101101 173 -#define B10101110 174 -#define B10101111 175 -#define B10110000 176 -#define B10110001 177 -#define B10110010 178 -#define B10110011 179 -#define B10110100 180 -#define B10110101 181 -#define B10110110 182 -#define B10110111 183 -#define B10111000 184 -#define B10111001 185 -#define B10111010 186 -#define B10111011 187 -#define B10111100 188 -#define B10111101 189 -#define B10111110 190 -#define B10111111 191 -#define B11000000 192 -#define B11000001 193 -#define B11000010 194 -#define B11000011 195 -#define B11000100 196 -#define B11000101 197 -#define B11000110 198 -#define B11000111 199 -#define B11001000 200 -#define B11001001 201 -#define B11001010 202 -#define B11001011 203 -#define B11001100 204 -#define B11001101 205 -#define B11001110 206 -#define B11001111 207 -#define B11010000 208 -#define B11010001 209 -#define B11010010 210 -#define B11010011 211 -#define B11010100 212 -#define B11010101 213 -#define B11010110 214 -#define B11010111 215 -#define B11011000 216 -#define B11011001 217 -#define B11011010 218 -#define B11011011 219 -#define B11011100 220 -#define B11011101 221 -#define B11011110 222 -#define B11011111 223 -#define B11100000 224 -#define B11100001 225 -#define B11100010 226 -#define B11100011 227 -#define B11100100 228 -#define B11100101 229 -#define B11100110 230 -#define B11100111 231 -#define B11101000 232 -#define B11101001 233 -#define B11101010 234 -#define B11101011 235 -#define B11101100 236 -#define B11101101 237 -#define B11101110 238 -#define B11101111 239 -#define B11110000 240 -#define B11110001 241 -#define B11110010 242 -#define B11110011 243 -#define B11110100 244 -#define B11110101 245 -#define B11110110 246 -#define B11110111 247 -#define B11111000 248 -#define B11111001 249 -#define B11111010 250 -#define B11111011 251 -#define B11111100 252 -#define B11111101 253 -#define B11111110 254 -#define B11111111 255 - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp deleted file mode 100644 index 3d4e079d2a..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int main(void) -{ - init(); - -#if defined(USBCON) - USBDevice.attach(); -#endif - - setup(); - - for (;;) { - loop(); - if (serialEventRun) serialEventRun(); - } - - return 0; -} - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp b/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp deleted file mode 100644 index 0f6d4220ef..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -void * operator new(size_t size) -{ - return malloc(size); -} - -void operator delete(void * ptr) -{ - free(ptr); -} - -int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}; -void __cxa_guard_release (__guard *g) {*(char *)g = 1;}; -void __cxa_guard_abort (__guard *) {}; - -void __cxa_pure_virtual(void) {}; - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h deleted file mode 100644 index cd940ce8b2..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Header to define new/delete operators as they aren't provided by avr-gcc by default - Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 - */ - -#ifndef NEW_H -#define NEW_H - -#include - -void * operator new(size_t size); -void operator delete(void * ptr); - -__extension__ typedef int __guard __attribute__((mode (__DI__))); - -extern "C" int __cxa_guard_acquire(__guard *); -extern "C" void __cxa_guard_release (__guard *); -extern "C" void __cxa_guard_abort (__guard *); - -extern "C" void __cxa_pure_virtual(void); - -#endif - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c b/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c deleted file mode 100644 index ac8bb6f9b4..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - wiring.c - Partial implementation of the Wiring API for the ATmega8. - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id$ -*/ - -#include "wiring_private.h" - -// the prescaler is set so that timer0 ticks every 64 clock cycles, and the -// the overflow handler is called every 256 ticks. -#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(64 * 256)) - -// the whole number of milliseconds per timer0 overflow -#define MILLIS_INC (MICROSECONDS_PER_TIMER0_OVERFLOW / 1000) - -// the fractional number of milliseconds per timer0 overflow. we shift right -// by three to fit these numbers into a byte. (for the clock speeds we care -// about - 8 and 16 MHz - this doesn't lose precision.) -#define FRACT_INC ((MICROSECONDS_PER_TIMER0_OVERFLOW % 1000) >> 3) -#define FRACT_MAX (1000 >> 3) - -volatile unsigned long timer0_overflow_count = 0; -volatile unsigned long timer0_millis = 0; -static unsigned char timer0_fract = 0; - -#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) -SIGNAL(TIM0_OVF_vect) -#else -SIGNAL(TIMER0_OVF_vect) -#endif -{ - // copy these to local variables so they can be stored in registers - // (volatile variables must be read from memory on every access) - unsigned long m = timer0_millis; - unsigned char f = timer0_fract; - - m += MILLIS_INC; - f += FRACT_INC; - if (f >= FRACT_MAX) { - f -= FRACT_MAX; - m += 1; - } - - timer0_fract = f; - timer0_millis = m; - timer0_overflow_count++; -} - -unsigned long millis() -{ - unsigned long m; - uint8_t oldSREG = SREG; - - // disable interrupts while we read timer0_millis or we might get an - // inconsistent value (e.g. in the middle of a write to timer0_millis) - cli(); - m = timer0_millis; - SREG = oldSREG; - - return m; -} - -unsigned long micros() { - unsigned long m; - uint8_t oldSREG = SREG, t; - - cli(); - m = timer0_overflow_count; -#if defined(TCNT0) - t = TCNT0; -#elif defined(TCNT0L) - t = TCNT0L; -#else - #error TIMER 0 not defined -#endif - - -#ifdef TIFR0 - if ((TIFR0 & _BV(TOV0)) && (t < 255)) - m++; -#else - if ((TIFR & _BV(TOV0)) && (t < 255)) - m++; -#endif - - SREG = oldSREG; - - return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond()); -} - -void delay(unsigned long ms) -{ - uint16_t start = (uint16_t)micros(); - - while (ms > 0) { - if (((uint16_t)micros() - start) >= 1000) { - ms--; - start += 1000; - } - } -} - -/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock. */ -void delayMicroseconds(unsigned int us) -{ - // calling avrlib's delay_us() function with low values (e.g. 1 or - // 2 microseconds) gives delays longer than desired. - //delay_us(us); -#if F_CPU >= 20000000L - // for the 20 MHz clock on rare Arduino boards - - // for a one-microsecond delay, simply wait 2 cycle and return. The overhead - // of the function call yields a delay of exactly a one microsecond. - __asm__ __volatile__ ( - "nop" "\n\t" - "nop"); //just waiting 2 cycle - if (--us == 0) - return; - - // the following loop takes a 1/5 of a microsecond (4 cycles) - // per iteration, so execute it five times for each microsecond of - // delay requested. - us = (us<<2) + us; // x5 us - - // account for the time taken in the preceeding commands. - us -= 2; - -#elif F_CPU >= 16000000L - // for the 16 MHz clock on most Arduino boards - - // for a one-microsecond delay, simply return. the overhead - // of the function call yields a delay of approximately 1 1/8 us. - if (--us == 0) - return; - - // the following loop takes a quarter of a microsecond (4 cycles) - // per iteration, so execute it four times for each microsecond of - // delay requested. - us <<= 2; - - // account for the time taken in the preceeding commands. - us -= 2; -#else - // for the 8 MHz internal clock on the ATmega168 - - // for a one- or two-microsecond delay, simply return. the overhead of - // the function calls takes more than two microseconds. can't just - // subtract two, since us is unsigned; we'd overflow. - if (--us == 0) - return; - if (--us == 0) - return; - - // the following loop takes half of a microsecond (4 cycles) - // per iteration, so execute it twice for each microsecond of - // delay requested. - us <<= 1; - - // partially compensate for the time taken by the preceeding commands. - // we can't subtract any more than this or we'd overflow w/ small delays. - us--; -#endif - - // busy wait - __asm__ __volatile__ ( - "1: sbiw %0,1" "\n\t" // 2 cycles - "brne 1b" : "=w" (us) : "0" (us) // 2 cycles - ); -} - -void init() -{ - // this needs to be called before setup() or some functions won't - // work there - sei(); - - // on the ATmega168, timer 0 is also used for fast hardware pwm - // (using phase-correct PWM would mean that timer 0 overflowed half as often - // resulting in different millis() behavior on the ATmega8 and ATmega168) -#if defined(TCCR0A) && defined(WGM01) - sbi(TCCR0A, WGM01); - sbi(TCCR0A, WGM00); -#endif - - // set timer 0 prescale factor to 64 -#if defined(__AVR_ATmega128__) - // CPU specific: different values for the ATmega128 - sbi(TCCR0, CS02); -#elif defined(TCCR0) && defined(CS01) && defined(CS00) - // this combination is for the standard atmega8 - sbi(TCCR0, CS01); - sbi(TCCR0, CS00); -#elif defined(TCCR0B) && defined(CS01) && defined(CS00) - // this combination is for the standard 168/328/1280/2560 - sbi(TCCR0B, CS01); - sbi(TCCR0B, CS00); -#elif defined(TCCR0A) && defined(CS01) && defined(CS00) - // this combination is for the __AVR_ATmega645__ series - sbi(TCCR0A, CS01); - sbi(TCCR0A, CS00); -#else - #error Timer 0 prescale factor 64 not set correctly -#endif - - // enable timer 0 overflow interrupt -#if defined(TIMSK) && defined(TOIE0) - sbi(TIMSK, TOIE0); -#elif defined(TIMSK0) && defined(TOIE0) - sbi(TIMSK0, TOIE0); -#else - #error Timer 0 overflow interrupt not set correctly -#endif - - // timers 1 and 2 are used for phase-correct hardware pwm - // this is better for motors as it ensures an even waveform - // note, however, that fast pwm mode can achieve a frequency of up - // 8 MHz (with a 16 MHz clock) at 50% duty cycle - -#if defined(TCCR1B) && defined(CS11) && defined(CS10) - TCCR1B = 0; - - // set timer 1 prescale factor to 64 - sbi(TCCR1B, CS11); -#if F_CPU >= 8000000L - sbi(TCCR1B, CS10); -#endif -#elif defined(TCCR1) && defined(CS11) && defined(CS10) - sbi(TCCR1, CS11); -#if F_CPU >= 8000000L - sbi(TCCR1, CS10); -#endif -#endif - // put timer 1 in 8-bit phase correct pwm mode -#if defined(TCCR1A) && defined(WGM10) - sbi(TCCR1A, WGM10); -#elif defined(TCCR1) - #warning this needs to be finished -#endif - - // set timer 2 prescale factor to 64 -#if defined(TCCR2) && defined(CS22) - sbi(TCCR2, CS22); -#elif defined(TCCR2B) && defined(CS22) - sbi(TCCR2B, CS22); -#else - #warning Timer 2 not finished (may not be present on this CPU) -#endif - - // configure timer 2 for phase correct pwm (8-bit) -#if defined(TCCR2) && defined(WGM20) - sbi(TCCR2, WGM20); -#elif defined(TCCR2A) && defined(WGM20) - sbi(TCCR2A, WGM20); -#else - #warning Timer 2 not finished (may not be present on this CPU) -#endif - -#if defined(TCCR3B) && defined(CS31) && defined(WGM30) - sbi(TCCR3B, CS31); // set timer 3 prescale factor to 64 - sbi(TCCR3B, CS30); - sbi(TCCR3A, WGM30); // put timer 3 in 8-bit phase correct pwm mode -#endif - -#if defined(TCCR4A) && defined(TCCR4B) && defined(TCCR4D) /* beginning of timer4 block for 32U4 and similar */ - sbi(TCCR4B, CS42); // set timer4 prescale factor to 64 - sbi(TCCR4B, CS41); - sbi(TCCR4B, CS40); - sbi(TCCR4D, WGM40); // put timer 4 in phase- and frequency-correct PWM mode - sbi(TCCR4A, PWM4A); // enable PWM mode for comparator OCR4A - sbi(TCCR4C, PWM4D); // enable PWM mode for comparator OCR4D -#else /* beginning of timer4 block for ATMEGA1280 and ATMEGA2560 */ -#if defined(TCCR4B) && defined(CS41) && defined(WGM40) - sbi(TCCR4B, CS41); // set timer 4 prescale factor to 64 - sbi(TCCR4B, CS40); - sbi(TCCR4A, WGM40); // put timer 4 in 8-bit phase correct pwm mode -#endif -#endif /* end timer4 block for ATMEGA1280/2560 and similar */ - -#if defined(TCCR5B) && defined(CS51) && defined(WGM50) - sbi(TCCR5B, CS51); // set timer 5 prescale factor to 64 - sbi(TCCR5B, CS50); - sbi(TCCR5A, WGM50); // put timer 5 in 8-bit phase correct pwm mode -#endif - -#if defined(ADCSRA) - // set a2d prescale factor to 128 - // 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range. - // XXX: this will not work properly for other clock speeds, and - // this code should use F_CPU to determine the prescale factor. - sbi(ADCSRA, ADPS2); - sbi(ADCSRA, ADPS1); - sbi(ADCSRA, ADPS0); - - // enable a2d conversions - sbi(ADCSRA, ADEN); -#endif - - // the bootloader connects pins 0 and 1 to the USART; disconnect them - // here so they can be used as normal digital i/o; they will be - // reconnected in Serial.begin() -#if defined(UCSRB) - UCSRB = 0; -#elif defined(UCSR0B) - UCSR0B = 0; -#endif -} diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c b/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c deleted file mode 100644 index 0e9881f6ac..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - wiring_analog.c - analog input and output - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - Modified 28 September 2010 by Mark Sproul - - $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ -*/ - -#include "wiring_private.h" -#include "pins_arduino.h" - -uint8_t analog_reference = DEFAULT; - -void analogReference(uint8_t mode) -{ - // can't actually set the register here because the default setting - // will connect AVCC and the AREF pin, which would cause a short if - // there's something connected to AREF. - analog_reference = mode; -} - -int analogRead(uint8_t pin) -{ - uint8_t low, high; - -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) - if (pin >= 54) pin -= 54; // allow for channel or pin numbers -#elif defined(__AVR_ATmega32U4__) - if (pin >= 18) pin -= 18; // allow for channel or pin numbers -#elif defined(__AVR_ATmega1284__) - if (pin >= 24) pin -= 24; // allow for channel or pin numbers -#else - if (pin >= 14) pin -= 14; // allow for channel or pin numbers -#endif - -#if defined(__AVR_ATmega32U4__) - pin = analogPinToChannel(pin); - ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5); -#elif defined(ADCSRB) && defined(MUX5) - // the MUX5 bit of ADCSRB selects whether we're reading from channels - // 0 to 7 (MUX5 low) or 8 to 15 (MUX5 high). - ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5); -#endif - - // set the analog reference (high two bits of ADMUX) and select the - // channel (low 4 bits). this also sets ADLAR (left-adjust result) - // to 0 (the default). -#if defined(ADMUX) - ADMUX = (analog_reference << 6) | (pin & 0x07); -#endif - - // without a delay, we seem to read from the wrong channel - //delay(1); - -#if defined(ADCSRA) && defined(ADCL) - // start the conversion - sbi(ADCSRA, ADSC); - - // ADSC is cleared when the conversion finishes - while (bit_is_set(ADCSRA, ADSC)); - - // we have to read ADCL first; doing so locks both ADCL - // and ADCH until ADCH is read. reading ADCL second would - // cause the results of each conversion to be discarded, - // as ADCL and ADCH would be locked when it completed. - low = ADCL; - high = ADCH; -#else - // we dont have an ADC, return 0 - low = 0; - high = 0; -#endif - - // combine the two bytes - return (high << 8) | low; -} - -// Right now, PWM output only works on the pins with -// hardware support. These are defined in the appropriate -// pins_*.c file. For the rest of the pins, we default -// to digital output. -void analogWrite(uint8_t pin, int val) -{ - // We need to make sure the PWM output is enabled for those pins - // that support it, as we turn it off when digitally reading or - // writing with them. Also, make sure the pin is in output mode - // for consistenty with Wiring, which doesn't require a pinMode - // call for the analog output pins. - pinMode(pin, OUTPUT); - if (val == 0) - { - digitalWrite(pin, LOW); - } - else if (val == 255) - { - digitalWrite(pin, HIGH); - } - else - { - switch(digitalPinToTimer(pin)) - { - // XXX fix needed for atmega8 - #if defined(TCCR0) && defined(COM00) && !defined(__AVR_ATmega8__) - case TIMER0A: - // connect pwm to pin on timer 0 - sbi(TCCR0, COM00); - OCR0 = val; // set pwm duty - break; - #endif - - #if defined(TCCR0A) && defined(COM0A1) - case TIMER0A: - // connect pwm to pin on timer 0, channel A - sbi(TCCR0A, COM0A1); - OCR0A = val; // set pwm duty - break; - #endif - - #if defined(TCCR0A) && defined(COM0B1) - case TIMER0B: - // connect pwm to pin on timer 0, channel B - sbi(TCCR0A, COM0B1); - OCR0B = val; // set pwm duty - break; - #endif - - #if defined(TCCR1A) && defined(COM1A1) - case TIMER1A: - // connect pwm to pin on timer 1, channel A - sbi(TCCR1A, COM1A1); - OCR1A = val; // set pwm duty - break; - #endif - - #if defined(TCCR1A) && defined(COM1B1) - case TIMER1B: - // connect pwm to pin on timer 1, channel B - sbi(TCCR1A, COM1B1); - OCR1B = val; // set pwm duty - break; - #endif - - #if defined(TCCR2) && defined(COM21) - case TIMER2: - // connect pwm to pin on timer 2 - sbi(TCCR2, COM21); - OCR2 = val; // set pwm duty - break; - #endif - - #if defined(TCCR2A) && defined(COM2A1) - case TIMER2A: - // connect pwm to pin on timer 2, channel A - sbi(TCCR2A, COM2A1); - OCR2A = val; // set pwm duty - break; - #endif - - #if defined(TCCR2A) && defined(COM2B1) - case TIMER2B: - // connect pwm to pin on timer 2, channel B - sbi(TCCR2A, COM2B1); - OCR2B = val; // set pwm duty - break; - #endif - - #if defined(TCCR3A) && defined(COM3A1) - case TIMER3A: - // connect pwm to pin on timer 3, channel A - sbi(TCCR3A, COM3A1); - OCR3A = val; // set pwm duty - break; - #endif - - #if defined(TCCR3A) && defined(COM3B1) - case TIMER3B: - // connect pwm to pin on timer 3, channel B - sbi(TCCR3A, COM3B1); - OCR3B = val; // set pwm duty - break; - #endif - - #if defined(TCCR3A) && defined(COM3C1) - case TIMER3C: - // connect pwm to pin on timer 3, channel C - sbi(TCCR3A, COM3C1); - OCR3C = val; // set pwm duty - break; - #endif - - #if defined(TCCR4A) - case TIMER4A: - //connect pwm to pin on timer 4, channel A - sbi(TCCR4A, COM4A1); - #if defined(COM4A0) // only used on 32U4 - cbi(TCCR4A, COM4A0); - #endif - OCR4A = val; // set pwm duty - break; - #endif - - #if defined(TCCR4A) && defined(COM4B1) - case TIMER4B: - // connect pwm to pin on timer 4, channel B - sbi(TCCR4A, COM4B1); - OCR4B = val; // set pwm duty - break; - #endif - - #if defined(TCCR4A) && defined(COM4C1) - case TIMER4C: - // connect pwm to pin on timer 4, channel C - sbi(TCCR4A, COM4C1); - OCR4C = val; // set pwm duty - break; - #endif - - #if defined(TCCR4C) && defined(COM4D1) - case TIMER4D: - // connect pwm to pin on timer 4, channel D - sbi(TCCR4C, COM4D1); - #if defined(COM4D0) // only used on 32U4 - cbi(TCCR4C, COM4D0); - #endif - OCR4D = val; // set pwm duty - break; - #endif - - - #if defined(TCCR5A) && defined(COM5A1) - case TIMER5A: - // connect pwm to pin on timer 5, channel A - sbi(TCCR5A, COM5A1); - OCR5A = val; // set pwm duty - break; - #endif - - #if defined(TCCR5A) && defined(COM5B1) - case TIMER5B: - // connect pwm to pin on timer 5, channel B - sbi(TCCR5A, COM5B1); - OCR5B = val; // set pwm duty - break; - #endif - - #if defined(TCCR5A) && defined(COM5C1) - case TIMER5C: - // connect pwm to pin on timer 5, channel C - sbi(TCCR5A, COM5C1); - OCR5C = val; // set pwm duty - break; - #endif - - case NOT_ON_TIMER: - default: - if (val < 128) { - digitalWrite(pin, LOW); - } else { - digitalWrite(pin, HIGH); - } - } - } -} - diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c b/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c deleted file mode 100644 index be323b1dfe..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - wiring_digital.c - digital input and output functions - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - Modified 28 September 2010 by Mark Sproul - - $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ -*/ - -#define ARDUINO_MAIN -#include "wiring_private.h" -#include "pins_arduino.h" - -void pinMode(uint8_t pin, uint8_t mode) -{ - uint8_t bit = digitalPinToBitMask(pin); - uint8_t port = digitalPinToPort(pin); - volatile uint8_t *reg, *out; - - if (port == NOT_A_PIN) return; - - // JWS: can I let the optimizer do this? - reg = portModeRegister(port); - out = portOutputRegister(port); - - if (mode == INPUT) { - uint8_t oldSREG = SREG; - cli(); - *reg &= ~bit; - *out &= ~bit; - SREG = oldSREG; - } else if (mode == INPUT_PULLUP) { - uint8_t oldSREG = SREG; - cli(); - *reg &= ~bit; - *out |= bit; - SREG = oldSREG; - } else { - uint8_t oldSREG = SREG; - cli(); - *reg |= bit; - SREG = oldSREG; - } -} - -// Forcing this inline keeps the callers from having to push their own stuff -// on the stack. It is a good performance win and only takes 1 more byte per -// user than calling. (It will take more bytes on the 168.) -// -// But shouldn't this be moved into pinMode? Seems silly to check and do on -// each digitalread or write. -// -// Mark Sproul: -// - Removed inline. Save 170 bytes on atmega1280 -// - changed to a switch statment; added 32 bytes but much easier to read and maintain. -// - Added more #ifdefs, now compiles for atmega645 -// -//static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline)); -//static inline void turnOffPWM(uint8_t timer) -static void turnOffPWM(uint8_t timer) -{ - switch (timer) - { - #if defined(TCCR1A) && defined(COM1A1) - case TIMER1A: cbi(TCCR1A, COM1A1); break; - #endif - #if defined(TCCR1A) && defined(COM1B1) - case TIMER1B: cbi(TCCR1A, COM1B1); break; - #endif - - #if defined(TCCR2) && defined(COM21) - case TIMER2: cbi(TCCR2, COM21); break; - #endif - - #if defined(TCCR0A) && defined(COM0A1) - case TIMER0A: cbi(TCCR0A, COM0A1); break; - #endif - - #if defined(TIMER0B) && defined(COM0B1) - case TIMER0B: cbi(TCCR0A, COM0B1); break; - #endif - #if defined(TCCR2A) && defined(COM2A1) - case TIMER2A: cbi(TCCR2A, COM2A1); break; - #endif - #if defined(TCCR2A) && defined(COM2B1) - case TIMER2B: cbi(TCCR2A, COM2B1); break; - #endif - - #if defined(TCCR3A) && defined(COM3A1) - case TIMER3A: cbi(TCCR3A, COM3A1); break; - #endif - #if defined(TCCR3A) && defined(COM3B1) - case TIMER3B: cbi(TCCR3A, COM3B1); break; - #endif - #if defined(TCCR3A) && defined(COM3C1) - case TIMER3C: cbi(TCCR3A, COM3C1); break; - #endif - - #if defined(TCCR4A) && defined(COM4A1) - case TIMER4A: cbi(TCCR4A, COM4A1); break; - #endif - #if defined(TCCR4A) && defined(COM4B1) - case TIMER4B: cbi(TCCR4A, COM4B1); break; - #endif - #if defined(TCCR4A) && defined(COM4C1) - case TIMER4C: cbi(TCCR4A, COM4C1); break; - #endif - #if defined(TCCR4C) && defined(COM4D1) - case TIMER4D: cbi(TCCR4C, COM4D1); break; - #endif - - #if defined(TCCR5A) - case TIMER5A: cbi(TCCR5A, COM5A1); break; - case TIMER5B: cbi(TCCR5A, COM5B1); break; - case TIMER5C: cbi(TCCR5A, COM5C1); break; - #endif - } -} - -void digitalWrite(uint8_t pin, uint8_t val) -{ - uint8_t timer = digitalPinToTimer(pin); - uint8_t bit = digitalPinToBitMask(pin); - uint8_t port = digitalPinToPort(pin); - volatile uint8_t *out; - - if (port == NOT_A_PIN) return; - - // If the pin that support PWM output, we need to turn it off - // before doing a digital write. - if (timer != NOT_ON_TIMER) turnOffPWM(timer); - - out = portOutputRegister(port); - - uint8_t oldSREG = SREG; - cli(); - - if (val == LOW) { - *out &= ~bit; - } else { - *out |= bit; - } - - SREG = oldSREG; -} - -int digitalRead(uint8_t pin) -{ - uint8_t timer = digitalPinToTimer(pin); - uint8_t bit = digitalPinToBitMask(pin); - uint8_t port = digitalPinToPort(pin); - - if (port == NOT_A_PIN) return LOW; - - // If the pin that support PWM output, we need to turn it off - // before getting a digital reading. - if (timer != NOT_ON_TIMER) turnOffPWM(timer); - - if (*portInputRegister(port) & bit) return HIGH; - return LOW; -} diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h b/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h deleted file mode 100644 index f0ceb0cc4d..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - wiring_private.h - Internal header file. - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ -*/ - -#ifndef WiringPrivate_h -#define WiringPrivate_h - -#include -#include -#include -#include - -#include "Arduino.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#ifndef cbi -#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) -#endif -#ifndef sbi -#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) -#endif - -#define EXTERNAL_INT_0 0 -#define EXTERNAL_INT_1 1 -#define EXTERNAL_INT_2 2 -#define EXTERNAL_INT_3 3 -#define EXTERNAL_INT_4 4 -#define EXTERNAL_INT_5 5 -#define EXTERNAL_INT_6 6 -#define EXTERNAL_INT_7 7 - -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -#define EXTERNAL_NUM_INTERRUPTS 8 -#elif defined(__AVR_ATmega1284P__) -#define EXTERNAL_NUM_INTERRUPTS 3 -#else -#define EXTERNAL_NUM_INTERRUPTS 2 -#endif - -typedef void (*voidFuncPtr)(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c b/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c deleted file mode 100644 index 0d968865d2..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - wiring_pulse.c - pulseIn() function - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ -*/ - -#include "wiring_private.h" -#include "pins_arduino.h" - -/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH - * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds - * to 3 minutes in length, but must be called at least a few dozen microseconds - * before the start of the pulse. */ -unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) -{ - // cache the port and bit of the pin in order to speed up the - // pulse width measuring loop and achieve finer resolution. calling - // digitalRead() instead yields much coarser resolution. - uint8_t bit = digitalPinToBitMask(pin); - uint8_t port = digitalPinToPort(pin); - uint8_t stateMask = (state ? bit : 0); - unsigned long width = 0; // keep initialization out of time critical area - - // convert the timeout from microseconds to a number of times through - // the initial loop; it takes 16 clock cycles per iteration. - unsigned long numloops = 0; - unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; - - // wait for any previous pulse to end - while ((*portInputRegister(port) & bit) == stateMask) - if (numloops++ == maxloops) - return 0; - - // wait for the pulse to start - while ((*portInputRegister(port) & bit) != stateMask) - if (numloops++ == maxloops) - return 0; - - // wait for the pulse to stop - while ((*portInputRegister(port) & bit) == stateMask) { - if (numloops++ == maxloops) - return 0; - width++; - } - - // convert the reading to microseconds. The loop has been determined - // to be 20 clock cycles long and have about 16 clocks between the edge - // and the start of the loop. There will be some error introduced by - // the interrupt handlers. - return clockCyclesToMicroseconds(width * 21 + 16); -} diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c b/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c deleted file mode 100644 index cfe786758c..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - wiring_shift.c - shiftOut() function - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2005-2006 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ -*/ - -#include "wiring_private.h" - -uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { - uint8_t value = 0; - uint8_t i; - - for (i = 0; i < 8; ++i) { - digitalWrite(clockPin, HIGH); - if (bitOrder == LSBFIRST) - value |= digitalRead(dataPin) << i; - else - value |= digitalRead(dataPin) << (7 - i); - digitalWrite(clockPin, LOW); - } - return value; -} - -void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) -{ - uint8_t i; - - for (i = 0; i < 8; i++) { - if (bitOrder == LSBFIRST) - digitalWrite(dataPin, !!(val & (1 << i))); - else - digitalWrite(dataPin, !!(val & (1 << (7 - i)))); - - digitalWrite(clockPin, HIGH); - digitalWrite(clockPin, LOW); - } -} diff --git a/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h b/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h deleted file mode 100644 index 52b37efc40..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#include "../standard/pins_arduino.h" -#undef NUM_ANALOG_INPUTS -#define NUM_ANALOG_INPUTS 8 diff --git a/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h b/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h deleted file mode 100644 index 9f770d6cec..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) -#define TXLED0 PORTD |= (1<<5) -#define TXLED1 PORTD &= ~(1<<5) -#define RXLED0 PORTB |= (1<<0) -#define RXLED1 PORTB &= ~(1<<0) - -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; - -// Map SPI port to 'new' pins D14..D17 -static const uint8_t SS = 17; -static const uint8_t MOSI = 16; -static const uint8_t MISO = 14; -static const uint8_t SCK = 15; - -// Mapping of analog pins as digital I/O -// A6-A11 share with digital pins -static const uint8_t A0 = 18; -static const uint8_t A1 = 19; -static const uint8_t A2 = 20; -static const uint8_t A3 = 21; -static const uint8_t A4 = 22; -static const uint8_t A5 = 23; -static const uint8_t A6 = 24; // D4 -static const uint8_t A7 = 25; // D6 -static const uint8_t A8 = 26; // D8 -static const uint8_t A9 = 27; // D9 -static const uint8_t A10 = 28; // D10 -static const uint8_t A11 = 29; // D12 - -#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) 0 -#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) -#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) - -// __AVR_ATmega32U4__ has an unusual mapping of pins to channels -extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA32U4 / ARDUINO LEONARDO -// -// D0 PD2 RXD1/INT2 -// D1 PD3 TXD1/INT3 -// D2 PD1 SDA SDA/INT1 -// D3# PD0 PWM8/SCL OC0B/SCL/INT0 -// D4 A6 PD4 ADC8 -// D5# PC6 ??? OC3A/#OC4A -// D6# A7 PD7 FastPWM #OC4D/ADC10 -// D7 PE6 INT6/AIN0 -// -// D8 A8 PB4 ADC11/PCINT4 -// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 -// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 -// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 -// D12 A11 PD6 T1/#OC4D/ADC9 -// D13# PC7 PWM10 CLK0/OC4A -// -// A0 D18 PF7 ADC7 -// A1 D19 PF6 ADC6 -// A2 D20 PF5 ADC5 -// A3 D21 PF4 ADC4 -// A4 D22 PF1 ADC1 -// A5 D23 PF0 ADC0 -// -// New pins D14..D17 to map SPI port to digital pins -// -// MISO D14 PB3 MISO,PCINT3 -// SCK D15 PB1 SCK,PCINT1 -// MOSI D16 PB2 MOSI,PCINT2 -// SS D17 PB0 RXLED,SS/PCINT0 -// -// TXLED PD5 -// RXLED PB0 -// HWB PE2 HWB - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[30] = { - PD, // D0 - PD2 - PD, // D1 - PD3 - PD, // D2 - PD1 - PD, // D3 - PD0 - PD, // D4 - PD4 - PC, // D5 - PC6 - PD, // D6 - PD7 - PE, // D7 - PE6 - - PB, // D8 - PB4 - PB, // D9 - PB5 - PB, // D10 - PB6 - PB, // D11 - PB7 - PD, // D12 - PD6 - PC, // D13 - PC7 - - PB, // D14 - MISO - PB3 - PB, // D15 - SCK - PB1 - PB, // D16 - MOSI - PB2 - PB, // D17 - SS - PB0 - - PF, // D18 - A0 - PF7 - PF, // D19 - A1 - PF6 - PF, // D20 - A2 - PF5 - PF, // D21 - A3 - PF4 - PF, // D22 - A4 - PF1 - PF, // D23 - A5 - PF0 - - PD, // D24 / D4 - A6 - PD4 - PD, // D25 / D6 - A7 - PD7 - PB, // D26 / D8 - A8 - PB4 - PB, // D27 / D9 - A9 - PB5 - PB, // D28 / D10 - A10 - PB6 - PD, // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[30] = { - _BV(2), // D0 - PD2 - _BV(3), // D1 - PD3 - _BV(1), // D2 - PD1 - _BV(0), // D3 - PD0 - _BV(4), // D4 - PD4 - _BV(6), // D5 - PC6 - _BV(7), // D6 - PD7 - _BV(6), // D7 - PE6 - - _BV(4), // D8 - PB4 - _BV(5), // D9 - PB5 - _BV(6), // D10 - PB6 - _BV(7), // D11 - PB7 - _BV(6), // D12 - PD6 - _BV(7), // D13 - PC7 - - _BV(3), // D14 - MISO - PB3 - _BV(1), // D15 - SCK - PB1 - _BV(2), // D16 - MOSI - PB2 - _BV(0), // D17 - SS - PB0 - - _BV(7), // D18 - A0 - PF7 - _BV(6), // D19 - A1 - PF6 - _BV(5), // D20 - A2 - PF5 - _BV(4), // D21 - A3 - PF4 - _BV(1), // D22 - A4 - PF1 - _BV(0), // D23 - A5 - PF0 - - _BV(4), // D24 / D4 - A6 - PD4 - _BV(7), // D25 / D6 - A7 - PD7 - _BV(4), // D26 / D8 - A8 - PB4 - _BV(5), // D27 / D9 - A9 - PB5 - _BV(6), // D28 / D10 - A10 - PB6 - _BV(6), // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[16] = { - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - TIMER0B, /* 3 */ - NOT_ON_TIMER, - TIMER3A, /* 5 */ - TIMER4D, /* 6 */ - NOT_ON_TIMER, - - NOT_ON_TIMER, - TIMER1A, /* 9 */ - TIMER1B, /* 10 */ - TIMER0A, /* 11 */ - - NOT_ON_TIMER, - TIMER4A, /* 13 */ - - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -const uint8_t PROGMEM analog_pin_to_channel_PGM[12] = { - 7, // A0 PF7 ADC7 - 6, // A1 PF6 ADC6 - 5, // A2 PF5 ADC5 - 4, // A3 PF4 ADC4 - 1, // A4 PF1 ADC1 - 0, // A5 PF0 ADC0 - 8, // A6 D4 PD4 ADC8 - 10, // A7 D6 PD7 ADC10 - 11, // A8 D8 PB4 ADC11 - 12, // A9 D9 PB5 ADC12 - 13, // A10 D10 PB6 ADC13 - 9 // A11 D12 PD6 ADC9 -}; - -#endif /* ARDUINO_MAIN */ -#endif /* Pins_Arduino_h */ diff --git a/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h b/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h deleted file mode 100644 index 5a9b4cb09b..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h +++ /dev/null @@ -1,363 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -#define NUM_DIGITAL_PINS 70 -#define NUM_ANALOG_INPUTS 16 -#define analogInputToDigitalPin(p) ((p < 16) ? (p) + 54 : -1) -#define digitalPinHasPWM(p) (((p) >= 2 && (p) <= 13) || ((p) >= 44 && (p)<= 46)) - -static const uint8_t SS = 53; -static const uint8_t MOSI = 51; -static const uint8_t MISO = 50; -static const uint8_t SCK = 52; - -static const uint8_t SDA = 20; -static const uint8_t SCL = 21; -static const uint8_t LED_BUILTIN = 13; - -static const uint8_t A0 = 54; -static const uint8_t A1 = 55; -static const uint8_t A2 = 56; -static const uint8_t A3 = 57; -static const uint8_t A4 = 58; -static const uint8_t A5 = 59; -static const uint8_t A6 = 60; -static const uint8_t A7 = 61; -static const uint8_t A8 = 62; -static const uint8_t A9 = 63; -static const uint8_t A10 = 64; -static const uint8_t A11 = 65; -static const uint8_t A12 = 66; -static const uint8_t A13 = 67; -static const uint8_t A14 = 68; -static const uint8_t A15 = 69; - -// A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins) -// Only pins available for RECEIVE (TRANSMIT can be on any pin): -// (I've deliberately left out pin mapping to the Hardware USARTs - seems senseless to me) -// Pins: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 - -#define digitalPinToPCICR(p) ( (((p) >= 10) && ((p) <= 13)) || \ - (((p) >= 50) && ((p) <= 53)) || \ - (((p) >= 62) && ((p) <= 69)) ? (&PCICR) : ((uint8_t *)0) ) - -#define digitalPinToPCICRbit(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? 0 : \ - ( (((p) >= 62) && ((p) <= 69)) ? 2 : \ - 0 ) ) - -#define digitalPinToPCMSK(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? (&PCMSK0) : \ - ( (((p) >= 62) && ((p) <= 69)) ? (&PCMSK2) : \ - ((uint8_t *)0) ) ) - -#define digitalPinToPCMSKbit(p) ( (((p) >= 10) && ((p) <= 13)) ? ((p) - 6) : \ - ( ((p) == 50) ? 3 : \ - ( ((p) == 51) ? 2 : \ - ( ((p) == 52) ? 1 : \ - ( ((p) == 53) ? 0 : \ - ( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \ - 0 ) ) ) ) ) ) - -#ifdef ARDUINO_MAIN - -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - (uint16_t) &DDRA, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, - (uint16_t) &DDRG, - (uint16_t) &DDRH, - NOT_A_PORT, - (uint16_t) &DDRJ, - (uint16_t) &DDRK, - (uint16_t) &DDRL, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - (uint16_t) &PORTA, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, - (uint16_t) &PORTG, - (uint16_t) &PORTH, - NOT_A_PORT, - (uint16_t) &PORTJ, - (uint16_t) &PORTK, - (uint16_t) &PORTL, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PIN, - (uint16_t) &PINA, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, - (uint16_t) &PING, - (uint16_t) &PINH, - NOT_A_PIN, - (uint16_t) &PINJ, - (uint16_t) &PINK, - (uint16_t) &PINL, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - // PORTLIST - // ------------------------------------------- - PE , // PE 0 ** 0 ** USART0_RX - PE , // PE 1 ** 1 ** USART0_TX - PE , // PE 4 ** 2 ** PWM2 - PE , // PE 5 ** 3 ** PWM3 - PG , // PG 5 ** 4 ** PWM4 - PE , // PE 3 ** 5 ** PWM5 - PH , // PH 3 ** 6 ** PWM6 - PH , // PH 4 ** 7 ** PWM7 - PH , // PH 5 ** 8 ** PWM8 - PH , // PH 6 ** 9 ** PWM9 - PB , // PB 4 ** 10 ** PWM10 - PB , // PB 5 ** 11 ** PWM11 - PB , // PB 6 ** 12 ** PWM12 - PB , // PB 7 ** 13 ** PWM13 - PJ , // PJ 1 ** 14 ** USART3_TX - PJ , // PJ 0 ** 15 ** USART3_RX - PH , // PH 1 ** 16 ** USART2_TX - PH , // PH 0 ** 17 ** USART2_RX - PD , // PD 3 ** 18 ** USART1_TX - PD , // PD 2 ** 19 ** USART1_RX - PD , // PD 1 ** 20 ** I2C_SDA - PD , // PD 0 ** 21 ** I2C_SCL - PA , // PA 0 ** 22 ** D22 - PA , // PA 1 ** 23 ** D23 - PA , // PA 2 ** 24 ** D24 - PA , // PA 3 ** 25 ** D25 - PA , // PA 4 ** 26 ** D26 - PA , // PA 5 ** 27 ** D27 - PA , // PA 6 ** 28 ** D28 - PA , // PA 7 ** 29 ** D29 - PC , // PC 7 ** 30 ** D30 - PC , // PC 6 ** 31 ** D31 - PC , // PC 5 ** 32 ** D32 - PC , // PC 4 ** 33 ** D33 - PC , // PC 3 ** 34 ** D34 - PC , // PC 2 ** 35 ** D35 - PC , // PC 1 ** 36 ** D36 - PC , // PC 0 ** 37 ** D37 - PD , // PD 7 ** 38 ** D38 - PG , // PG 2 ** 39 ** D39 - PG , // PG 1 ** 40 ** D40 - PG , // PG 0 ** 41 ** D41 - PL , // PL 7 ** 42 ** D42 - PL , // PL 6 ** 43 ** D43 - PL , // PL 5 ** 44 ** D44 - PL , // PL 4 ** 45 ** D45 - PL , // PL 3 ** 46 ** D46 - PL , // PL 2 ** 47 ** D47 - PL , // PL 1 ** 48 ** D48 - PL , // PL 0 ** 49 ** D49 - PB , // PB 3 ** 50 ** SPI_MISO - PB , // PB 2 ** 51 ** SPI_MOSI - PB , // PB 1 ** 52 ** SPI_SCK - PB , // PB 0 ** 53 ** SPI_SS - PF , // PF 0 ** 54 ** A0 - PF , // PF 1 ** 55 ** A1 - PF , // PF 2 ** 56 ** A2 - PF , // PF 3 ** 57 ** A3 - PF , // PF 4 ** 58 ** A4 - PF , // PF 5 ** 59 ** A5 - PF , // PF 6 ** 60 ** A6 - PF , // PF 7 ** 61 ** A7 - PK , // PK 0 ** 62 ** A8 - PK , // PK 1 ** 63 ** A9 - PK , // PK 2 ** 64 ** A10 - PK , // PK 3 ** 65 ** A11 - PK , // PK 4 ** 66 ** A12 - PK , // PK 5 ** 67 ** A13 - PK , // PK 6 ** 68 ** A14 - PK , // PK 7 ** 69 ** A15 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - // PIN IN PORT - // ------------------------------------------- - _BV( 0 ) , // PE 0 ** 0 ** USART0_RX - _BV( 1 ) , // PE 1 ** 1 ** USART0_TX - _BV( 4 ) , // PE 4 ** 2 ** PWM2 - _BV( 5 ) , // PE 5 ** 3 ** PWM3 - _BV( 5 ) , // PG 5 ** 4 ** PWM4 - _BV( 3 ) , // PE 3 ** 5 ** PWM5 - _BV( 3 ) , // PH 3 ** 6 ** PWM6 - _BV( 4 ) , // PH 4 ** 7 ** PWM7 - _BV( 5 ) , // PH 5 ** 8 ** PWM8 - _BV( 6 ) , // PH 6 ** 9 ** PWM9 - _BV( 4 ) , // PB 4 ** 10 ** PWM10 - _BV( 5 ) , // PB 5 ** 11 ** PWM11 - _BV( 6 ) , // PB 6 ** 12 ** PWM12 - _BV( 7 ) , // PB 7 ** 13 ** PWM13 - _BV( 1 ) , // PJ 1 ** 14 ** USART3_TX - _BV( 0 ) , // PJ 0 ** 15 ** USART3_RX - _BV( 1 ) , // PH 1 ** 16 ** USART2_TX - _BV( 0 ) , // PH 0 ** 17 ** USART2_RX - _BV( 3 ) , // PD 3 ** 18 ** USART1_TX - _BV( 2 ) , // PD 2 ** 19 ** USART1_RX - _BV( 1 ) , // PD 1 ** 20 ** I2C_SDA - _BV( 0 ) , // PD 0 ** 21 ** I2C_SCL - _BV( 0 ) , // PA 0 ** 22 ** D22 - _BV( 1 ) , // PA 1 ** 23 ** D23 - _BV( 2 ) , // PA 2 ** 24 ** D24 - _BV( 3 ) , // PA 3 ** 25 ** D25 - _BV( 4 ) , // PA 4 ** 26 ** D26 - _BV( 5 ) , // PA 5 ** 27 ** D27 - _BV( 6 ) , // PA 6 ** 28 ** D28 - _BV( 7 ) , // PA 7 ** 29 ** D29 - _BV( 7 ) , // PC 7 ** 30 ** D30 - _BV( 6 ) , // PC 6 ** 31 ** D31 - _BV( 5 ) , // PC 5 ** 32 ** D32 - _BV( 4 ) , // PC 4 ** 33 ** D33 - _BV( 3 ) , // PC 3 ** 34 ** D34 - _BV( 2 ) , // PC 2 ** 35 ** D35 - _BV( 1 ) , // PC 1 ** 36 ** D36 - _BV( 0 ) , // PC 0 ** 37 ** D37 - _BV( 7 ) , // PD 7 ** 38 ** D38 - _BV( 2 ) , // PG 2 ** 39 ** D39 - _BV( 1 ) , // PG 1 ** 40 ** D40 - _BV( 0 ) , // PG 0 ** 41 ** D41 - _BV( 7 ) , // PL 7 ** 42 ** D42 - _BV( 6 ) , // PL 6 ** 43 ** D43 - _BV( 5 ) , // PL 5 ** 44 ** D44 - _BV( 4 ) , // PL 4 ** 45 ** D45 - _BV( 3 ) , // PL 3 ** 46 ** D46 - _BV( 2 ) , // PL 2 ** 47 ** D47 - _BV( 1 ) , // PL 1 ** 48 ** D48 - _BV( 0 ) , // PL 0 ** 49 ** D49 - _BV( 3 ) , // PB 3 ** 50 ** SPI_MISO - _BV( 2 ) , // PB 2 ** 51 ** SPI_MOSI - _BV( 1 ) , // PB 1 ** 52 ** SPI_SCK - _BV( 0 ) , // PB 0 ** 53 ** SPI_SS - _BV( 0 ) , // PF 0 ** 54 ** A0 - _BV( 1 ) , // PF 1 ** 55 ** A1 - _BV( 2 ) , // PF 2 ** 56 ** A2 - _BV( 3 ) , // PF 3 ** 57 ** A3 - _BV( 4 ) , // PF 4 ** 58 ** A4 - _BV( 5 ) , // PF 5 ** 59 ** A5 - _BV( 6 ) , // PF 6 ** 60 ** A6 - _BV( 7 ) , // PF 7 ** 61 ** A7 - _BV( 0 ) , // PK 0 ** 62 ** A8 - _BV( 1 ) , // PK 1 ** 63 ** A9 - _BV( 2 ) , // PK 2 ** 64 ** A10 - _BV( 3 ) , // PK 3 ** 65 ** A11 - _BV( 4 ) , // PK 4 ** 66 ** A12 - _BV( 5 ) , // PK 5 ** 67 ** A13 - _BV( 6 ) , // PK 6 ** 68 ** A14 - _BV( 7 ) , // PK 7 ** 69 ** A15 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - // TIMERS - // ------------------------------------------- - NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX - NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX - TIMER3B , // PE 4 ** 2 ** PWM2 - TIMER3C , // PE 5 ** 3 ** PWM3 - TIMER0B , // PG 5 ** 4 ** PWM4 - TIMER3A , // PE 3 ** 5 ** PWM5 - TIMER4A , // PH 3 ** 6 ** PWM6 - TIMER4B , // PH 4 ** 7 ** PWM7 - TIMER4C , // PH 5 ** 8 ** PWM8 - TIMER2B , // PH 6 ** 9 ** PWM9 - TIMER2A , // PB 4 ** 10 ** PWM10 - TIMER1A , // PB 5 ** 11 ** PWM11 - TIMER1B , // PB 6 ** 12 ** PWM12 - TIMER0A , // PB 7 ** 13 ** PWM13 - NOT_ON_TIMER , // PJ 1 ** 14 ** USART3_TX - NOT_ON_TIMER , // PJ 0 ** 15 ** USART3_RX - NOT_ON_TIMER , // PH 1 ** 16 ** USART2_TX - NOT_ON_TIMER , // PH 0 ** 17 ** USART2_RX - NOT_ON_TIMER , // PD 3 ** 18 ** USART1_TX - NOT_ON_TIMER , // PD 2 ** 19 ** USART1_RX - NOT_ON_TIMER , // PD 1 ** 20 ** I2C_SDA - NOT_ON_TIMER , // PD 0 ** 21 ** I2C_SCL - NOT_ON_TIMER , // PA 0 ** 22 ** D22 - NOT_ON_TIMER , // PA 1 ** 23 ** D23 - NOT_ON_TIMER , // PA 2 ** 24 ** D24 - NOT_ON_TIMER , // PA 3 ** 25 ** D25 - NOT_ON_TIMER , // PA 4 ** 26 ** D26 - NOT_ON_TIMER , // PA 5 ** 27 ** D27 - NOT_ON_TIMER , // PA 6 ** 28 ** D28 - NOT_ON_TIMER , // PA 7 ** 29 ** D29 - NOT_ON_TIMER , // PC 7 ** 30 ** D30 - NOT_ON_TIMER , // PC 6 ** 31 ** D31 - NOT_ON_TIMER , // PC 5 ** 32 ** D32 - NOT_ON_TIMER , // PC 4 ** 33 ** D33 - NOT_ON_TIMER , // PC 3 ** 34 ** D34 - NOT_ON_TIMER , // PC 2 ** 35 ** D35 - NOT_ON_TIMER , // PC 1 ** 36 ** D36 - NOT_ON_TIMER , // PC 0 ** 37 ** D37 - NOT_ON_TIMER , // PD 7 ** 38 ** D38 - NOT_ON_TIMER , // PG 2 ** 39 ** D39 - NOT_ON_TIMER , // PG 1 ** 40 ** D40 - NOT_ON_TIMER , // PG 0 ** 41 ** D41 - NOT_ON_TIMER , // PL 7 ** 42 ** D42 - NOT_ON_TIMER , // PL 6 ** 43 ** D43 - TIMER5C , // PL 5 ** 44 ** D44 - TIMER5B , // PL 4 ** 45 ** D45 - TIMER5A , // PL 3 ** 46 ** D46 - NOT_ON_TIMER , // PL 2 ** 47 ** D47 - NOT_ON_TIMER , // PL 1 ** 48 ** D48 - NOT_ON_TIMER , // PL 0 ** 49 ** D49 - NOT_ON_TIMER , // PB 3 ** 50 ** SPI_MISO - NOT_ON_TIMER , // PB 2 ** 51 ** SPI_MOSI - NOT_ON_TIMER , // PB 1 ** 52 ** SPI_SCK - NOT_ON_TIMER , // PB 0 ** 53 ** SPI_SS - NOT_ON_TIMER , // PF 0 ** 54 ** A0 - NOT_ON_TIMER , // PF 1 ** 55 ** A1 - NOT_ON_TIMER , // PF 2 ** 56 ** A2 - NOT_ON_TIMER , // PF 3 ** 57 ** A3 - NOT_ON_TIMER , // PF 4 ** 58 ** A4 - NOT_ON_TIMER , // PF 5 ** 59 ** A5 - NOT_ON_TIMER , // PF 6 ** 60 ** A6 - NOT_ON_TIMER , // PF 7 ** 61 ** A7 - NOT_ON_TIMER , // PK 0 ** 62 ** A8 - NOT_ON_TIMER , // PK 1 ** 63 ** A9 - NOT_ON_TIMER , // PK 2 ** 64 ** A10 - NOT_ON_TIMER , // PK 3 ** 65 ** A11 - NOT_ON_TIMER , // PK 4 ** 66 ** A12 - NOT_ON_TIMER , // PK 5 ** 67 ** A13 - NOT_ON_TIMER , // PK 6 ** 68 ** A14 - NOT_ON_TIMER , // PK 7 ** 69 ** A15 -}; - -#endif - -#endif \ No newline at end of file diff --git a/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h b/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h deleted file mode 100644 index 30b4266306..0000000000 --- a/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -#define NUM_DIGITAL_PINS 20 -#define NUM_ANALOG_INPUTS 6 -#define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1) - -#if defined(__AVR_ATmega8__) -#define digitalPinHasPWM(p) ((p) == 9 || (p) == 10 || (p) == 11) -#else -#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11) -#endif - -static const uint8_t SS = 10; -static const uint8_t MOSI = 11; -static const uint8_t MISO = 12; -static const uint8_t SCK = 13; - -static const uint8_t SDA = 18; -static const uint8_t SCL = 19; -static const uint8_t LED_BUILTIN = 13; - -static const uint8_t A0 = 14; -static const uint8_t A1 = 15; -static const uint8_t A2 = 16; -static const uint8_t A3 = 17; -static const uint8_t A4 = 18; -static const uint8_t A5 = 19; -static const uint8_t A6 = 20; -static const uint8_t A7 = 21; - -#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1)) -#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0)))) -#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA8 & 168 / ARDUINO -// -// +-\/-+ -// PC6 1| |28 PC5 (AI 5) -// (D 0) PD0 2| |27 PC4 (AI 4) -// (D 1) PD1 3| |26 PC3 (AI 3) -// (D 2) PD2 4| |25 PC2 (AI 2) -// PWM+ (D 3) PD3 5| |24 PC1 (AI 1) -// (D 4) PD4 6| |23 PC0 (AI 0) -// VCC 7| |22 GND -// GND 8| |21 AREF -// PB6 9| |20 AVCC -// PB7 10| |19 PB5 (D 13) -// PWM+ (D 5) PD5 11| |18 PB4 (D 12) -// PWM+ (D 6) PD6 12| |17 PB3 (D 11) PWM -// (D 7) PD7 13| |16 PB2 (D 10) PWM -// (D 8) PB0 14| |15 PB1 (D 9) PWM -// +----+ -// -// (PWM+ indicates the additional PWM pins on the ATmega168.) - -// ATMEL ATMEGA1280 / ARDUINO -// -// 0-7 PE0-PE7 works -// 8-13 PB0-PB5 works -// 14-21 PA0-PA7 works -// 22-29 PH0-PH7 works -// 30-35 PG5-PG0 works -// 36-43 PC7-PC0 works -// 44-51 PJ7-PJ0 works -// 52-59 PL7-PL0 works -// 60-67 PD7-PD0 works -// A0-A7 PF0-PF7 -// A8-A15 PK0-PK7 - - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, /* 0 */ - PD, - PD, - PD, - PD, - PD, - PD, - PD, - PB, /* 8 */ - PB, - PB, - PB, - PB, - PB, - PC, /* 14 */ - PC, - PC, - PC, - PC, - PC, -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(0), /* 0, port D */ - _BV(1), - _BV(2), - _BV(3), - _BV(4), - _BV(5), - _BV(6), - _BV(7), - _BV(0), /* 8, port B */ - _BV(1), - _BV(2), - _BV(3), - _BV(4), - _BV(5), - _BV(0), /* 14, port C */ - _BV(1), - _BV(2), - _BV(3), - _BV(4), - _BV(5), -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, /* 0 - port D */ - NOT_ON_TIMER, - NOT_ON_TIMER, - // on the ATmega168, digital pin 3 has hardware pwm -#if defined(__AVR_ATmega8__) - NOT_ON_TIMER, -#else - TIMER2B, -#endif - NOT_ON_TIMER, - // on the ATmega168, digital pins 5 and 6 have hardware pwm -#if defined(__AVR_ATmega8__) - NOT_ON_TIMER, - NOT_ON_TIMER, -#else - TIMER0B, - TIMER0A, -#endif - NOT_ON_TIMER, - NOT_ON_TIMER, /* 8 - port B */ - TIMER1A, - TIMER1B, -#if defined(__AVR_ATmega8__) - TIMER2, -#else - TIMER2A, -#endif - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, /* 14 - port C */ - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -#endif - -#endif diff --git a/protocol/usb_hid/leonardo_led.h b/protocol/usb_hid/leonardo_led.h deleted file mode 100644 index 6f67a88f5b..0000000000 --- a/protocol/usb_hid/leonardo_led.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LEONARDO_LED_H -#define LEONARDO_LED_H - -// Leonardo "TX" LED for debug -#define LED_TX_INIT (DDRD |= (1<<5)) -#define LED_TX_ON (PORTD &= ~(1<<5)) -#define LED_TX_OFF (PORTD |= (1<<5)) -#define LED_TX_TOGGLE (PORTD ^= (1<<5)) - -#endif diff --git a/protocol/usb_hid/override_Serial.cpp b/protocol/usb_hid/override_Serial.cpp deleted file mode 100644 index e1755a5dc7..0000000000 --- a/protocol/usb_hid/override_Serial.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Null implementation of Serial to dump debug print into blackhole - */ -#include "Arduino.h" -#include "sendchar.h" - -#include "USBAPI.h" - - -void Serial_::begin(uint16_t baud_count) -{ -} - -void Serial_::end(void) -{ -} - -void Serial_::accept(void) -{ -} - -int Serial_::available(void) -{ - return 0; -} - -int Serial_::peek(void) -{ - return -1; -} - -int Serial_::read(void) -{ - return -1; -} - -void Serial_::flush(void) -{ -} - -size_t Serial_::write(uint8_t c) -{ - sendchar(c); - return 1; -} - -Serial_::operator bool() { - return true; -} - -Serial_ Serial; diff --git a/protocol/usb_hid/override_wiring.c b/protocol/usb_hid/override_wiring.c deleted file mode 100644 index 1e9a94ce26..0000000000 --- a/protocol/usb_hid/override_wiring.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * To keep Timer0 for common/timer.c override arduino/wiring.c. - */ -#define __DELAY_BACKWARD_COMPATIBLE__ -#include -#include "common/timer.h" -#include "Arduino.h" - - -unsigned long millis() -{ - return timer_read32(); -} -unsigned long micros() -{ - return timer_read32() * 1000UL; -} -void delay(unsigned long ms) -{ - _delay_ms(ms); -} -void delayMicroseconds(unsigned int us) -{ - _delay_us(us); -} -void init() -{ - timer_init(); -} diff --git a/protocol/usb_hid/parser.cpp b/protocol/usb_hid/parser.cpp deleted file mode 100644 index 28151f9d59..0000000000 --- a/protocol/usb_hid/parser.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "parser.h" -#include "usb_hid.h" - -#include "debug.h" - - -report_keyboard_t usb_hid_keyboard_report; -uint16_t usb_hid_time_stamp; - - -void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) -{ - ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); - usb_hid_time_stamp = millis(); - - debug("KBDReport: "); - debug_hex(usb_hid_keyboard_report.mods); - debug(" --"); - for (uint8_t i = 0; i < 6; i++) { - debug(" "); - debug_hex(usb_hid_keyboard_report.keys[i]); - } - debug("\r\n"); -} diff --git a/protocol/usb_hid/parser.h b/protocol/usb_hid/parser.h deleted file mode 100644 index 703eb1ed4c..0000000000 --- a/protocol/usb_hid/parser.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef PARSER_H -#define PARSER_H - -#include "hid.h" - -class KBDReportParser : public HIDReportParser -{ -public: - virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); -}; - -#endif diff --git a/protocol/usb_hid/test/Makefile b/protocol/usb_hid/test/Makefile deleted file mode 100644 index 83bf2aed67..0000000000 --- a/protocol/usb_hid/test/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#---------------------------------------------------------------------------- -# On command line: -# -# make all = Make software. -# -# make clean = Clean out built project files. -# -# make coff = Convert ELF to AVR COFF. -# -# make extcoff = Convert ELF to AVR Extended COFF. -# -# make program = Download the hex file to the device. -# Please customize your programmer settings(PROGRAM_CMD) -# -# make teensy = Download the hex file to the device, using teensy_loader_cli. -# (must have teensy_loader_cli installed). -# -# make dfu = Download the hex file to the device, using dfu-programmer (must -# have dfu-programmer installed). -# -# make flip = Download the hex file to the device, using Atmel FLIP (must -# have Atmel FLIP installed). -# -# make dfu-ee = Download the eeprom file to the device, using dfu-programmer -# (must have dfu-programmer installed). -# -# make flip-ee = Download the eeprom file to the device, using Atmel FLIP -# (must have Atmel FLIP installed). -# -# make debug = Start either simulavr or avarice as specified for debugging, -# with avr-gdb or avr-insight as the front end for debugging. -# -# make filename.s = Just compile filename.c into the assembler code only. -# -# make filename.i = Create a preprocessed source file for use in submitting -# bug reports to the GCC project. -# -# To rebuild project do "make clean" then "make all". -#---------------------------------------------------------------------------- - -# Target file name (without extension). -TARGET = usb_hid_test - -TMK_DIR = ../../.. - -# Directory keyboard dependent files exist -TARGET_DIR = . - -# MCU name -MCU = atmega32u4 - - -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = 16000000 - - - -# -# LUFA specific -# -# Target architecture (see library "Board Types" documentation). -ARCH = AVR8 -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) -# Interrupt driven control endpoint task -OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - - - -# Build Options -# comment out to disable the options. -# -# Console for debug -OPT_DEFS += -DCONSOLE_ENABLE - -# Boot Section Size in bytes -# Teensy halfKay 512 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -#OPT_DEFS += -DBOOT_SIZE=4096 - - - -SRC = test.cpp -SRC += common/debug.c -SRC += common/print.c - -CONFIG_H = config.h - - - -# Search Path -VPATH += $(TARGET_DIR) -VPATH += $(TMK_DIR) -VPATH += $(TMK_DIR)/common - - - -# program Leonardo -PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -P$(DEV) -b57600 -Uflash:w:$(TARGET).hex - - - -include $(TMK_DIR)/protocol/usb_hid.mk -include $(TMK_DIR)/protocol/lufa.mk -include $(TMK_DIR)/rules.mk diff --git a/protocol/usb_hid/test/config.h b/protocol/usb_hid/test/config.h deleted file mode 100644 index c2230fb570..0000000000 --- a/protocol/usb_hid/test/config.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - - -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0xCAFE -#define DEVICE_VER 0x0814 -#define MANUFACTURER t.m.k. -#define PRODUCT USB to USB keyboard converter - - -#define DESCRIPTION Product from t.m.k. keyboard firmware project - - -/* matrix size */ -#define MATRIX_ROWS 32 -#define MATRIX_COLS 8 - - -/* key combination for command */ -#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT))) - -#endif diff --git a/protocol/usb_hid/test/test.cpp b/protocol/usb_hid/test/test.cpp deleted file mode 100644 index 4958f0c619..0000000000 --- a/protocol/usb_hid/test/test.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include -#include -#include -#include - -// USB HID host -#include "Usb.h" -#include "hid.h" -#include "hidboot.h" -#include "parser.h" - -// LUFA -#include "lufa.h" - -#include "debug.h" - -#include "leonardo_led.h" - - -static USB usb_host; -static HIDBoot kbd(&usb_host); -static KBDReportParser kbd_parser; - -static void LUFA_setup(void) -{ - /* Disable watchdog if enabled by bootloader/fuses */ - MCUSR &= ~(1 << WDRF); - wdt_disable(); - - /* Disable clock division */ - clock_prescale_set(clock_div_1); - - // Leonardo needs. Without this USB device is not recognized. - USB_Disable(); - - USB_Init(); - - // for Console_Task - USB_Device_EnableSOFEvents(); -} - -static void HID_setup() -{ - // Arduino Timer startup: wiring.c - init(); - - if (usb_host.Init() == -1) { - debug("HID init: failed\n"); - LED_TX_OFF; - } - - _delay_ms(200); - - kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); -} - -int main(void) -{ - // LED for debug - LED_TX_INIT; - LED_TX_ON; - - print_enable = true; - debug_enable = true; - debug_matrix = true; - debug_keyboard = true; - debug_mouse = true; - - LUFA_setup(); - sei(); - - // wait for startup of sendchar routine - while (USB_DeviceState != DEVICE_STATE_Configured) ; - if (debug_enable) { - _delay_ms(1000); - } - - HID_setup(); - - debug("init: done\n"); - for (;;) { - usb_host.Task(); - -#if !defined(INTERRUPT_CONTROL_ENDPOINT) - // LUFA Task for control request - USB_USBTask(); -#endif - } - - return 0; -} diff --git a/protocol/usb_hid/usb_hid.h b/protocol/usb_hid/usb_hid.h deleted file mode 100644 index 083b68d1f5..0000000000 --- a/protocol/usb_hid/usb_hid.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef USB_HID_H -#define USB_HID_H - -#include "report.h" - - -extern report_keyboard_t usb_hid_keyboard_report; -extern uint16_t usb_hid_time_stamp; - -#endif diff --git a/protocol/vusb.mk b/protocol/vusb.mk deleted file mode 100644 index 3cba3f71a3..0000000000 --- a/protocol/vusb.mk +++ /dev/null @@ -1,21 +0,0 @@ -VUSB_DIR = protocol/vusb - -OPT_DEFS += -DPROTOCOL_VUSB - -SRC += $(VUSB_DIR)/main.c \ - $(VUSB_DIR)/vusb.c \ - $(VUSB_DIR)/usbdrv/usbdrv.c \ - $(VUSB_DIR)/usbdrv/usbdrvasm.S \ - $(VUSB_DIR)/usbdrv/oddebug.c - - -ifdef NO_UART -SRC += $(COMMON_DIR)/sendchar_null.c -else -SRC += $(COMMON_DIR)/sendchar_uart.c \ - $(COMMON_DIR)/uart.c -endif - - -# Search Path -VPATH += $(TMK_DIR)/protocol/vusb:$(TMK_DIR)/protocol/vusb/usbdrv diff --git a/protocol/vusb/main.c b/protocol/vusb/main.c deleted file mode 100644 index 8e4a266e9b..0000000000 --- a/protocol/vusb/main.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Name: main.c - * Project: hid-mouse, a very simple HID example - * Author: Christian Starkjohann - * Creation Date: 2008-04-07 - * 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: main.c 790 2010-05-30 21:00:26Z cs $ - */ -#include -#include -#include -#include -#include -#include "usbdrv.h" -#include "oddebug.h" -#include "vusb.h" -#include "keyboard.h" -#include "host.h" -#include "timer.h" -#include "uart.h" -#include "debug.h" - - -#define UART_BAUD_RATE 115200 - - -/* This is from main.c of USBaspLoader */ -static void initForUsbConnectivity(void) -{ - uint8_t i = 0; - - usbInit(); - /* enforce USB re-enumerate: */ - usbDeviceDisconnect(); /* do this while interrupts are disabled */ - while(--i){ /* fake USB disconnect for > 250 ms */ - wdt_reset(); - _delay_ms(1); - } - usbDeviceConnect(); - sei(); -} - -int main(void) -{ - bool suspended = false; -#if USB_COUNT_SOF - uint16_t last_timer = timer_read(); -#endif - - CLKPR = 0x80, CLKPR = 0; -#ifndef PS2_USE_USART - uart_init(UART_BAUD_RATE); -#endif - - keyboard_init(); - host_set_driver(vusb_driver()); - - debug("initForUsbConnectivity()\n"); - initForUsbConnectivity(); - - debug("main loop\n"); - while (1) { -#if USB_COUNT_SOF - if (usbSofCount != 0) { - suspended = false; - usbSofCount = 0; - last_timer = timer_read(); - } else { - // Suspend when no SOF in 3ms-10ms(7.1.7.4 Suspending of USB1.1) - if (timer_elapsed(last_timer) > 5) { - suspended = true; -/* - uart_putchar('S'); - _delay_ms(1); - cli(); - set_sleep_mode(SLEEP_MODE_PWR_DOWN); - sleep_enable(); - sleep_bod_disable(); - sei(); - sleep_cpu(); - sleep_disable(); - _delay_ms(10); - uart_putchar('W'); -*/ - } - } -#endif - if (!suspended) { - usbPoll(); - - // TODO: configuration process is incosistent. it sometime fails. - // To prevent failing to configure NOT scan keyboard during configuration - if (usbConfiguration && usbInterruptIsReady()) { - keyboard_task(); - } - vusb_transfer_keyboard(); - } - } -} diff --git a/protocol/vusb/sendchar_usart.c b/protocol/vusb/sendchar_usart.c deleted file mode 100644 index 8d24f87d1e..0000000000 --- a/protocol/vusb/sendchar_usart.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - */ -#include -#include "oddebug.h" -#include "sendchar.h" - - -#if DEBUG_LEVEL > 0 -/* from oddebug.c */ -int8_t sendchar(uint8_t c) -{ - while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ - ODDBG_UDR = c; - return 1; -} -#else -int8_t sendchar(uint8_t c) -{ - return 1; -} -#endif diff --git a/protocol/vusb/usbdrv/Changelog.txt b/protocol/vusb/usbdrv/Changelog.txt deleted file mode 100644 index 5c6354ab1e..0000000000 --- a/protocol/vusb/usbdrv/Changelog.txt +++ /dev/null @@ -1,308 +0,0 @@ -This file documents changes in the firmware-only USB driver for atmel's AVR -microcontrollers. New entries are always appended to the end of the file. -Scroll down to the bottom to see the most recent changes. - -2005-04-01: - - Implemented endpoint 1 as interrupt-in endpoint. - - Moved all configuration options to usbconfig.h which is not part of the - driver. - - Changed interface for usbVendorSetup(). - - Fixed compatibility with ATMega8 device. - - Various minor optimizations. - -2005-04-11: - - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() - and usbFunctionWrite() now. Added configuration options to choose which - of these functions to compile in. - - Assembler module delivers receive data non-inverted now. - - Made register and bit names compatible with more AVR devices. - -2005-05-03: - - Allow address of usbRxBuf on any memory page as long as the buffer does - not cross 256 byte page boundaries. - - Better device compatibility: works with Mega88 now. - - Code optimization in debugging module. - - Documentation updates. - -2006-01-02: - - Added (free) default Vendor- and Product-IDs bought from voti.nl. - - Added USBID-License.txt file which defines the rules for using the free - shared VID/PID pair. - - Added Readme.txt to the usbdrv directory which clarifies administrative - issues. - -2006-01-25: - - Added "configured state" to become more standards compliant. - - Added "HALT" state for interrupt endpoint. - - Driver passes the "USB Command Verifier" test from usb.org now. - - Made "serial number" a configuration option. - - Minor optimizations, we now recommend compiler option "-Os" for best - results. - - Added a version number to usbdrv.h - -2006-02-03: - - New configuration variable USB_BUFFER_SECTION for the memory section where - the USB rx buffer will go. This defaults to ".bss" if not defined. Since - this buffer MUST NOT cross 256 byte pages (not even touch a page at the - end), the user may want to pass a linker option similar to - "-Wl,--section-start=.mybuffer=0x800060". - - Provide structure for usbRequest_t. - - New defines for USB constants. - - Prepared for HID implementations. - - Increased data size limit for interrupt transfers to 8 bytes. - - New macro usbInterruptIsReady() to query interrupt buffer state. - -2006-02-18: - - Ensure that the data token which is sent as an ack to an OUT transfer is - always zero sized. This fixes a bug where the host reports an error after - sending an out transfer to the device, although all data arrived at the - device. - - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). - -* Release 2006-02-20 - - - Give a compiler warning when compiling with debugging turned on. - - Added Oleg Semyonov's changes for IAR-cc compatibility. - - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() - (also thanks to Oleg!). - - Rearranged tests in usbPoll() to save a couple of instructions in the most - likely case that no actions are pending. - - We need a delay between the SET ADDRESS request until the new address - becomes active. This delay was handled in usbPoll() until now. Since the - spec says that the delay must not exceed 2ms, previous versions required - aggressive polling during the enumeration phase. We have now moved the - handling of the delay into the interrupt routine. - - We must not reply with NAK to a SETUP transaction. We can only achieve this - by making sure that the rx buffer is empty when SETUP tokens are expected. - We therefore don't pass zero sized data packets from the status phase of - a transfer to usbPoll(). This change MAY cause troubles if you rely on - receiving a less than 8 bytes long packet in usbFunctionWrite() to - identify the end of a transfer. usbFunctionWrite() will NEVER be called - with a zero length. - -* Release 2006-03-14 - - - Improved IAR C support: tiny memory model, more devices - - Added template usbconfig.h file under the name usbconfig-prototype.h - -* Release 2006-03-26 - - - Added provision for one more interrupt-in endpoint (endpoint 3). - - Added provision for one interrupt-out endpoint (endpoint 1). - - Added flowcontrol macros for USB. - - Added provision for custom configuration descriptor. - - Allow ANY two port bits for D+ and D-. - - Merged (optional) receive endpoint number into global usbRxToken variable. - - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the - variable name from the single port letter instead of computing the address - of related ports from the output-port address. - -* Release 2006-06-26 - - - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the - new features. - - Removed "#warning" directives because IAR does not understand them. Use - unused static variables instead to generate a warning. - - Do not include when compiling with IAR. - - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each - USB descriptor should be handled. It is now possible to provide descriptor - data in Flash, RAM or dynamically at runtime. - - STALL is now a status in usbTxLen* instead of a message. We can now conform - to the spec and leave the stall status pending until it is cleared. - - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the - application code to reset data toggling on interrupt pipes. - -* Release 2006-07-18 - - - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes - an assembler error. - - usbDeviceDisconnect() takes pull-up resistor to high impedance now. - -* Release 2007-02-01 - - - Merged in some code size improvements from usbtiny (thanks to Dick - Streefland for these optimizations!) - - Special alignment requirement for usbRxBuf not required any more. Thanks - again to Dick Streefland for this hint! - - Reverted to "#warning" instead of unused static variables -- new versions - of IAR CC should handle this directive. - - Changed Open Source license to GNU GPL v2 in order to make linking against - other free libraries easier. We no longer require publication of the - circuit diagrams, but we STRONGLY encourage it. If you improve the driver - itself, PLEASE grant us a royalty free license to your changes for our - commercial license. - -* Release 2007-03-29 - - - New configuration option "USB_PUBLIC" in usbconfig.h. - - Set USB version number to 1.10 instead of 1.01. - - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and - USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences - to USB_CFG_DESCR_PROPS_STRING_PRODUCT. - - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver - code. - - New assembler module for 16 MHz crystal. - - usbdrvasm.S contains common code only, clock-specific parts have been moved - to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. - -* Release 2007-06-25 - - - 16 MHz module: Do SE0 check in stuffed bits as well. - -* Release 2007-07-07 - - - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary - for negative values. - - Added 15 MHz module contributed by V. Bosch. - - Interrupt vector name can now be configured. This is useful if somebody - wants to use a different hardware interrupt than INT0. - -* Release 2007-08-07 - - - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is - not exceeded. - - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, - USB_COUNT_SOF - - USB_INTR_PENDING can now be a memory address, not just I/O - -* Release 2007-09-19 - - - Split out common parts of assembler modules into separate include file - - Made endpoint numbers configurable so that given interface definitions - can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h. - - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut() - can handle any number of endpoints. - - Define usbDeviceConnect() and usbDeviceDisconnect() even if no - USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this - case. - -* Release 2007-12-01 - - - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size - when USB_CFG_PULLUP_IOPORTNAME is not defined. - -* Release 2007-12-13 - - - Renamed all include-only assembler modules from *.S to *.inc so that - people don't add them to their project sources. - - Distribute leap bits in tx loop more evenly for 16 MHz module. - - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR - - Avoid compiler warnings for constant expr range by casting some values in - USB descriptors. - -* Release 2008-01-21 - - - Fixed bug in 15 and 16 MHz module where the new address set with - SET_ADDRESS was already accepted at the next NAK or ACK we send, not at - the next data packet we send. This caused problems when the host polled - too fast. Thanks to Alexander Neumann for his help and patience debugging - this issue! - -* Release 2008-02-05 - - - Fixed bug in 16.5 MHz module where a register was used in the interrupt - handler before it was pushed. This bug was introduced with version - 2007-09-19 when common parts were moved to a separate file. - - Optimized CRC routine (thanks to Reimar Doeffinger). - -* Release 2008-02-16 - - - Removed outdated IAR compatibility stuff (code sections). - - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK(). - - Added optional routine usbMeasureFrameLength() for calibration of the - internal RC oscillator. - -* Release 2008-02-28 - - - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we - start with sending USBPID_DATA0. - - Changed defaults in usbconfig-prototype.h - - Added free USB VID/PID pair for MIDI class devices - - Restructured AVR-USB as separate package, not part of PowerSwitch any more. - -* Release 2008-04-18 - - - Restructured usbdrv.c so that it is easier to read and understand. - - Better code optimization with gcc 4. - - If a second interrupt in endpoint is enabled, also add it to config - descriptor. - - Added config option for long transfers (above 254 bytes), see - USB_CFG_LONG_TRANSFERS in usbconfig.h. - - Added 20 MHz module contributed by Jeroen Benschop. - -* Release 2008-05-13 - - - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length - was not incremented, pointer to length was incremented instead. - - Added code to command line tool(s) which claims an interface. This code - is disabled by default, but may be necessary on newer Linux kernels. - - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". - - New header "usbportability.h" prepares ports to other development - environments. - - Long transfers (above 254 bytes) did not work when usbFunctionRead() was - used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] - - In hiddata.c (example code for sending/receiving data over HID), use - USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so - that we need not claim the interface. - - in usbPoll() loop 20 times polling for RESET state instead of 10 times. - This accounts for the higher clock rates we now support. - - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop. - - Added hook to SOF code so that oscillator can be tuned to USB frame clock. - - Added timeout to waitForJ loop. Helps preventing unexpected hangs. - - Added example code for oscillator tuning to libs-device (thanks to - Henrik Haftmann for the idea to this routine). - - Implemented option USB_CFG_SUPPRESS_INTR_CODE. - -* Release 2008-10-22 - - - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and - similar, not offset of 0x20 needs to be added. - - Allow distribution under GPLv3 for those who have to link against other - code distributed under GPLv3. - -* Release 2008-11-26 - - - Removed libusb-win32 dependency for hid-data example in Makefile.windows. - It was never required and confused many people. - - Added extern uchar usbRxToken to usbdrv.h. - - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser. - -* Release 2009-03-23 - - - Hid-mouse example used settings from hid-data example, fixed that. - - Renamed project to V-USB due to a trademark issue with Atmel(r). - - Changed CommercialLicense.txt and USBID-License.txt to make the - background of USB ID registration clearer. - -* Release 2009-04-15 - - - Changed CommercialLicense.txt to reflect the new range of PIDs from - Jason Kotzin. - - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and - USB-ID-FAQ.txt - - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in - the center between bit 0 and 1 of each byte. This is where the data lines - are expected to change and the sampled data may therefore be nonsense. - We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-. - - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed, - the unstuffing code in the receiver routine was 1 cycle too long. If - multiple bytes had the unstuffing in bit 6, the error summed up until the - receiver was out of sync. - - Included option for faster CRC routine. - Thanks to Slawomir Fras (BoskiDialer) for this code! - - Updated bits in Configuration Descriptor's bmAttributes according to - USB 1.1 (in particular bit 7, it is a must-be-set bit now). - -* Release 2009-08-22 - - - Moved first DBG1() after odDebugInit() in all examples. - - Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes - V-USB compatible with the new "p" suffix devices (e.g. ATMega328p). - - USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any - more). - - New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with - more than 64 kB flash. - - Built-in configuration descriptor allows custom definition for second - endpoint now. - -* Release 2010-07-15 diff --git a/protocol/vusb/usbdrv/CommercialLicense.txt b/protocol/vusb/usbdrv/CommercialLicense.txt deleted file mode 100644 index 11d07d9df0..0000000000 --- a/protocol/vusb/usbdrv/CommercialLicense.txt +++ /dev/null @@ -1,166 +0,0 @@ -V-USB Driver Software License Agreement -Version 2009-08-03 - -THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN -ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING -THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. - - -1 DEFINITIONS - -1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, -Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. - -1.2 "You" shall mean the Licensee. - -1.3 "V-USB" shall mean all files included in the package distributed under -the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) -unless otherwise noted. This includes the firmware-only USB device -implementation for Atmel AVR microcontrollers, some simple device examples -and host side software examples and libraries. - - -2 LICENSE GRANTS - -2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source -code of V-USB. - -2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the -non-exclusive right to use, copy and distribute V-USB with your hardware -product(s), restricted by the limitations in section 3 below. - -2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify -the source code and your copy of V-USB according to your needs. - -2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB -Product ID(s), sent to you in e-mail. These Product IDs are reserved -exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID -ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen -Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from -Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs -have obtained these IDs from the USB Implementers Forum, Inc. -(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might -arise from the assignment of USB IDs. - -2.5 USB Certification. Although not part of this agreement, we want to make -it clear that you cannot become USB certified when you use V-USB or a USB -Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't -meet the electrical specifications required by the USB specification and -the USB Implementers Forum certifies only members who bought a Vendor ID of -their own. - - -3 LICENSE RESTRICTIONS - -3.1 Number of Units. Only one of the following three definitions is -applicable. Which one is determined by the amount you pay to OBJECTIVE -DEVELOPMENT, see section 4 ("Payment") below. - -Hobby License: You may use V-USB according to section 2 above in no more -than 5 hardware units. These units must not be sold for profit. - -Entry Level License: You may use V-USB according to section 2 above in no -more than 150 hardware units. - -Professional License: You may use V-USB according to section 2 above in -any number of hardware units, except for large scale production ("unlimited -fair use"). Quantities below 10,000 units are not considered large scale -production. If your reach quantities which are obviously large scale -production, you must pay a license fee of 0.10 EUR per unit for all units -above 10,000. - -3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber -any copy of V-USB, or any of the rights granted herein. - -3.3 Transfer. You may not transfer your rights under this Agreement to -another party without OBJECTIVE DEVELOPMENT's prior written consent. If -such consent is obtained, you may permanently transfer this License to -another party. The recipient of such transfer must agree to all terms and -conditions of this Agreement. - -3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not -expressly granted. - -3.5 Non-Exclusive Rights. Your license rights under this Agreement are -non-exclusive. - -3.6 Third Party Rights. This Agreement cannot grant you rights controlled -by third parties. In particular, you are not allowed to use the USB logo or -other trademarks owned by the USB Implementers Forum, Inc. without their -consent. Since such consent depends on USB certification, it should be -noted that V-USB will not pass certification because it does not -implement checksum verification and the microcontroller ports do not meet -the electrical specifications. - - -4 PAYMENT - -The payment amount depends on the variation of this agreement (according to -section 3.1) into which you want to enter. Concrete prices are listed on -OBJECTIVE DEVELOPMENT's web site, usually at -http://www.obdev.at/vusb/license.html. You agree to pay the amount listed -there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor -or reseller. - - -5 COPYRIGHT AND OWNERSHIP - -V-USB is protected by copyright laws and international copyright -treaties, as well as other intellectual property laws and treaties. V-USB -is licensed, not sold. - - -6 TERM AND TERMINATION - -6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE -DEVELOPMENT may terminate this Agreement and revoke the granted license and -USB-IDs if you fail to comply with any of its terms and conditions. - -6.2 Survival of Terms. All provisions regarding secrecy, confidentiality -and limitation of liability shall survive termination of this agreement. - - -7 DISCLAIMER OF WARRANTY AND LIABILITY - -LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE -DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND -NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE -TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO -STATE/JURISDICTION. - -LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, -IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY -SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY -LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE -PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE -DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY -CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS -AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. - - -8 MISCELLANEOUS TERMS - -8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing -purposes that you entered into this agreement. - -8.2 Entire Agreement. This document represents the entire agreement between -OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by -an authorized representative of both, OBJECTIVE DEVELOPMENT and you. - -8.3 Severability. In case a provision of these terms and conditions should -be or become partly or entirely invalid, ineffective, or not executable, -the validity of all other provisions shall not be affected. - -8.4 Applicable Law. This agreement is governed by the laws of the Republic -of Austria. - -8.5 Responsible Courts. The responsible courts in Vienna/Austria will have -exclusive jurisdiction regarding all disputes in connection with this -agreement. - diff --git a/protocol/vusb/usbdrv/License.txt b/protocol/vusb/usbdrv/License.txt deleted file mode 100644 index 4460cfbae0..0000000000 --- a/protocol/vusb/usbdrv/License.txt +++ /dev/null @@ -1,361 +0,0 @@ -OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the -terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is -your choice whether you apply the terms of version 2 or version 3. The full -text of GPLv2 is included below. In addition to the requirements in the GPL, -we STRONGLY ENCOURAGE you to do the following: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/protocol/vusb/usbdrv/Readme.txt b/protocol/vusb/usbdrv/Readme.txt deleted file mode 100644 index 970dc66b2f..0000000000 --- a/protocol/vusb/usbdrv/Readme.txt +++ /dev/null @@ -1,172 +0,0 @@ -This is the Readme file to Objective Development's firmware-only USB driver -for Atmel AVR microcontrollers. For more information please visit -http://www.obdev.at/vusb/ - -This directory contains the USB firmware only. Copy it as-is to your own -project and add all .c and .S files to your project (these files are marked -with an asterisk in the list below). Then copy usbconfig-prototype.h as -usbconfig.h to your project and edit it according to your configuration. - - -TECHNICAL DOCUMENTATION -======================= -The technical documentation (API) for the firmware driver is contained in the -file "usbdrv.h". Please read all of it carefully! Configuration options are -documented in "usbconfig-prototype.h". - -The driver consists of the following files: - Readme.txt ............. The file you are currently reading. - Changelog.txt .......... Release notes for all versions of the driver. - usbdrv.h ............... Driver interface definitions and technical docs. -* usbdrv.c ............... High level language part of the driver. Link this - module to your code! -* usbdrvasm.S ............ Assembler part of the driver. This module is mostly - a stub and includes one of the usbdrvasm*.S files - depending on processor clock. Link this module to - your code! - usbdrvasm*.inc ......... Assembler routines for particular clock frequencies. - Included by usbdrvasm.S, don't link it directly! - asmcommon.inc .......... Common assembler routines. Included by - usbdrvasm*.inc, don't link it directly! - usbconfig-prototype.h .. Prototype for your own usbdrv.h file. -* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is - defined to a value greater than 0. Link this module - to your code! - oddebug.h .............. Interface definitions of the debug module. - usbportability.h ....... Header with compiler-dependent stuff. - usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this - module instead of usbdrvasm.S when you assembler - with IAR's tools. - License.txt ............ Open Source license for this driver. - CommercialLicense.txt .. Optional commercial license for this driver. - USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs. - USB-IDs-for-free.txt ... List and terms of use for free shared PIDs. - -(*) ... These files should be linked to your project. - - -CPU CORE CLOCK FREQUENCY -======================== -We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz, -16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The -actual clock rate must be configured in usbconfig.h. - -12 MHz Clock -This is the traditional clock rate of V-USB because it's the lowest clock -rate where the timing constraints of the USB spec can be met. - -15 MHz Clock -Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock -rate allows for some loops which make the resulting code size somewhat smaller -than the 12 MHz version. - -16 MHz Clock -This clock rate has been added for users of the Arduino board and other -ready-made boards which come with a fixed 16 MHz crystal. It's also an option -if you need the slightly higher clock rate for performance reasons. Since -16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -is somewhat tricky and has to insert a leap cycle every third byte. - -12.8 MHz and 16.5 MHz Clock -The assembler modules for these clock rates differ from the other modules -because they have been built for an RC oscillator with only 1% precision. The -receiver code inserts leap cycles to compensate for clock deviations. 1% is -also the precision which can be achieved by calibrating the internal RC -oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL -oscillator can reach 16.5 MHz with the RC oscillator. This includes the very -popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost -all AVRs can reach 12.8 MHz, although this is outside the specified range. - -See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for -code which calibrates the RC oscillator based on the USB frame clock. - -18 MHz Clock -This module is closer to the USB specification because it performs an on the -fly CRC check for incoming packets. Packets with invalid checksum are -discarded as required by the spec. If you also implement checks for data -PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING -in usbconfig.h for more info), this ensures data integrity. Due to the CRC -tables and alignment requirements, this code is bigger than modules for other -clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1 -and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h. - -20 MHz Clock -This module is for people who won't do it with less than the maximum. Since -20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code -uses similar tricks as the 16 MHz module to insert leap cycles. - - -USB IDENTIFIERS -=============== -Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs -are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you -can assign PIDs at will. - -Since an entry level cost of 1,500 USD is too high for most small companies -and hobbyists, we provide some VID/PID pairs for free. See the file -USB-IDs-for-free.txt for details. - -Objective Development also has some license offerings which include product -IDs. See http://www.obdev.at/vusb/ for details. - - -DEVELOPMENT SYSTEM -================== -This driver has been developed and optimized for the GNU compiler version 3 -and 4. We recommend that you use the GNU compiler suite because it is freely -available. V-USB has also been ported to the IAR compiler and assembler. It -has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the -"small" and "tiny" memory model. Not every release is tested with IAR CC and -the driver may therefore fail to compile with IAR. Please note that gcc is -more efficient for usbdrv.c because this module has been deliberately -optimized for gcc. - -Gcc version 3 produces smaller code than version 4 due to new optimizing -capabilities which don't always improve things on 8 bit CPUs. The code size -generated by gcc 4 can be reduced with the compiler options --fno-move-loop-invariants, -fno-tree-scev-cprop and --fno-inline-small-functions in addition to -Os. On devices with more than -8k of flash memory, we also recommend the linker option --relax (written as --Wl,--relax for gcc) to convert absolute calls into relative where possible. - -For more information about optimizing options see: - - http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html - -These optimizations are good for gcc 4.x. Version 3.x of gcc does not support -most of these options and produces good code anyway. - - -USING V-USB FOR FREE -==================== -The AVR firmware driver is published under the GNU General Public License -Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is -your choice whether you apply the terms of version 2 or version 3. - -If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the -following things IN ADDITION to the obligations from the GPL: - -(1) Publish your entire project on a web site and drop us a note with the URL. -Use the form at http://www.obdev.at/vusb/feedback.html for your submission. -If you don't have a web site, you can publish the project in obdev's -documentation wiki at -http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. - -(2) Adhere to minimum publication standards. Please include AT LEAST: - - a circuit diagram in PDF, PNG or GIF format - - full source code for the host software - - a Readme.txt file in ASCII format which describes the purpose of the - project and what can be found in which directories and which files - - a reference to http://www.obdev.at/vusb/ - -(3) If you improve the driver firmware itself, please give us a free license -to your modifications for our commercial license offerings. - - -COMMERCIAL LICENSES FOR V-USB -============================= -If you don't want to publish your source code under the terms of the GPL, -you can simply pay money for V-USB. As an additional benefit you get -USB PIDs for free, reserved exclusively to you. See the file -"CommercialLicense.txt" for details. - diff --git a/protocol/vusb/usbdrv/USB-ID-FAQ.txt b/protocol/vusb/usbdrv/USB-ID-FAQ.txt deleted file mode 100644 index d1de8fb618..0000000000 --- a/protocol/vusb/usbdrv/USB-ID-FAQ.txt +++ /dev/null @@ -1,149 +0,0 @@ -Version 2009-08-22 - -========================== -WHY DO WE NEED THESE IDs? -========================== - -USB is more than a low level protocol for data transport. It also defines a -common set of requests which must be understood by all devices. And as part -of these common requests, the specification defines data structures, the -USB Descriptors, which are used to describe the properties of the device. - -From the perspective of an operating system, it is therefore possible to find -out basic properties of a device (such as e.g. the manufacturer and the name -of the device) without a device-specific driver. This is essential because -the operating system can choose a driver to load based on this information -(Plug-And-Play). - -Among the most important properties in the Device Descriptor are the USB -Vendor- and Product-ID. Both are 16 bit integers. The most simple form of -driver matching is based on these IDs. The driver announces the Vendor- and -Product-IDs of the devices it can handle and the operating system loads the -appropriate driver when the device is connected. - -It is obvious that this technique only works if the pair Vendor- plus -Product-ID is unique: Only devices which require the same driver can have the -same pair of IDs. - - -===================================================== -HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE? -===================================================== - -Since it is so important that USB IDs are unique, the USB Implementers Forum, -Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by -law to build a device and assign it any random numbers as IDs. Usb.org -therefore needs an agreement to regulate the use of USB IDs. The agreement -binds only parties who agreed to it, of course. Everybody else is free to use -any numbers for their IDs. - -So how can usb.org ensure that every manufacturer of USB devices enters into -an agreement with them? They do it via trademark licensing. Usb.org has -registered the trademark "USB", all associated logos and related terms. If -you want to put an USB logo on your product or claim that it is USB -compliant, you must license these trademarks from usb.org. And this is where -you enter into an agreement. See the "USB-IF Trademark License Agreement and -Usage Guidelines for the USB-IF Logo" at -http://www.usb.org/developers/logo_license/. - -Licensing the USB trademarks requires that you buy a USB Vendor-ID from -usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org -(yearly fee of ca. 4,000 USD) and that you meet all the technical -specifications from the USB spec. - -This means that most hobbyists and small companies will never be able to -become USB compliant, just because membership is so expensive. And you can't -be compliant with a driver based on V-USB anyway, because the AVR's port pins -don't meet the electrical specifications for USB. So, in principle, all -hobbyists and small companies are free to choose any random numbers for their -IDs. They have nothing to lose... - -There is one exception worth noting, though: If you use a sub-component which -implements USB, the vendor of the sub-components may guarantee USB -compliance. This might apply to some or all of FTDI's solutions. - - -======================================================================= -WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS? -======================================================================= - -You have learned in the previous section that you are free to choose any -numbers for your IDs anyway. So why not do exactly this? There is still the -technical issue. If you choose IDs which are already in use by somebody else, -operating systems will load the wrong drivers and your device won't work. -Even if you choose IDs which are not currently in use, they may be in use in -the next version of the operating system or even after an automatic update. - -So what you need is a pair of Vendor- and Product-IDs for which you have the -guarantee that no USB compliant product uses them. This implies that no -operating system will ever ship with drivers responsible for these IDs. - - -============================================== -HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs? -============================================== - -Objective Development gives away pairs of USB-IDs with their V-USB licenses. -In order to ensure that these IDs are unique, Objective Development has an -agreement with the company/person who has bought the USB Vendor-ID from -usb.org. This agreement ensures that a range of USB Product-IDs is reserved -for assignment by Objective Development and that the owner of the Vendor-ID -won't give it to anybody else. - -This means that you have to trust three parties to ensure uniqueness of -your IDs: - - - Objective Development, that they don't give the same PID to more than - one person. - - The owner of the Vendor-ID that they don't assign PIDs from the range - assigned to Objective Development to anybody else. - - Usb.org that they don't assign the same Vendor-ID a second time. - - -================================== -WHO IS THE OWNER OF THE VENDOR-ID? -================================== - -Objective Development has obtained ranges of USB Product-IDs under two -Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen -Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason -Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their -Vendor-ID directly from usb.org. - - -========================================================================= -CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE? -========================================================================= - -The short answer is: Yes. All you get is a guarantee that the IDs are never -assigned to anybody else. What more do you need? - - -============================ -WHAT ABOUT SHARED ID PAIRS? -============================ - -Objective Development has reserved some PID/VID pairs for shared use. You -have no guarantee of uniqueness for them, except that no USB compliant device -uses them. In order to avoid technical problems, we must ensure that all -devices with the same pair of IDs use the same driver on kernel level. For -details, see the file USB-IDs-for-free.txt. - - -====================================================== -I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL? -====================================================== - -A 16 bit integer number cannot be protected by copyright laws. It is not -sufficiently complex. And since none of the parties involved entered into the -USB-IF Trademark License Agreement, we are not bound by this agreement. So -there is no reason why it should be illegal to sub-license USB-IDs. - - -============================================= -WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES? -============================================= - -Objective Development disclaims all liabilities which might arise from the -assignment of IDs. If you guarantee product features to your customers -without proper disclaimer, YOU are liable for that. diff --git a/protocol/vusb/usbdrv/USB-IDs-for-free.txt b/protocol/vusb/usbdrv/USB-IDs-for-free.txt deleted file mode 100644 index 2f4d59ad18..0000000000 --- a/protocol/vusb/usbdrv/USB-IDs-for-free.txt +++ /dev/null @@ -1,148 +0,0 @@ -Version 2009-08-22 - -=========================== -FREE USB-IDs FOR SHARED USE -=========================== - -Objective Development has reserved a set of USB Product-IDs for use according -to the guidelines outlined below. For more information about the concept of -USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees -that the IDs listed below are not used by any USB compliant devices. - - -==================== -MECHANISM OF SHARING -==================== - -From a technical point of view, two different devices can share the same USB -Vendor- and Product-ID if they require the same driver on operating system -level. We make use of this fact by assigning separate IDs for various device -classes. On application layer, devices must be distinguished by their textual -name or serial number. We offer separate sets of IDs for discrimination by -textual name and for serial number. - -Examples for shared use of USB IDs are included with V-USB in the "examples" -subdirectory. - - -====================================== -IDs FOR DISCRIMINATION BY TEXTUAL NAME -====================================== - -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 manufacturer -and product identification. The manufacturer identification MUST be available -at least in USB language 0x0409 (English/US). - -(2) The textual manufacturer identification MUST contain either an Internet -domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail -address under your control (e.g. "myname@gmx.net"). You can embed the domain -name or e-mail address in any string you like, e.g. "Objective Development -http://www.obdev.at/vusb/". - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(4) You may choose any string for the textual product identification, as long -as this string is unique within the scope of your textual manufacturer -identification. - -(5) Application side device look-up MUST be based on the textual manufacturer -and product identification in addition to VID/PID matching. The driver -matching MUST be a comparison of the entire strings, NOT a sub-string match. - -(6) For devices which implement a particular USB device class (e.g. HID), the -operating system's default class driver MUST be used. If an operating system -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/). - -Table if IDs for discrimination by textual name: - -PID dec (hex) | VID dec (hex) | Description of use -==============+===============+============================================ -1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb ---------------+---------------+-------------------------------------------- -1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are - | | NOT mice, keyboards or joysticks) ---------------+---------------+-------------------------------------------- -1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems) ---------------+---------------+-------------------------------------------- -1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices ---------------+---------------+-------------------------------------------- - -Note that Windows caches the textual product- and vendor-description for -mice, keyboards and joysticks. Name-bsed discrimination is therefore not -recommended for these device classes. - - -======================================= -IDs FOR DISCRIMINATION BY SERIAL NUMBER -======================================= - -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). - -(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 -control (e.g. "myname@gmx.net"), both terminated with a colon (":") character. -You MAY append any string you like for further discrimination of your devices. - -(3) You are responsible for retaining ownership of the domain or e-mail -address for as long as any of your products are in use. - -(5) Application side device look-up MUST be based on the serial number string -in addition to VID/PID matching. The matching must start at the first -character of the serial number string and include the colon character -terminating your domain or e-mail address. It MAY stop anywhere after that. - -(6) For devices which implement a particular USB device class (e.g. HID), the -operating system's default class driver MUST be used. If an operating system -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/). - -Table if IDs for discrimination by serial number string: - -PID dec (hex) | VID dec (hex) | Description of use -===============+===============+=========================================== -10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb ----------------+---------------+------------------------------------------- -10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are - | | NOT mice, keyboards or joysticks) ----------------+---------------+------------------------------------------- -10202 (0x27da) | 5824 (0x16c0) | For USB Mice ----------------+---------------+------------------------------------------- -10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards ----------------+---------------+------------------------------------------- -10204 (0x27db) | 5824 (0x16c0) | For USB Joysticks ----------------+---------------+------------------------------------------- -10205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems) ----------------+---------------+------------------------------------------- -10206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices ----------------+---------------+------------------------------------------- - - -================= -ORIGIN OF USB-IDs -================= - -OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed -here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition. -Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc. -(see www.usb.org). The VID is registered for the company name "Van Ooijen -Technische Informatica". - - -========== -DISCLAIMER -========== - -OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any -problems which are caused by the shared use of these VID/PID pairs. diff --git a/protocol/vusb/usbdrv/asmcommon.inc b/protocol/vusb/usbdrv/asmcommon.inc deleted file mode 100644 index 07d692be3b..0000000000 --- a/protocol/vusb/usbdrv/asmcommon.inc +++ /dev/null @@ -1,188 +0,0 @@ -/* Name: asmcommon.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-11-05 - * 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$ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file contains assembler code which is shared among the USB driver -implementations for different CPU cocks. Since the code must be inserted -in the middle of the module, it's split out into this file and #included. - -Jump destinations called from outside: - sofError: Called when no start sequence was found. - se0: Called when a package has been successfully received. - overflow: Called when receive buffer overflows. - doReturn: Called after sending data. - -Outside jump destinations used by this module: - waitForJ: Called to receive an already arriving packet. - sendAckAndReti: - sendNakAndReti: - sendCntAndReti: - usbSendAndReti: - -The following macros must be defined before this file is included: - .macro POP_STANDARD - .endm - .macro POP_RETI - .endm -*/ - -#define token x1 - -overflow: - ldi x2, 1< 0 - -#warning "Never compile production devices with debugging enabled" - -static void uartPutc(char c) -{ - while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ - ODDBG_UDR = c; -} - -static uchar hexAscii(uchar h) -{ - h &= 0xf; - if(h >= 10) - h += 'a' - (uchar)10 - '0'; - h += '0'; - return h; -} - -static void printHex(uchar c) -{ - uartPutc(hexAscii(c >> 4)); - uartPutc(hexAscii(c)); -} - -void odDebug(uchar prefix, uchar *data, uchar len) -{ - printHex(prefix); - uartPutc(':'); - while(len--){ - uartPutc(' '); - printHex(*data++); - } - uartPutc('\r'); - uartPutc('\n'); -} - -#endif diff --git a/protocol/vusb/usbdrv/oddebug.h b/protocol/vusb/usbdrv/oddebug.h deleted file mode 100644 index d61309daac..0000000000 --- a/protocol/vusb/usbdrv/oddebug.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Name: oddebug.h - * Project: AVR library - * Author: Christian Starkjohann - * Creation Date: 2005-01-16 - * 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 $ - */ - -#ifndef __oddebug_h_included__ -#define __oddebug_h_included__ - -/* -General Description: -This module implements a function for debug logs on the serial line of the -AVR microcontroller. Debugging can be configured with the define -'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging -calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is -2, DBG1 and DBG2 logs will be printed. - -A debug log consists of a label ('prefix') to indicate which debug log created -the output and a memory block to dump in hex ('data' and 'len'). -*/ - - -#ifndef F_CPU -# define F_CPU 12000000 /* 12 MHz */ -#endif - -/* make sure we have the UART defines: */ -#include "usbportability.h" - -#ifndef uchar -# define uchar unsigned char -#endif - -#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ -# warning "Debugging disabled because device has no UART" -# undef DEBUG_LEVEL -#endif - -#ifndef DEBUG_LEVEL -# define DEBUG_LEVEL 0 -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -# define DBG1(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG1(prefix, data, len) -#endif - -#if DEBUG_LEVEL > 1 -# define DBG2(prefix, data, len) odDebug(prefix, data, len) -#else -# define DBG2(prefix, data, len) -#endif - -/* ------------------------------------------------------------------------- */ - -#if DEBUG_LEVEL > 0 -extern void odDebug(uchar prefix, uchar *data, uchar len); - -/* Try to find our control registers; ATMEL likes to rename these */ - -#if defined UBRR -# define ODDBG_UBRR UBRR -#elif defined UBRRL -# define ODDBG_UBRR UBRRL -#elif defined UBRR0 -# define ODDBG_UBRR UBRR0 -#elif defined UBRR0L -# define ODDBG_UBRR UBRR0L -#endif - -#if defined UCR -# define ODDBG_UCR UCR -#elif defined UCSRB -# define ODDBG_UCR UCSRB -#elif defined UCSR0B -# define ODDBG_UCR UCSR0B -#endif - -#if defined TXEN -# define ODDBG_TXEN TXEN -#else -# define ODDBG_TXEN TXEN0 -#endif - -#if defined USR -# define ODDBG_USR USR -#elif defined UCSRA -# define ODDBG_USR UCSRA -#elif defined UCSR0A -# define ODDBG_USR UCSR0A -#endif - -#if defined UDRE -# define ODDBG_UDRE UDRE -#else -# define ODDBG_UDRE UDRE0 -#endif - -#if defined UDR -# define ODDBG_UDR UDR -#elif defined UDR0 -# define ODDBG_UDR UDR0 -#endif - -static inline void odDebugInit(void) -{ - ODDBG_UCR |= (1<len & 0x10){ /* packet buffer was empty */ - txStatus->buffer[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ - }else{ - txStatus->len = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ - } - p = txStatus->buffer + 1; - i = len; - do{ /* if len == 0, we still copy 1 byte, but that's no problem */ - *p++ = *data++; - }while(--i > 0); /* loop control at the end is 2 bytes shorter than at beginning */ - usbCrc16Append(&txStatus->buffer[1], len); - txStatus->len = len + 4; /* len must be given including sync byte */ - DBG2(0x21 + (((int)txStatus >> 3) & 3), txStatus->buffer, len + 3); -} - -USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) -{ - usbGenericSetInterrupt(data, len, &usbTxStatus1); -} -#endif - -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 -USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) -{ - usbGenericSetInterrupt(data, len, &usbTxStatus3); -} -#endif -#endif /* USB_CFG_SUPPRESS_INTR_CODE */ - -/* ------------------ utilities for code following below ------------------- */ - -/* Use defines for the switch statement so that we can choose between an - * if()else if() and a switch/case based implementation. switch() is more - * efficient for a LARGE set of sequential choices, if() is better in all other - * cases. - */ -#if USB_CFG_USE_SWITCH_STATEMENT -# define SWITCH_START(cmd) switch(cmd){{ -# define SWITCH_CASE(value) }break; case (value):{ -# define SWITCH_CASE2(v1,v2) }break; case (v1): case(v2):{ -# define SWITCH_CASE3(v1,v2,v3) }break; case (v1): case(v2): case(v3):{ -# define SWITCH_DEFAULT }break; default:{ -# define SWITCH_END }} -#else -# define SWITCH_START(cmd) {uchar _cmd = cmd; if(0){ -# define SWITCH_CASE(value) }else if(_cmd == (value)){ -# define SWITCH_CASE2(v1,v2) }else if(_cmd == (v1) || _cmd == (v2)){ -# define SWITCH_CASE3(v1,v2,v3) }else if(_cmd == (v1) || _cmd == (v2) || (_cmd == v3)){ -# define SWITCH_DEFAULT }else{ -# define SWITCH_END }} -#endif - -#ifndef USB_RX_USER_HOOK -#define USB_RX_USER_HOOK(data, len) -#endif -#ifndef USB_SET_ADDRESS_HOOK -#define USB_SET_ADDRESS_HOOK() -#endif - -/* ------------------------------------------------------------------------- */ - -/* We use if() instead of #if in the macro below because #if can't be used - * in macros and the compiler optimizes constant conditions anyway. - * This may cause problems with undefined symbols if compiled without - * optimizing! - */ -#define GET_DESCRIPTOR(cfgProp, staticName) \ - if(cfgProp){ \ - if((cfgProp) & USB_PROP_IS_RAM) \ - flags = 0; \ - if((cfgProp) & USB_PROP_IS_DYNAMIC){ \ - len = usbFunctionDescriptor(rq); \ - }else{ \ - len = USB_PROP_LENGTH(cfgProp); \ - usbMsgPtr = (uchar *)(staticName); \ - } \ - } - -/* usbDriverDescriptor() is similar to usbFunctionDescriptor(), but used - * internally for all types of descriptors. - */ -static inline usbMsgLen_t usbDriverDescriptor(usbRequest_t *rq) -{ -usbMsgLen_t len = 0; -uchar flags = USB_FLG_MSGPTR_IS_ROM; - - SWITCH_START(rq->wValue.bytes[1]) - SWITCH_CASE(USBDESCR_DEVICE) /* 1 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice) - SWITCH_CASE(USBDESCR_CONFIG) /* 2 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration) - SWITCH_CASE(USBDESCR_STRING) /* 3 */ -#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC - if(USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) - flags = 0; - len = usbFunctionDescriptor(rq); -#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ - SWITCH_START(rq->wValue.bytes[0]) - SWITCH_CASE(0) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0) - SWITCH_CASE(1) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor) - SWITCH_CASE(2) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice) - SWITCH_CASE(3) - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber) - SWITCH_DEFAULT - if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - len = usbFunctionDescriptor(rq); - } - SWITCH_END -#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ -#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */ - SWITCH_CASE(USBDESCR_HID) /* 0x21 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18) - SWITCH_CASE(USBDESCR_HID_REPORT)/* 0x22 */ - GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport) -#endif - SWITCH_DEFAULT - if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ - len = usbFunctionDescriptor(rq); - } - SWITCH_END - usbMsgFlags = flags; - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbDriverSetup() is similar to usbFunctionSetup(), but it's used for - * standard requests instead of class and custom requests. - */ -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 */ -uchar value = rq->wValue.bytes[0]; -#if USB_CFG_IMPLEMENT_HALT -uchar index = rq->wIndex.bytes[0]; -#endif - - dataPtr[0] = 0; /* default reply common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */ - SWITCH_START(rq->bRequest) - SWITCH_CASE(USBRQ_GET_STATUS) /* 0 */ - uchar recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */ - if(USB_CFG_IS_SELF_POWERED && recipient == USBRQ_RCPT_DEVICE) - dataPtr[0] = USB_CFG_IS_SELF_POWERED; -#if USB_CFG_IMPLEMENT_HALT - if(recipient == USBRQ_RCPT_ENDPOINT && index == 0x81) /* request status for endpoint 1 */ - dataPtr[0] = usbTxLen1 == USBPID_STALL; -#endif - dataPtr[1] = 0; - len = 2; -#if USB_CFG_IMPLEMENT_HALT - SWITCH_CASE2(USBRQ_CLEAR_FEATURE, USBRQ_SET_FEATURE) /* 1, 3 */ - if(value == 0 && index == 0x81){ /* feature 0 == HALT for endpoint == 1 */ - usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL; - usbResetDataToggling(); - } -#endif - SWITCH_CASE(USBRQ_SET_ADDRESS) /* 5 */ - usbNewDeviceAddr = value; - USB_SET_ADDRESS_HOOK(); - SWITCH_CASE(USBRQ_GET_DESCRIPTOR) /* 6 */ - len = usbDriverDescriptor(rq); - goto skipMsgPtrAssignment; - SWITCH_CASE(USBRQ_GET_CONFIGURATION) /* 8 */ - dataPtr = &usbConfiguration; /* send current configuration value */ - len = 1; - SWITCH_CASE(USBRQ_SET_CONFIGURATION) /* 9 */ - usbConfiguration = value; - usbResetStall(); - SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */ - len = 1; -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */ - usbResetDataToggling(); - usbResetStall(); -#endif - SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */ - /* Should we add an optional hook here? */ - SWITCH_END - usbMsgPtr = dataPtr; -skipMsgPtrAssignment: - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbProcessRx() is called for every message received by the interrupt - * routine. It distinguishes between SETUP and DATA packets and processes - * them accordingly. - */ -static inline void usbProcessRx(uchar *data, uchar len) -{ -usbRequest_t *rq = (void *)data; - -/* usbRxToken can be: - * 0x2d 00101101 (USBPID_SETUP for setup data) - * 0xe1 11100001 (USBPID_OUT: data phase of setup transfer) - * 0...0x0f for OUT on endpoint X - */ - DBG2(0x10 + (usbRxToken & 0xf), data, len + 2); /* SETUP=1d, SETUP-DATA=11, OUTx=1x */ - USB_RX_USER_HOOK(data, len) -#if USB_CFG_IMPLEMENT_FN_WRITEOUT - if(usbRxToken < 0x10){ /* OUT to endpoint != 0: endpoint number in usbRxToken */ - usbFunctionWriteOut(data, len); - return; - } -#endif - if(usbRxToken == (uchar)USBPID_SETUP){ - if(len != 8) /* Setup size must be always 8 bytes. Ignore otherwise. */ - return; - usbMsgLen_t replyLen; - usbTxBuf[0] = USBPID_DATA0; /* initialize data toggling */ - usbTxLen = USBPID_NAK; /* abort pending transmit */ - usbMsgFlags = 0; - uchar type = rq->bmRequestType & USBRQ_TYPE_MASK; - if(type != USBRQ_TYPE_STANDARD){ /* standard requests are handled by driver */ - replyLen = usbFunctionSetup(data); - }else{ - replyLen = usbDriverSetup(rq); - } -#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE - if(replyLen == USB_NO_MSG){ /* use user-supplied read/write function */ - /* do some conditioning on replyLen, but on IN transfers only */ - if((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE){ - if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ - replyLen = rq->wLength.bytes[0]; - }else{ - replyLen = rq->wLength.word; - } - } - usbMsgFlags = USB_FLG_USE_USER_RW; - }else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */ -#endif - if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ - if(!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */ - replyLen = rq->wLength.bytes[0]; - }else{ - if(replyLen > rq->wLength.word) /* limit length to max */ - replyLen = rq->wLength.word; - } - usbMsgLen = replyLen; - }else{ /* usbRxToken must be USBPID_OUT, which means data phase of setup (control-out) */ -#if USB_CFG_IMPLEMENT_FN_WRITE - if(usbMsgFlags & USB_FLG_USE_USER_RW){ - uchar rval = usbFunctionWrite(data, len); - if(rval == 0xff){ /* an error occurred */ - usbTxLen = USBPID_STALL; - }else if(rval != 0){ /* This was the final package */ - usbMsgLen = 0; /* answer with a zero-sized data packet */ - } - } -#endif - } -} - -/* ------------------------------------------------------------------------- */ - -/* This function is similar to usbFunctionRead(), but it's also called for - * data handled automatically by the driver (e.g. descriptor reads). - */ -static uchar usbDeviceRead(uchar *data, uchar len) -{ - if(len > 0){ /* don't bother app with 0 sized reads */ -#if USB_CFG_IMPLEMENT_FN_READ - if(usbMsgFlags & USB_FLG_USE_USER_RW){ - len = usbFunctionRead(data, len); - }else -#endif - { - uchar i = len, *r = usbMsgPtr; - if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){ /* ROM data */ - do{ - uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */ - *data++ = c; - r++; - }while(--i); - }else{ /* RAM data */ - do{ - *data++ = *r++; - }while(--i); - } - usbMsgPtr = r; - } - } - return len; -} - -/* ------------------------------------------------------------------------- */ - -/* usbBuildTxBlock() is called when we have data to transmit and the - * interrupt routine's transmit buffer is empty. - */ -static inline void usbBuildTxBlock(void) -{ -usbMsgLen_t wantLen; -uchar len; - - wantLen = usbMsgLen; - if(wantLen > 8) - wantLen = 8; - usbMsgLen -= wantLen; - usbTxBuf[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* DATA toggling */ - len = usbDeviceRead(usbTxBuf + 1, wantLen); - if(len <= 8){ /* valid data packet */ - usbCrc16Append(&usbTxBuf[1], len); - len += 4; /* length including sync byte */ - if(len < 12) /* a partial package identifies end of message */ - usbMsgLen = USB_NO_MSG; - }else{ - len = USBPID_STALL; /* stall the endpoint */ - usbMsgLen = USB_NO_MSG; - } - usbTxLen = len; - DBG2(0x20, usbTxBuf, len-1); -} - -/* ------------------------------------------------------------------------- */ - -static inline void usbHandleResetHook(uchar notResetState) -{ -#ifdef USB_RESET_HOOK -static uchar wasReset; -uchar isReset = !notResetState; - - if(wasReset != isReset){ - USB_RESET_HOOK(isReset); - wasReset = isReset; - } -#endif -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbPoll(void) -{ -schar len; -uchar i; - - len = usbRxLen - 3; - if(len >= 0){ -/* We could check CRC16 here -- but ACK has already been sent anyway. If you - * need data integrity checks with this driver, check the CRC in your app - * code and report errors back to the host. Since the ACK was already sent, - * retries must be handled on application level. - * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); - */ - usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len); -#if USB_CFG_HAVE_FLOWCONTROL - if(usbRxLen > 0) /* only mark as available if not inactivated */ - usbRxLen = 0; -#else - usbRxLen = 0; /* mark rx buffer as available */ -#endif - } - if(usbTxLen & 0x10){ /* transmit system idle */ - if(usbMsgLen != USB_NO_MSG){ /* transmit data pending? */ - usbBuildTxBlock(); - } - } - for(i = 20; i > 0; i--){ - uchar usbLineStatus = USBIN & USBMASK; - if(usbLineStatus != 0) /* SE0 has ended */ - goto isNotReset; - } - /* RESET condition, called multiple times during reset */ - usbNewDeviceAddr = 0; - usbDeviceAddr = 0; - usbResetStall(); - DBG1(0xff, 0, 0); -isNotReset: - usbHandleResetHook(i); -} - -/* ------------------------------------------------------------------------- */ - -USB_PUBLIC void usbInit(void) -{ -#if USB_INTR_CFG_SET != 0 - USB_INTR_CFG |= USB_INTR_CFG_SET; -#endif -#if USB_INTR_CFG_CLR != 0 - USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); -#endif - USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); - usbResetDataToggling(); -#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE - usbTxLen1 = USBPID_NAK; -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbTxLen3 = USBPID_NAK; -#endif -#endif -} - -/* ------------------------------------------------------------------------- */ diff --git a/protocol/vusb/usbdrv/usbdrv.h b/protocol/vusb/usbdrv/usbdrv.h deleted file mode 100644 index 42fe163720..0000000000 --- a/protocol/vusb/usbdrv/usbdrv.h +++ /dev/null @@ -1,735 +0,0 @@ -/* 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/protocol/vusb/usbdrv/usbdrvasm.S b/protocol/vusb/usbdrv/usbdrvasm.S deleted file mode 100644 index 45fcf18315..0000000000 --- a/protocol/vusb/usbdrv/usbdrvasm.S +++ /dev/null @@ -1,393 +0,0 @@ -/* Name: usbdrvasm.S - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2007-06-13 - * 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 $ - */ - -/* -General Description: -This module is the assembler part of the USB driver. This file contains -general code (preprocessor acrobatics and CRC computation) and then includes -the file appropriate for the given clock rate. -*/ - -#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */ -#include "usbportability.h" -#include "usbdrv.h" /* for common defs */ - -/* register names */ -#define x1 r16 -#define x2 r17 -#define shift r18 -#define cnt r19 -#define x3 r20 -#define x4 r21 -#define x5 r22 -#define bitcnt x5 -#define phase x4 -#define leap x4 - -/* Some assembler dependent definitions and declarations: */ - -#ifdef __IAR_SYSTEMS_ASM__ - extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset - extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen - extern usbTxBuf, usbTxStatus1, usbTxStatus3 -# if USB_COUNT_SOF - extern usbSofCount -# endif - public usbCrc16 - public usbCrc16Append - - COMMON INTVEC -# ifndef USB_INTR_VECTOR - ORG INT0_vect -# else /* USB_INTR_VECTOR */ - ORG USB_INTR_VECTOR -# undef USB_INTR_VECTOR -# endif /* USB_INTR_VECTOR */ -# define USB_INTR_VECTOR usbInterruptHandler - rjmp USB_INTR_VECTOR - RSEG CODE - -#else /* __IAR_SYSTEMS_ASM__ */ - -# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */ -# ifdef INT0_vect -# define USB_INTR_VECTOR INT0_vect // this is the "new" define for the vector -# else -# define USB_INTR_VECTOR SIG_INTERRUPT0 // this is the "old" vector -# endif -# endif - .text - .global USB_INTR_VECTOR - .type USB_INTR_VECTOR, @function - .global usbCrc16 - .global usbCrc16Append -#endif /* __IAR_SYSTEMS_ASM__ */ - - -#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */ -# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg -#else /* It's a memory address, use lds and sts */ -# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING -# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg -#endif - -#define usbTxLen1 usbTxStatus1 -#define usbTxBuf1 (usbTxStatus1 + 1) -#define usbTxLen3 usbTxStatus3 -#define usbTxBuf3 (usbTxStatus3 + 1) - - -;---------------------------------------------------------------------------- -; Utility functions -;---------------------------------------------------------------------------- - -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbCrc16 on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -RTMODEL "__rt_version", "3" -/* The line above will generate an error if cc calling conventions change. - * The value "3" above is valid for IAR 4.10B/W32 - */ -# define argLen r18 /* argument 2 */ -# define argPtrL r16 /* argument 1 */ -# define argPtrH r17 /* argument 1 */ - -# define resCrcL r16 /* result */ -# define resCrcH r17 /* result */ - -# define ptrL ZL -# define ptrH ZH -# define ptr Z -# define byte r22 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbCrc16 on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define argLen r22 /* argument 2 */ -# define argPtrL r24 /* argument 1 */ -# define argPtrH r25 /* argument 1 */ - -# define resCrcL r24 /* result */ -# define resCrcH r25 /* result */ - -# define ptrL XL -# define ptrH XH -# define ptr x -# define byte r18 -# define bitCnt r19 -# define polyL r20 -# define polyH r21 -# define scratch r23 - -#endif - -#if USB_USE_FAST_CRC - -; This implementation is faster, but has bigger code size -; Thanks to Slawomir Fras (BoskiDialer) for this code! -; It implements the following C pseudo-code: -; unsigned table(unsigned char x) -; { -; unsigned value; -; -; value = (unsigned)x << 6; -; value ^= (unsigned)x << 7; -; if(parity(x)) -; value ^= 0xc001; -; return value; -; } -; unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen) -; { -; unsigned crc = 0xffff; -; -; while(argLen--) -; crc = table(lo8(crc) ^ *argPtr++) ^ hi8(crc); -; return ~crc; -; } - -; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen); -; argPtr r24+25 / r16+r17 -; argLen r22 / r18 -; temp variables: -; byte r18 / r22 -; scratch r23 -; resCrc r24+r25 / r16+r17 -; ptr X / Z -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0xFF - ldi resCrcH, 0xFF - rjmp usbCrc16LoopTest -usbCrc16ByteLoop: - ld byte, ptr+ - eor resCrcL, byte ; resCrcL is now 'x' in table() - mov byte, resCrcL ; compute parity of 'x' - swap byte - eor byte, resCrcL - mov scratch, byte - lsr byte - lsr byte - eor byte, scratch - inc byte - lsr byte - andi byte, 1 ; byte is now parity(x) - mov scratch, resCrcL - mov resCrcL, resCrcH - eor resCrcL, byte ; low byte of if(parity(x)) value ^= 0xc001; - neg byte - andi byte, 0xc0 - mov resCrcH, byte ; high byte of if(parity(x)) value ^= 0xc001; - clr byte - lsr scratch - ror byte - eor resCrcH, scratch - eor resCrcL, byte - lsr scratch - ror byte - eor resCrcH, scratch - eor resCrcL, byte -usbCrc16LoopTest: - subi argLen, 1 - brsh usbCrc16ByteLoop - com resCrcL - com resCrcH - ret - -#else /* USB_USE_FAST_CRC */ - -; This implementation is slower, but has less code size -; -; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen); -; argPtr r24+25 / r16+r17 -; argLen r22 / r18 -; temp variables: -; byte r18 / r22 -; bitCnt r19 -; poly r20+r21 -; scratch r23 -; resCrc r24+r25 / r16+r17 -; ptr X / Z -usbCrc16: - mov ptrL, argPtrL - mov ptrH, argPtrH - ldi resCrcL, 0 - ldi resCrcH, 0 - ldi polyL, lo8(0xa001) - ldi polyH, hi8(0xa001) - com argLen ; argLen = -argLen - 1: modified loop to ensure that carry is set - ldi bitCnt, 0 ; loop counter with starnd condition = end condition - rjmp usbCrcLoopEntry -usbCrcByteLoop: - ld byte, ptr+ - eor resCrcL, byte -usbCrcBitLoop: - ror resCrcH ; carry is always set here (see brcs jumps to here) - ror resCrcL - brcs usbCrcNoXor - eor resCrcL, polyL - eor resCrcH, polyH -usbCrcNoXor: - subi bitCnt, 224 ; (8 * 224) % 256 = 0; this loop iterates 8 times - brcs usbCrcBitLoop -usbCrcLoopEntry: - subi argLen, -1 - brcs usbCrcByteLoop -usbCrcReady: - ret -; Thanks to Reimar Doeffinger for optimizing this CRC routine! - -#endif /* USB_USE_FAST_CRC */ - -; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len); -usbCrc16Append: - rcall usbCrc16 - st ptr+, resCrcL - st ptr+, resCrcH - ret - -#undef argLen -#undef argPtrL -#undef argPtrH -#undef resCrcL -#undef resCrcH -#undef ptrL -#undef ptrH -#undef ptr -#undef byte -#undef bitCnt -#undef polyL -#undef polyH -#undef scratch - - -#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH -#ifdef __IAR_SYSTEMS_ASM__ -/* Register assignments for usbMeasureFrameLength on IAR cc */ -/* Calling conventions on IAR: - * First parameter passed in r16/r17, second in r18/r19 and so on. - * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) - * Result is passed in r16/r17 - * In case of the "tiny" memory model, pointers are only 8 bit with no - * padding. We therefore pass argument 1 as "16 bit unsigned". - */ -# define resL r16 -# define resH r17 -# define cnt16L r30 -# define cnt16H r31 -# define cntH r18 - -#else /* __IAR_SYSTEMS_ASM__ */ -/* Register assignments for usbMeasureFrameLength on gcc */ -/* Calling conventions on gcc: - * First parameter passed in r24/r25, second in r22/23 and so on. - * Callee must preserve r1-r17, r28/r29 - * Result is passed in r24/r25 - */ -# define resL r24 -# define resH r25 -# define cnt16L r24 -# define cnt16H r25 -# define cntH r26 -#endif -# define cnt16 cnt16L - -; extern unsigned usbMeasurePacketLength(void); -; returns time between two idle strobes in multiples of 7 CPU clocks -.global usbMeasureFrameLength -usbMeasureFrameLength: - ldi cntH, 6 ; wait ~ 10 ms for D- == 0 - clr cnt16L - clr cnt16H -usbMFTime16: - dec cntH - breq usbMFTimeout -usbMFWaitStrobe: ; first wait for D- == 0 (idle strobe) - sbiw cnt16, 1 ;[0] [6] - breq usbMFTime16 ;[2] - sbic USBIN, USBMINUS ;[3] - rjmp usbMFWaitStrobe ;[4] -usbMFWaitIdle: ; then wait until idle again - sbis USBIN, USBMINUS ;1 wait for D- == 1 - rjmp usbMFWaitIdle ;2 - ldi cnt16L, 1 ;1 represents cycles so far - clr cnt16H ;1 -usbMFWaitLoop: - in cntH, USBIN ;[0] [7] - adiw cnt16, 1 ;[1] - breq usbMFTimeout ;[3] - andi cntH, USBMASK ;[4] - brne usbMFWaitLoop ;[5] -usbMFTimeout: -#if resL != cnt16L - mov resL, cnt16L - mov resH, cnt16H -#endif - ret - -#undef resL -#undef resH -#undef cnt16 -#undef cnt16L -#undef cnt16H -#undef cntH - -#endif /* USB_CFG_HAVE_MEASURE_FRAME_LENGTH */ - -;---------------------------------------------------------------------------- -; Now include the clock rate specific code -;---------------------------------------------------------------------------- - -#ifndef USB_CFG_CLOCK_KHZ -# ifdef F_CPU -# define USB_CFG_CLOCK_KHZ (F_CPU/1000) -# else -# error "USB_CFG_CLOCK_KHZ not defined in usbconfig.h and no F_CPU set!" -# endif -#endif - -#if USB_CFG_CHECK_CRC /* separate dispatcher for CRC type modules */ -# if USB_CFG_CLOCK_KHZ == 18000 -# include "usbdrvasm18-crc.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported crc-rates!" -# endif -#else /* USB_CFG_CHECK_CRC */ -# if USB_CFG_CLOCK_KHZ == 12000 -# include "usbdrvasm12.inc" -# elif USB_CFG_CLOCK_KHZ == 12800 -# include "usbdrvasm128.inc" -# elif USB_CFG_CLOCK_KHZ == 15000 -# include "usbdrvasm15.inc" -# elif USB_CFG_CLOCK_KHZ == 16000 -# include "usbdrvasm16.inc" -# elif USB_CFG_CLOCK_KHZ == 16500 -# include "usbdrvasm165.inc" -# elif USB_CFG_CLOCK_KHZ == 20000 -# include "usbdrvasm20.inc" -# else -# error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" -# endif -#endif /* USB_CFG_CHECK_CRC */ diff --git a/protocol/vusb/usbdrv/usbdrvasm.asm b/protocol/vusb/usbdrv/usbdrvasm.asm deleted file mode 100644 index 9cc4e4d739..0000000000 --- a/protocol/vusb/usbdrv/usbdrvasm.asm +++ /dev/null @@ -1,21 +0,0 @@ -/* Name: usbdrvasm.asm - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Christian Starkjohann - * Creation Date: 2006-03-01 - * Tabsize: 4 - * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH - * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) - * This Revision: $Id$ - */ - -/* -General Description: -The IAR compiler/assembler system prefers assembler files with file extension -".asm". We simply provide this file as an alias for usbdrvasm.S. - -Thanks to Oleg Semyonov for his help with the IAR tools port! -*/ - -#include "usbdrvasm.S" - -end diff --git a/protocol/vusb/usbdrv/usbdrvasm12.inc b/protocol/vusb/usbdrv/usbdrvasm12.inc deleted file mode 100644 index c1167584cb..0000000000 --- a/protocol/vusb/usbdrv/usbdrvasm12.inc +++ /dev/null @@ -1,393 +0,0 @@ -/* Name: usbdrvasm12.inc - * 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) 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 $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 12 MHz version of the asssembler part of the USB driver. It -requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! - - -Timing constraints according to spec (in bit times): -timing subject min max CPUcycles ---------------------------------------------------------------------------- -EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128 -EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60 -DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60 -*/ - -;Software-receiver engine. Strict timing! Don't change unless you can preserve timing! -;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled -;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable -;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes -;Numbers in brackets are maximum cycles since SOF. -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt - push YL ;2 [35] push only what is necessary to sync with edge ASAP - in YL, SREG ;1 [37] - push YL ;2 [39] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;2 [2] - lds YL, usbInputBufOffset;2 [4] - clr YH ;1 [5] - subi YL, lo8(-(usbRxBuf));1 [6] - sbci YH, hi8(-(usbRxBuf));1 [7] - - sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early] - rjmp haveTwoBitsK ;2 [10] - pop YH ;2 [11] undo the push from before - rjmp waitForK ;2 [13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- - push shift ;2 [16] - push x1 ;2 [12] - push x2 ;2 [14] - - in x1, USBIN ;1 [17] <-- sample bit 0 - ldi shift, 0xff ;1 [18] - bst x1, USBMINUS ;1 [19] - bld shift, 0 ;1 [20] - push x3 ;2 [22] - push cnt ;2 [24] - - in x2, USBIN ;1 [25] <-- sample bit 1 - ser x3 ;1 [26] [inserted init instruction] - eor x1, x2 ;1 [27] - bst x1, USBMINUS ;1 [28] - bld shift, 1 ;1 [29] - ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction] - rjmp rxbit2 ;2 [32] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -unstuff0: ;1 (branch taken) - andi x3, ~0x01 ;1 [15] - mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [17] <-- sample bit 1 again - ori shift, 0x01 ;1 [18] - rjmp didUnstuff0 ;2 [20] - -unstuff1: ;1 (branch taken) - mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [22] - ori shift, 0x02 ;1 [23] - nop ;1 [24] - in x1, USBIN ;1 [25] <-- sample bit 2 again - rjmp didUnstuff1 ;2 [27] - -unstuff2: ;1 (branch taken) - andi x3, ~0x04 ;1 [29] - ori shift, 0x04 ;1 [30] - mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit - nop ;1 [32] - in x2, USBIN ;1 [33] <-- sample bit 3 - rjmp didUnstuff2 ;2 [35] - -unstuff3: ;1 (branch taken) - in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late] - andi x3, ~0x08 ;1 [35] - ori shift, 0x08 ;1 [36] - rjmp didUnstuff3 ;2 [38] - -unstuff4: ;1 (branch taken) - andi x3, ~0x10 ;1 [40] - in x1, USBIN ;1 [41] <-- sample stuffed bit 4 - ori shift, 0x10 ;1 [42] - rjmp didUnstuff4 ;2 [44] - -unstuff5: ;1 (branch taken) - andi x3, ~0x20 ;1 [48] - in x2, USBIN ;1 [49] <-- sample stuffed bit 5 - ori shift, 0x20 ;1 [50] - rjmp didUnstuff5 ;2 [52] - -unstuff6: ;1 (branch taken) - andi x3, ~0x40 ;1 [56] - in x1, USBIN ;1 [57] <-- sample stuffed bit 6 - ori shift, 0x40 ;1 [58] - rjmp didUnstuff6 ;2 [60] - -; extra jobs done during bit interval: -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs] -; bit 1: se0 check -; bit 2: overflow check -; bit 3: recovery from delay [bit 0 tasks took too long] -; bit 4: none -; bit 5: none -; bit 6: none -; bit 7: jump, eor -rxLoop: - eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;1 [1] <-- sample bit 0 - st y+, x3 ;2 [3] store data - ser x3 ;1 [4] - nop ;1 [5] - eor x2, x1 ;1 [6] - bst x2, USBMINUS;1 [7] - bld shift, 0 ;1 [8] - in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [10] - breq se0 ;1 [11] SE0 check for bit 1 - andi shift, 0xf9 ;1 [12] -didUnstuff0: - breq unstuff0 ;1 [13] - eor x1, x2 ;1 [14] - bst x1, USBMINUS;1 [15] - bld shift, 1 ;1 [16] -rxbit2: - in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed) - andi shift, 0xf3 ;1 [18] - breq unstuff1 ;1 [19] do remaining work for bit 1 -didUnstuff1: - subi cnt, 1 ;1 [20] - brcs overflow ;1 [21] loop control - eor x2, x1 ;1 [22] - bst x2, USBMINUS;1 [23] - bld shift, 2 ;1 [24] - in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed) - andi shift, 0xe7 ;1 [26] - breq unstuff2 ;1 [27] -didUnstuff2: - eor x1, x2 ;1 [28] - bst x1, USBMINUS;1 [29] - bld shift, 3 ;1 [30] -didUnstuff3: - andi shift, 0xcf ;1 [31] - breq unstuff3 ;1 [32] - in x1, USBIN ;1 [33] <-- sample bit 4 - eor x2, x1 ;1 [34] - bst x2, USBMINUS;1 [35] - bld shift, 4 ;1 [36] -didUnstuff4: - andi shift, 0x9f ;1 [37] - breq unstuff4 ;1 [38] - nop2 ;2 [40] - in x2, USBIN ;1 [41] <-- sample bit 5 - eor x1, x2 ;1 [42] - bst x1, USBMINUS;1 [43] - bld shift, 5 ;1 [44] -didUnstuff5: - andi shift, 0x3f ;1 [45] - breq unstuff5 ;1 [46] - nop2 ;2 [48] - in x1, USBIN ;1 [49] <-- sample bit 6 - eor x2, x1 ;1 [50] - bst x2, USBMINUS;1 [51] - bld shift, 6 ;1 [52] -didUnstuff6: - cpi shift, 0x02 ;1 [53] - brlo unstuff6 ;1 [54] - nop2 ;2 [56] - in x2, USBIN ;1 [57] <-- sample bit 7 - eor x1, x2 ;1 [58] - bst x1, USBMINUS;1 [59] - bld shift, 7 ;1 [60] -didUnstuff7: - cpi shift, 0x04 ;1 [61] - brsh rxLoop ;2 [63] loop control -unstuff7: - andi x3, ~0x80 ;1 [63] - ori shift, 0x80 ;1 [64] - in x2, USBIN ;1 [65] <-- sample stuffed bit 7 - nop ;1 [66] - rjmp didUnstuff7 ;2 [68] - -macro POP_STANDARD ; 12 cycles - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [59] - brcc doExorN1 ;[-4] [60] - subi x4, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_NAK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendAckAndReti: ;0 [-19] 19 cycles until SOP - ldi x3, USBPID_ACK ;1 [-18] - rjmp usbSendX3 ;2 [-16] -sendCntAndReti: ;0 [-17] 17 cycles until SOP - mov x3, cnt ;1 [-16] -usbSendX3: ;0 [-16] - ldi YL, 20 ;1 [-15] 'x3' is R20 - ldi YH, 0 ;1 [-14] - ldi cnt, 2 ;1 [-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x2, x4, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x4 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-12] 12 cycles until SOP - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS ;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-8] <--- acquire bus - in x1, USBOUT ;[-7] port mirror for tx loop - ldi shift, 0x40 ;[-6] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-5] - push x4 ;[-4] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x4, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x4, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x4, 6 ;[05] [13] -commonN2: - nop ;[06] [14] - subi cnt, 171 ;[07] [15] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[08] [16] <--- set bit - brcs txBitloop ;[09] [25] [41] - -stuff6Delay: - ror shift ;[42] [50] - brcc doExor6 ;[43] - subi x4, 1 ;[44] - brne common6 ;[45] - lsl shift ;[46] compensate ror after rjmp stuffDelay - nop ;[47] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[48] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[45] [53] - ldi x4, 6 ;[46] -common6: -stuff7Delay: - ror shift ;[47] [55] - out USBOUT, x1 ;[48] <--- set bit - brcc doExor7 ;[49] - subi x4, 1 ;[50] - brne common7 ;[51] - lsl shift ;[52] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[53] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[51] [59] - ldi x4, 6 ;[52] -common7: - ld shift, y+ ;[53] - tst cnt ;[55] - out USBOUT, x1 ;[56] <--- set bit - brne txByteLoop ;[57] - -;make SE0: - cbr x1, USBMASK ;[58] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[59] - lsl x2 ;[61] we compare with left shifted address - subi YL, 2 + 20 ;[62] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[63] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12.5625 MHz -max frequency: 69.286 cycles for 8 bit -> 12.99 MHz -nominal frequency: 12.77 MHz ( = sqrt(min * max)) - -sampling positions: (next even number in range [+/- 0.5]) -cycle index range: 0 ... 66 -bits: -.5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125 -[0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59] - -bit number: 0 1 2 3 4 5 6 7 -spare cycles 1 2 1 2 1 1 1 0 - -operations to perform: duration cycle - ---------------- - eor fix, shift 1 -> 00 - andi phase, USBMASK 1 -> 08 - breq se0 1 -> 16 (moved to 11) - st y+, data 2 -> 24, 25 - mov data, fix 1 -> 33 - ser data 1 -> 41 - subi cnt, 1 1 -> 49 - brcs overflow 1 -> 50 - -layout of samples and operations: -[##] = sample bit -<##> = sample phase -*##* = operation - -0: *00* [01] 02 03 04 <05> 06 07 -1: *08* [09] 10 11 12 <13> 14 15 *16* -2: [17] 18 19 20 <21> 22 23 -3: *24* *25* [26] 27 28 29 <30> 31 32 -4: *33* [34] 35 36 37 <38> 39 40 -5: *41* [42] 43 44 45 <46> 47 48 -6: *49* *50* [51] 52 53 54 <55> 56 57 58 -7: [59] 60 61 62 <63> 64 65 66 -*****************************************************************************/ - -/* we prefer positive expressions (do if condition) instead of negative - * (skip if condition), therefore use defines for skip instructions: - */ -#define ifioclr sbis -#define ifioset sbic -#define ifrclr sbrs -#define ifrset sbrc - -/* The registers "fix" and "data" swap their meaning during the loop. Use - * defines to keep their name constant. - */ -#define fix x2 -#define data x1 -#undef phase /* phase has a default definition to x4 */ -#define phase x3 - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0 - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of 1/4 bit which meets the spec. - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS ;[0] - rjmp foundK ;[1] -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError - -foundK: -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push YH ;[2] - lds YL, usbInputBufOffset;[4] - clr YH ;[6] - subi YL, lo8(-(usbRxBuf));[7] - sbci YH, hi8(-(usbRxBuf));[8] - - sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5] - rjmp haveTwoBitsK ;[10] - pop YH ;[11] undo the push from before - rjmp waitForK ;[13] this was not the end of sync, retry -haveTwoBitsK: -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -#define fix x2 -#define data x1 - - push shift ;[12] - push x1 ;[14] - push x2 ;[16] - ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0 - ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5] - ori shift, 1<<0 ;[02] - push x3 ;[03] - push cnt ;[05] - push r0 ;[07] - ifioset USBIN, USBMINUS ;[09] <--- bit 1 - ori shift, 1<<1 ;[10] - ser fix ;[11] - ldi cnt, USB_BUFSIZE ;[12] - mov data, shift ;[13] - lsl shift ;[14] - nop2 ;[15] - ifioset USBIN, USBMINUS ;[17] <--- bit 2 - ori data, 3<<2 ;[18] store in bit 2 AND bit 3 - eor shift, data ;[19] do nrzi decoding - andi data, 1<<3 ;[20] - in phase, USBIN ;[21] <- phase - brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1 - nop ;[23] - rjmp entryAfterClr ;[24] -jumpToEntryAfterSet: - rjmp entryAfterSet ;[24] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -#undef fix -#define fix x1 -#undef data -#define data x2 - -bit7IsSet: - ifrclr phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump -bit0AfterSet: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioclr USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsClr ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0s ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterSet ;[06] -unstuff0s: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsClr ;[02] executed if first expr false or second true -se0AndStore: ; executed only if both bits 0 - st y+, x1 ;[15/17] cycles after start of byte - rjmp se0 ;[17/19] - -bit0IsClr: - ifrset phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterClr: - andi phase, USBMASK ;[08] - ifioset USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsSet ;[10] - breq se0AndStore ;[11] if D- was 0 in bits 0 AND 1 and D+ was 0 in between, we have SE0 - andi shift, ~(7 << 1) ;[12] - in phase, USBIN ;[13] <- phase - breq unstuff1c ;[14] - rjmp bit2AfterClr ;[15] -unstuff1c: - andi fix, ~(1 << 1) ;[16] - nop2 ;[08] - nop2 ;[10] -bit1IsSet: - ifrclr phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - ori shift, 1 << 1 ;[15] - nop ;[16] -bit2AfterSet: - ifioclr USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsClr ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2s ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterSet ;[22] -unstuff2s: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsClr: - ifrset phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterClr: - st y+, data ;[24] -entryAfterClr: - ifioset USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsSet ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3c ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterClr ;[31] -unstuff3c: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsSet: - ifrclr phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterSet: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioclr USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsClr ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4s ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterSet ;[39] -unstuff4s: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsClr: - ifrset phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterClr: - ser data ;[41] - ifioset USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsSet ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5c ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterClr ;[47] -unstuff5c: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsSet: - ifrclr phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterSet: - subi cnt, 1 ;[49] - brcs jumpToOverflow ;[50] - ifioclr USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsClr ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6s ;[56] - rjmp bit7AfterSet ;[57] - -jumpToOverflow: - rjmp overflow - -unstuff6s: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsClr: - ifrset phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] - nop ;[58] -bit7AfterClr: - ifioset USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsSet ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7c ;[64] - rjmp bit0AfterClr ;[65] -> [00] == [67] -unstuff7c: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsSet ;[60] - -bit7IsClr: - ifrset phase, USBMINUS ;[62] check phase only if D- changed - lpm ;[63] - in phase, USBIN ;[64] <- phase (one cycle too late) - ori shift, 1 << 7 ;[65] - nop ;[66] -;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump -bit0AfterClr: - eor fix, shift ;[00] -#undef fix -#define fix x2 -#undef data -#define data x1 /* we now have result in data, fix is reset to 0xff */ - ifioset USBIN, USBMINUS ;[01] <--- sample 0 - rjmp bit0IsSet ;[02] - andi shift, ~(7 << 0) ;[03] - breq unstuff0c ;[04] - in phase, USBIN ;[05] <- phase - rjmp bit1AfterClr ;[06] -unstuff0c: - in phase, USBIN ;[06] <- phase (one cycle too late) - andi fix, ~(1 << 0) ;[07] - ifioclr USBIN, USBMINUS ;[00] - ifioset USBIN, USBPLUS ;[01] - rjmp bit0IsSet ;[02] executed if first expr false or second true - rjmp se0AndStore ;[03] executed only if both bits 0 -bit0IsSet: - ifrclr phase, USBMINUS ;[04] check phase only if D- changed - lpm ;[05] - in phase, USBIN ;[06] <- phase (one cycle too late) - ori shift, 1 << 0 ;[07] -bit1AfterSet: - andi shift, ~(7 << 1) ;[08] compensated by "ori shift, 1<<1" if bit1IsClr - ifioclr USBIN, USBMINUS ;[09] <--- sample 1 - rjmp bit1IsClr ;[10] - breq unstuff1s ;[11] - nop2 ;[12] do not check for SE0 if bit 0 was 1 - in phase, USBIN ;[14] <- phase (one cycle too late) - rjmp bit2AfterSet ;[15] -unstuff1s: - in phase, USBIN ;[13] <- phase - andi fix, ~(1 << 1) ;[14] - lpm ;[07] - nop2 ;[10] -bit1IsClr: - ifrset phase, USBMINUS ;[12] check phase only if D- changed - lpm ;[13] - in phase, USBIN ;[14] <- phase (one cycle too late) - ori shift, 1 << 1 ;[15] - nop ;[16] -bit2AfterClr: - ifioset USBIN, USBMINUS ;[17] <--- sample 2 - rjmp bit2IsSet ;[18] - andi shift, ~(7 << 2) ;[19] - breq unstuff2c ;[20] - in phase, USBIN ;[21] <- phase - rjmp bit3AfterClr ;[22] -unstuff2c: - in phase, USBIN ;[22] <- phase (one cycle too late) - andi fix, ~(1 << 2) ;[23] - nop2 ;[16] - nop2 ;[18] -bit2IsSet: - ifrclr phase, USBMINUS ;[20] check phase only if D- changed - lpm ;[21] - in phase, USBIN ;[22] <- phase (one cycle too late) - ori shift, 1 << 2 ;[23] -bit3AfterSet: - st y+, data ;[24] -entryAfterSet: - ifioclr USBIN, USBMINUS ;[26] <--- sample 3 - rjmp bit3IsClr ;[27] - andi shift, ~(7 << 3) ;[28] - breq unstuff3s ;[29] - in phase, USBIN ;[30] <- phase - rjmp bit4AfterSet ;[31] -unstuff3s: - in phase, USBIN ;[31] <- phase (one cycle too late) - andi fix, ~(1 << 3) ;[32] - nop2 ;[25] - nop2 ;[27] -bit3IsClr: - ifrset phase, USBMINUS ;[29] check phase only if D- changed - lpm ;[30] - in phase, USBIN ;[31] <- phase (one cycle too late) - ori shift, 1 << 3 ;[32] -bit4AfterClr: - mov data, fix ;[33] undo this move by swapping defines -#undef fix -#define fix x1 -#undef data -#define data x2 - ifioset USBIN, USBMINUS ;[34] <--- sample 4 - rjmp bit4IsSet ;[35] - andi shift, ~(7 << 4) ;[36] - breq unstuff4c ;[37] - in phase, USBIN ;[38] <- phase - rjmp bit5AfterClr ;[39] -unstuff4c: - in phase, USBIN ;[39] <- phase (one cycle too late) - andi fix, ~(1 << 4) ;[40] - nop2 ;[33] - nop2 ;[35] -bit4IsSet: - ifrclr phase, USBMINUS ;[37] check phase only if D- changed - lpm ;[38] - in phase, USBIN ;[39] <- phase (one cycle too late) - ori shift, 1 << 4 ;[40] -bit5AfterSet: - ser data ;[41] - ifioclr USBIN, USBMINUS ;[42] <--- sample 5 - rjmp bit5IsClr ;[43] - andi shift, ~(7 << 5) ;[44] - breq unstuff5s ;[45] - in phase, USBIN ;[46] <- phase - rjmp bit6AfterSet ;[47] -unstuff5s: - in phase, USBIN ;[47] <- phase (one cycle too late) - andi fix, ~(1 << 5) ;[48] - nop2 ;[41] - nop2 ;[43] -bit5IsClr: - ifrset phase, USBMINUS ;[45] check phase only if D- changed - lpm ;[46] - in phase, USBIN ;[47] <- phase (one cycle too late) - ori shift, 1 << 5 ;[48] -bit6AfterClr: - subi cnt, 1 ;[49] - brcs overflow ;[50] - ifioset USBIN, USBMINUS ;[51] <--- sample 6 - rjmp bit6IsSet ;[52] - andi shift, ~(3 << 6) ;[53] - cpi shift, 2 ;[54] - in phase, USBIN ;[55] <- phase - brlt unstuff6c ;[56] - rjmp bit7AfterClr ;[57] -unstuff6c: - andi fix, ~(1 << 6) ;[50] - lpm ;[51] -bit6IsSet: - ifrclr phase, USBMINUS ;[54] check phase only if D- changed - lpm ;[55] - in phase, USBIN ;[56] <- phase (one cycle too late) - ori shift, 1 << 6 ;[57] -bit7AfterSet: - ifioclr USBIN, USBMINUS ;[59] <--- sample 7 - rjmp bit7IsClr ;[60] - andi shift, ~(1 << 7) ;[61] - cpi shift, 4 ;[62] - in phase, USBIN ;[63] <- phase - brlt unstuff7s ;[64] - rjmp bit0AfterSet ;[65] -> [00] == [67] -unstuff7s: - andi fix, ~(1 << 7) ;[58] - nop ;[59] - rjmp bit7IsClr ;[60] - -macro POP_STANDARD ; 14 cycles - pop r0 - pop cnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;---------------------------------------------------------------------------- -; Transmitting data -;---------------------------------------------------------------------------- - -txByteLoop: -txBitloop: -stuffN1Delay: ; [03] - ror shift ;[-5] [11] [63] - brcc doExorN1 ;[-4] [64] - subi x3, 1 ;[-3] - brne commonN1 ;[-2] - lsl shift ;[-1] compensate ror after rjmp stuffDelay - nop ;[00] stuffing consists of just waiting 8 cycles - rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 -; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 -; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte -;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt] -;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) -usbSendAndReti: - in x2, USBDDR ;[-10] 10 cycles until SOP - ori x2, USBMASK ;[-9] - sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups) - out USBDDR, x2 ;[-6] <--- acquire bus - in x1, USBOUT ;[-5] port mirror for tx loop - ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror) - ldi x2, USBMASK ;[-3] -doExorN1: - eor x1, x2 ;[-2] [06] [62] - ldi x3, 6 ;[-1] [07] [63] -commonN1: -stuffN2Delay: - out USBOUT, x1 ;[00] [08] [64] <--- set bit - ror shift ;[01] - brcc doExorN2 ;[02] - subi x3, 1 ;[03] - brne commonN2 ;[04] - lsl shift ;[05] compensate ror after rjmp stuffDelay - rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear -doExorN2: - eor x1, x2 ;[04] [12] - ldi x3, 6 ;[05] [13] -commonN2: - nop2 ;[06] [14] - subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1 - out USBOUT, x1 ;[09] [17] <--- set bit - brcs txBitloop ;[10] [27] [44] - -stuff6Delay: - ror shift ;[45] [53] - brcc doExor6 ;[46] - subi x3, 1 ;[47] - brne common6 ;[48] - lsl shift ;[49] compensate ror after rjmp stuffDelay - nop ;[50] stuffing consists of just waiting 8 cycles - rjmp stuff6Delay ;[51] after ror, C bit is reliably clear -doExor6: - eor x1, x2 ;[48] [56] - ldi x3, 6 ;[49] -common6: -stuff7Delay: - ror shift ;[50] [58] - out USBOUT, x1 ;[51] <--- set bit - brcc doExor7 ;[52] - subi x3, 1 ;[53] - brne common7 ;[54] - lsl shift ;[55] compensate ror after rjmp stuffDelay - rjmp stuff7Delay ;[56] after ror, C bit is reliably clear -doExor7: - eor x1, x2 ;[54] [62] - ldi x3, 6 ;[55] -common7: - ld shift, y+ ;[56] - nop ;[58] - tst cnt ;[59] - out USBOUT, x1 ;[60] [00]<--- set bit - brne txByteLoop ;[61] [01] -;make SE0: - cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles] - lds x2, usbNewDeviceAddr;[03] - lsl x2 ;[05] we compare with left shifted address - subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[07] - out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[01] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 0) - echo "$s\n"; - } -} - -function printBit($isAfterSet, $bitNum) -{ - ob_start(); - if($isAfterSet){ -?> - ifioclr USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsClr ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#s ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterSet ;[05] -unstuff#s: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsClr: - ifrset phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - - ifioset USBIN, USBMINUS ;[00] <--- sample - rjmp bit#IsSet ;[01] - andi shift, ~(7 << #) ;[02] - breq unstuff#c ;[03] - in phase, USBIN ;[04] <- phase - rjmp bit@AfterClr ;[05] -unstuff#c: - in phase, USBIN ;[05] <- phase (one cycle too late) - andi fix, ~(1 << #) ;[06] - nop2 ;[-1] - nop2 ;[01] -bit#IsSet: - ifrclr phase, USBMINUS ;[03] check phase only if D- changed - lpm ;[04] - in phase, USBIN ;[05] <- phase (one cycle too late) - ori shift, 1 << # ;[06] - -*****************************************************************************/ diff --git a/protocol/vusb/usbdrv/usbdrvasm15.inc b/protocol/vusb/usbdrv/usbdrvasm15.inc deleted file mode 100644 index 401b7f8fff..0000000000 --- a/protocol/vusb/usbdrv/usbdrvasm15.inc +++ /dev/null @@ -1,423 +0,0 @@ -/* Name: usbdrvasm15.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: contributed by V. Bosch - * Creation Date: 2007-08-06 - * 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 $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 15 MHz version of the asssembler part of the USB driver. It -requires a 15 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 15 MHz -> 10.0 cycles per bit, 80.0 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -;---------------------------------------------------------------------------- -; order of registers pushed: -; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4 -;---------------------------------------------------------------------------- -USB_INTR_VECTOR: - push YL ;2 push only what is necessary to sync with edge ASAP - in YL, SREG ;1 - push YL ;2 -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -; -; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -; sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -;------------------------------------------------------------------------------- -; The following code results in a sampling window of < 1/4 bit -; which meets the spec. -;------------------------------------------------------------------------------- -waitForK: ;- - sbis USBIN, USBMINUS ;1 [00] <-- sample - rjmp foundK ;2 [01] - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK - sbis USBIN, USBMINUS ; <-- sample - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -;------------------------------------------------------------------------------ -; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for -; center sampling] -; we have 1 bit time for setup purposes, then sample again. -; Numbers in brackets are cycles from center of first sync (double K) -; bit after the instruction -;------------------------------------------------------------------------------ -foundK: ;- [02] - lds YL, usbInputBufOffset;2 [03+04] tx loop - push YH ;2 [05+06] - clr YH ;1 [07] - subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init] - sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init] - push shift ;2 [10+11] - ser shift ;1 [12] - sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early) - rjmp haveTwoBitsK ;2 [00] [14] - pop shift ;2 [15+16] undo the push from before - pop YH ;2 [17+18] undo the push from before - rjmp waitForK ;2 [19+20] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 20 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;- [01] - push x1 ;2 [02+03] - push x2 ;2 [04+05] - push x3 ;2 [06+07] - push bitcnt ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - bst x1, USBMINUS ;1 [01] - bld shift, 0 ;1 [02] - push cnt ;2 [03+04] - ldi cnt, USB_BUFSIZE ;1 [05] - push x4 ;2 [06+07] tx loop - rjmp rxLoop ;2 [08] -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -unstuff0: ;- [07] (branch taken) - andi x3, ~0x01 ;1 [08] - mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit - in x2, USBIN ;1 [00] [10] <-- sample bit 1 again - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 1 - ori shift, 0x01 ;1 [03] 0b00000001 - nop ;1 [04] - rjmp didUnstuff0 ;2 [05] -;----------------------------------------------------- -unstuff1: ;- [05] (branch taken) - mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit - andi x3, ~0x02 ;1 [07] - ori shift, 0x02 ;1 [08] 0b00000010 - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 again - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - rjmp didUnstuff1 ;2 [03] -;----------------------------------------------------- -unstuff2: ;- [05] (branch taken) - andi x3, ~0x04 ;1 [06] - ori shift, 0x04 ;1 [07] 0b00000100 - mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit - nop ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - rjmp didUnstuff2 ;2 [03] -;----------------------------------------------------- -unstuff3: ;- [00] [10] (branch taken) - in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late - andi x2, USBMASK ;1 [02] - breq se0Hop ;1 [03] SE0 check for stuffed bit 3 - andi x3, ~0x08 ;1 [04] - ori shift, 0x08 ;1 [05] 0b00001000 - rjmp didUnstuff3 ;2 [06] -;---------------------------------------------------------------------------- -; extra jobs done during bit interval: -; -; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs], -; overflow check, jump to the head of rxLoop -; bit 1: SE0 check -; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long] -; bit 4: SE0 check, none -; bit 5: SE0 check, none -; bit 6: SE0 check, none -; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others -;---------------------------------------------------------------------------- -rxLoop: ;- [09] - in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed) - andi x2, USBMASK ;1 [01] - brne SkipSe0Hop ;1 [02] -se0Hop: ;- [02] - rjmp se0 ;2 [03] SE0 check for bit 1 -SkipSe0Hop: ;- [03] - ser x3 ;1 [04] - andi shift, 0xf9 ;1 [05] 0b11111001 - breq unstuff0 ;1 [06] -didUnstuff0: ;- [06] - eor x1, x2 ;1 [07] - bst x1, USBMINUS ;1 [08] - bld shift, 1 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed) - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 2 - andi shift, 0xf3 ;1 [03] 0b11110011 - breq unstuff1 ;1 [04] do remaining work for bit 1 -didUnstuff1: ;- [04] - eor x2, x1 ;1 [05] - bst x2, USBMINUS ;1 [06] - bld shift, 2 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed) - andi x2, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 3 - andi shift, 0xe7 ;1 [03] 0b11100111 - breq unstuff2 ;1 [04] -didUnstuff2: ;- [04] - eor x1, x2 ;1 [05] - bst x1, USBMINUS ;1 [06] - bld shift, 3 ;1 [07] -didUnstuff3: ;- [07] - andi shift, 0xcf ;1 [08] 0b11001111 - breq unstuff3 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 4 - andi x1, USBMASK ;1 [01] - breq se0Hop ;1 [02] SE0 check for bit 4 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 4 ;1 [05] -didUnstuff4: ;- [05] - andi shift, 0x9f ;1 [06] 0b10011111 - breq unstuff4 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 5 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 5 ;1 [05] -didUnstuff5: ;- [05] - andi shift, 0x3f ;1 [06] 0b00111111 - breq unstuff5 ;1 [07] - nop2 ;2 [08+09] - in x1, USBIN ;1 [00] [10] <-- sample bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 6 - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 6 ;1 [05] -didUnstuff6: ;- [05] - cpi shift, 0x02 ;1 [06] 0b00000010 - brlo unstuff6 ;1 [07] - nop2 ;2 [08+09] - in x2, USBIN ;1 [00] [10] <-- sample bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for bit 7 - eor x1, x2 ;1 [03] - bst x1, USBMINUS ;1 [04] - bld shift, 7 ;1 [05] -didUnstuff7: ;- [05] - cpi shift, 0x04 ;1 [06] 0b00000100 - brlo unstuff7 ;1 [07] - eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others - nop ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample bit 0 - st y+, x3 ;2 [01+02] store data - eor x2, x1 ;1 [03] - bst x2, USBMINUS ;1 [04] - bld shift, 0 ;1 [05] - subi cnt, 1 ;1 [06] - brcs overflow ;1 [07] - rjmp rxLoop ;2 [08] -;----------------------------------------------------- -unstuff4: ;- [08] - andi x3, ~0x10 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 4 - ori shift, 0x10 ;1 [03] - rjmp didUnstuff4 ;2 [04] -;----------------------------------------------------- -unstuff5: ;- [08] - ori shift, 0x20 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 5 - andi x3, ~0x20 ;1 [03] - rjmp didUnstuff5 ;2 [04] -;----------------------------------------------------- -unstuff6: ;- [08] - andi x3, ~0x40 ;1 [09] - in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6 - andi x1, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 6 - ori shift, 0x40 ;1 [03] - rjmp didUnstuff6 ;2 [04] -;----------------------------------------------------- -unstuff7: ;- [08] - andi x3, ~0x80 ;1 [09] - in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7 - andi x2, USBMASK ;1 [01] - breq se0 ;1 [02] SE0 check for stuffed bit 7 - ori shift, 0x80 ;1 [03] - rjmp didUnstuff7 ;2 [04] - -macro POP_STANDARD ; 16 cycles - pop x4 - pop cnt - pop bitcnt - pop x3 - pop x2 - pop x1 - pop shift - pop YH - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -;--------------------------------------------------------------------------- -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -;--------------------------------------------------------------------------- -bitstuffN: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - nop ;1 [07] - rjmp didStuffN ;1 [08] -;--------------------------------------------------------------------------- -bitstuff6: ;- [04] - eor x1, x4 ;1 [05] - clr x2 ;1 [06] - rjmp didStuff6 ;1 [07] -;--------------------------------------------------------------------------- -bitstuff7: ;- [02] - eor x1, x4 ;1 [03] - clr x2 ;1 [06] - nop ;1 [05] - rjmp didStuff7 ;1 [06] -;--------------------------------------------------------------------------- -sendNakAndReti: ;- [-19] - ldi x3, USBPID_NAK ;1 [-18] - rjmp sendX3AndReti ;1 [-17] -;--------------------------------------------------------------------------- -sendAckAndReti: ;- [-17] - ldi cnt, USBPID_ACK ;1 [-16] -sendCntAndReti: ;- [-16] - mov x3, cnt ;1 [-15] -sendX3AndReti: ;- [-15] - ldi YL, 20 ;1 [-14] x3==r20 address is 20 - ldi YH, 0 ;1 [-13] - ldi cnt, 2 ;1 [-12] -; rjmp usbSendAndReti fallthrough -;--------------------------------------------------------------------------- -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We need not to match the transfer rate exactly because the spec demands -;only 1.5% precision anyway. -usbSendAndReti: ;- [-13] 13 cycles until SOP - in x2, USBDDR ;1 [-12] - ori x2, USBMASK ;1 [-11] - sbi USBOUT, USBMINUS ;2 [-09-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;1 [-08] port mirror for tx loop - out USBDDR, x2 ;1 [-07] <- acquire bus - ; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;1 [-06] exor mask - ldi shift, 0x80 ;1 [-05] sync byte is first byte sent - ldi bitcnt, 6 ;1 [-04] -txBitLoop: ;- [-04] [06] - sbrs shift, 0 ;1 [-03] [07] - eor x1, x4 ;1 [-02] [08] - ror shift ;1 [-01] [09] -didStuffN: ;- [09] - out USBOUT, x1 ;1 [00] [10] <-- out N - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuffN ;1 [03] - dec bitcnt ;1 [04] - brne txBitLoop ;1 [05] - sbrs shift, 0 ;1 [06] - eor x1, x4 ;1 [07] - ror shift ;1 [08] -didStuff6: ;- [08] - nop ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 6 - ror x2 ;1 [01] - cpi x2, 0xfc ;1 [02] - brcc bitstuff6 ;1 [03] - sbrs shift, 0 ;1 [04] - eor x1, x4 ;1 [05] - ror shift ;1 [06] - ror x2 ;1 [07] -didStuff7: ;- [07] - ldi bitcnt, 6 ;1 [08] - cpi x2, 0xfc ;1 [09] - out USBOUT, x1 ;1 [00] [10] <-- out 7 - brcc bitstuff7 ;1 [01] - ld shift, y+ ;2 [02+03] - dec cnt ;1 [04] - brne txBitLoop ;1 [05] -makeSE0: - cbr x1, USBMASK ;1 [06] prepare SE0 [spec says EOP may be 19 to 23 cycles] - lds x2, usbNewDeviceAddr;2 [07+08] - lsl x2 ;1 [09] we compare with left shifted address -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - out USBOUT, x1 ;1 [00] [10] <-- out SE0-- from now 2 bits==20 cycl. until bus idle - subi YL, 20 + 2 ;1 [01] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;1 [02] - breq skipAddrAssign ;1 [03] - sts usbDeviceAddr, x2 ;2 [04+05] if not skipped: SE0 is one cycle longer -;---------------------------------------------------------------------------- -;end of usbDeviceAddress transfer -skipAddrAssign: ;- [03/04] - ldi x2, 1< 10.6666666 cycles per bit, 85.333333333 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-25] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-23] - push YL ;[-22] - push YH ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-12] -; [---] ;[-11] - lds YL, usbInputBufOffset;[-10] -; [---] ;[-9] - clr YH ;[-8] - subi YL, lo8(-(usbRxBuf));[-7] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init] - push shift ;[-5] -; [---] ;[-4] - ldi bitcnt, 0x55 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop shift ;[0] undo the push from before - pop bitcnt ;[2] undo the push from before - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 21 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[1] - push x2 ;[3] - push x3 ;[5] - ldi shift, 0 ;[7] - ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that - push x4 ;[9] == leap - - in x1, USBIN ;[11] <-- sample bit 0 - andi x1, USBMASK ;[12] - bst x1, USBMINUS ;[13] - bld shift, 7 ;[14] - push cnt ;[15] - ldi leap, 0 ;[17] [rx loop init] - ldi cnt, USB_BUFSIZE;[18] [rx loop init] - rjmp rxbit1 ;[19] arrives at [21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- - -; duration of unstuffing code should be 10.66666667 cycles. We adjust "leap" -; accordingly to approximate this value in the long run. - -unstuff6: - andi x2, USBMASK ;[03] - ori x3, 1<<6 ;[04] will not be shifted any more - andi shift, ~0x80;[05] - mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6 - subi leap, -1 ;[07] total duration = 11 bits -> subtract 1/3 - rjmp didUnstuff6 ;[08] - -unstuff7: - ori x3, 1<<7 ;[09] will not be shifted any more - in x2, USBIN ;[00] [10] re-sample bit 7 - andi x2, USBMASK ;[01] - andi shift, ~0x80;[02] - subi leap, 2 ;[03] total duration = 10 bits -> add 1/3 - rjmp didUnstuff7 ;[04] - -unstuffEven: - ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0 - in x1, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x1, USBMASK ;[02] - breq se0 ;[03] - subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3 - nop2 ;[05] - rjmp didUnstuffE ;[06] - -unstuffOdd: - ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1 - in x2, USBIN ;[00] [10] - andi shift, ~0x80;[01] - andi x2, USBMASK ;[02] - breq se0 ;[03] - subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3 - nop2 ;[05] - rjmp didUnstuffO ;[06] - -rxByteLoop: - andi x1, USBMASK ;[03] - eor x2, x1 ;[04] - subi leap, 1 ;[05] - brpl skipLeap ;[06] - subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte - nop ;1 -skipLeap: - subi x2, 1 ;[08] - ror shift ;[09] -didUnstuff6: - cpi shift, 0xfc ;[10] - in x2, USBIN ;[00] [11] <-- sample bit 7 - brcc unstuff6 ;[01] - andi x2, USBMASK ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] -didUnstuff7: - cpi shift, 0xfc ;[06] - brcc unstuff7 ;[07] - eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others - st y+, x3 ;[09] store data -rxBitLoop: - in x1, USBIN ;[00] [11] <-- sample bit 0/2/4 - andi x1, USBMASK ;[01] - eor x2, x1 ;[02] - andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7 - subi x2, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffEven ;[07] -didUnstuffE: - lsr x3 ;[08] - lsr x3 ;[09] -rxbit1: - in x2, USBIN ;[00] [10] <-- sample bit 1/3/5 - andi x2, USBMASK ;[01] - breq se0 ;[02] - eor x1, x2 ;[03] - subi x1, 1 ;[04] - ror shift ;[05] - cpi shift, 0xfc ;[06] - brcc unstuffOdd ;[07] -didUnstuffO: - subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3 - brcs rxBitLoop ;[09] - - subi cnt, 1 ;[10] - in x1, USBIN ;[00] [11] <-- sample bit 6 - brcc rxByteLoop ;[01] - rjmp overflow - -macro POP_STANDARD ; 14 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop bitcnt - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - nop2 ;[7] - nop ;[9] - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -bitstuff6: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] Carry is zero due to brcc - rol shift ;[7] compensate for ror shift at branch destination - rjmp didStuff6 ;[8] - -bitstuff7: - ldi x2, 0 ;[2] Carry is zero due to brcc - rjmp didStuff7 ;[3] - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -;We don't match the transfer rate exactly (don't insert leap cycles every third -;byte) because the spec demands only 1.5% precision anyway. -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101 -txBitLoop: - sbrs shift, 0 ;[-3] [7] - eor x1, x4 ;[-2] [8] - out USBOUT, x1 ;[-1] [9] <-- out N - ror shift ;[0] [10] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - lsr bitcnt ;[4] - brcc txBitLoop ;[5] - brne txBitLoop ;[6] - - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] -didStuff6: - out USBOUT, x1 ;[-1] [9] <-- out 6 - ror shift ;[0] [10] - ror x2 ;[1] - cpi x2, 0xfc ;[2] - brcc bitstuff6 ;[3] - ror shift ;[4] -didStuff7: - ror x2 ;[5] - sbrs x2, 7 ;[6] - eor x1, x4 ;[7] - nop ;[8] - cpi x2, 0xfc ;[9] - out USBOUT, x1 ;[-1][10] <-- out 7 - brcc bitstuff7 ;[0] [11] - ld shift, y+ ;[1] - dec cnt ;[3] - brne txByteLoop ;[4] -;make SE0: - cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[6] - lsl x2 ;[8] we compare with left shifted address - subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[10] - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[0] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< max 52 cycles interrupt disable -;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 16.5 MHz -> 11 cycles per bit -; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%) -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt - push YL ;[-23] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-21] - push YL ;[-20] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-15] - rjmp foundK ;[-14] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-12] -;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] -;we have 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push r0 ;[-12] -; [---] ;[-11] - push YH ;[-10] -; [---] ;[-9] - lds YL, usbInputBufOffset;[-8] -; [---] ;[-7] - clr YH ;[-6] - subi YL, lo8(-(usbRxBuf));[-5] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init] - mov r0, x2 ;[-3] [rx loop init] - sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) - rjmp haveTwoBitsK ;[-1] - pop YH ;[0] undo the pushes from before - pop r0 ;[2] - rjmp waitForK ;[4] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 22 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: ;[1] - push shift ;[1] - push x1 ;[3] - push x2 ;[5] - push x3 ;[7] - ldi shift, 0xff ;[9] [rx loop init] - ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag - - in x1, USBIN ;[11] <-- sample bit 0 - bst x1, USBMINUS ;[12] - bld shift, 0 ;[13] - push x4 ;[14] == phase -; [---] ;[15] - push cnt ;[16] -; [---] ;[17] - ldi phase, 0 ;[18] [rx loop init] - ldi cnt, USB_BUFSIZE;[19] [rx loop init] - rjmp rxbit1 ;[20] -; [---] ;[21] - -;---------------------------------------------------------------------------- -; Receiver loop (numbers in brackets are cycles within byte after instr) -;---------------------------------------------------------------------------- -/* -byte oriented operations done during loop: -bit 0: store data -bit 1: SE0 check -bit 2: overflow check -bit 3: catch up -bit 4: rjmp to achieve conditional jump range -bit 5: PLL -bit 6: catch up -bit 7: jump, fixup bitstuff -; 87 [+ 2] cycles ------------------------------------------------------------------- -*/ -continueWithBit5: - in x2, USBIN ;[055] <-- bit 5 - eor r0, x2 ;[056] - or phase, r0 ;[057] - sbrc phase, USBMINUS ;[058] - lpm ;[059] optional nop3; modifies r0 - in phase, USBIN ;[060] <-- phase - eor x1, x2 ;[061] - bst x1, USBMINUS ;[062] - bld shift, 5 ;[063] - andi shift, 0x3f ;[064] - in x1, USBIN ;[065] <-- bit 6 - breq unstuff5 ;[066] *** unstuff escape - eor phase, x1 ;[067] - eor x2, x1 ;[068] - bst x2, USBMINUS ;[069] - bld shift, 6 ;[070] -didUnstuff6: ;[ ] - in r0, USBIN ;[071] <-- phase - cpi shift, 0x02 ;[072] - brlo unstuff6 ;[073] *** unstuff escape -didUnstuff5: ;[ ] - nop2 ;[074] -; [---] ;[075] - in x2, USBIN ;[076] <-- bit 7 - eor x1, x2 ;[077] - bst x1, USBMINUS ;[078] - bld shift, 7 ;[079] -didUnstuff7: ;[ ] - eor r0, x2 ;[080] - or phase, r0 ;[081] - in r0, USBIN ;[082] <-- phase - cpi shift, 0x04 ;[083] - brsh rxLoop ;[084] -; [---] ;[085] -unstuff7: ;[ ] - andi x3, ~0x80 ;[085] - ori shift, 0x80 ;[086] - in x2, USBIN ;[087] <-- sample stuffed bit 7 - nop ;[088] - rjmp didUnstuff7 ;[089] -; [---] ;[090] - ;[080] - -unstuff5: ;[067] - eor phase, x1 ;[068] - andi x3, ~0x20 ;[069] - ori shift, 0x20 ;[070] - in r0, USBIN ;[071] <-- phase - mov x2, x1 ;[072] - nop ;[073] - nop2 ;[074] -; [---] ;[075] - in x1, USBIN ;[076] <-- bit 6 - eor r0, x1 ;[077] - or phase, r0 ;[078] - eor x2, x1 ;[079] - bst x2, USBMINUS ;[080] - bld shift, 6 ;[081] no need to check bitstuffing, we just had one - in r0, USBIN ;[082] <-- phase - rjmp didUnstuff5 ;[083] -; [---] ;[084] - ;[074] - -unstuff6: ;[074] - andi x3, ~0x40 ;[075] - in x1, USBIN ;[076] <-- bit 6 again - ori shift, 0x40 ;[077] - nop2 ;[078] -; [---] ;[079] - rjmp didUnstuff6 ;[080] -; [---] ;[081] - ;[071] - -unstuff0: ;[013] - eor r0, x2 ;[014] - or phase, r0 ;[015] - andi x2, USBMASK ;[016] check for SE0 - in r0, USBIN ;[017] <-- phase - breq didUnstuff0 ;[018] direct jump to se0 would be too long - andi x3, ~0x01 ;[019] - ori shift, 0x01 ;[020] - mov x1, x2 ;[021] mov existing sample - in x2, USBIN ;[022] <-- bit 1 again - rjmp didUnstuff0 ;[023] -; [---] ;[024] - ;[014] - -unstuff1: ;[024] - eor r0, x1 ;[025] - or phase, r0 ;[026] - andi x3, ~0x02 ;[027] - in r0, USBIN ;[028] <-- phase - ori shift, 0x02 ;[029] - mov x2, x1 ;[030] - rjmp didUnstuff1 ;[031] -; [---] ;[032] - ;[022] - -unstuff2: ;[035] - eor r0, x2 ;[036] - or phase, r0 ;[037] - andi x3, ~0x04 ;[038] - in r0, USBIN ;[039] <-- phase - ori shift, 0x04 ;[040] - mov x1, x2 ;[041] - rjmp didUnstuff2 ;[042] -; [---] ;[043] - ;[033] - -unstuff3: ;[043] - in x2, USBIN ;[044] <-- bit 3 again - eor r0, x2 ;[045] - or phase, r0 ;[046] - andi x3, ~0x08 ;[047] - ori shift, 0x08 ;[048] - nop ;[049] - in r0, USBIN ;[050] <-- phase - rjmp didUnstuff3 ;[051] -; [---] ;[052] - ;[042] - -unstuff4: ;[053] - andi x3, ~0x10 ;[054] - in x1, USBIN ;[055] <-- bit 4 again - ori shift, 0x10 ;[056] - rjmp didUnstuff4 ;[057] -; [---] ;[058] - ;[048] - -rxLoop: ;[085] - eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others - in x1, USBIN ;[000] <-- bit 0 - st y+, x3 ;[001] -; [---] ;[002] - eor r0, x1 ;[003] - or phase, r0 ;[004] - eor x2, x1 ;[005] - in r0, USBIN ;[006] <-- phase - ser x3 ;[007] - bst x2, USBMINUS ;[008] - bld shift, 0 ;[009] - andi shift, 0xf9 ;[010] -rxbit1: ;[ ] - in x2, USBIN ;[011] <-- bit 1 - breq unstuff0 ;[012] *** unstuff escape - andi x2, USBMASK ;[013] SE0 check for bit 1 -didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff - breq se0 ;[014] - eor r0, x2 ;[015] - or phase, r0 ;[016] - in r0, USBIN ;[017] <-- phase - eor x1, x2 ;[018] - bst x1, USBMINUS ;[019] - bld shift, 1 ;[020] - andi shift, 0xf3 ;[021] -didUnstuff1: ;[ ] - in x1, USBIN ;[022] <-- bit 2 - breq unstuff1 ;[023] *** unstuff escape - eor r0, x1 ;[024] - or phase, r0 ;[025] - subi cnt, 1 ;[026] overflow check - brcs overflow ;[027] - in r0, USBIN ;[028] <-- phase - eor x2, x1 ;[029] - bst x2, USBMINUS ;[030] - bld shift, 2 ;[031] - andi shift, 0xe7 ;[032] -didUnstuff2: ;[ ] - in x2, USBIN ;[033] <-- bit 3 - breq unstuff2 ;[034] *** unstuff escape - eor r0, x2 ;[035] - or phase, r0 ;[036] - eor x1, x2 ;[037] - bst x1, USBMINUS ;[038] - in r0, USBIN ;[039] <-- phase - bld shift, 3 ;[040] - andi shift, 0xcf ;[041] -didUnstuff3: ;[ ] - breq unstuff3 ;[042] *** unstuff escape - nop ;[043] - in x1, USBIN ;[044] <-- bit 4 - eor x2, x1 ;[045] - bst x2, USBMINUS ;[046] - bld shift, 4 ;[047] -didUnstuff4: ;[ ] - eor r0, x1 ;[048] - or phase, r0 ;[049] - in r0, USBIN ;[050] <-- phase - andi shift, 0x9f ;[051] - breq unstuff4 ;[052] *** unstuff escape - rjmp continueWithBit5;[053] -; [---] ;[054] - -macro POP_STANDARD ; 16 cycles - pop cnt - pop x4 - pop x3 - pop x2 - pop x1 - pop shift - pop YH - pop r0 - endm -macro POP_RETI ; 5 cycles - pop YL - out SREG, YL - pop YL - endm - -#include "asmcommon.inc" - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies - -bitstuff7: - eor x1, x4 ;[4] - ldi x2, 0 ;[5] - nop2 ;[6] C is zero (brcc) - rjmp didStuff7 ;[8] - -bitstuffN: - eor x1, x4 ;[5] - ldi x2, 0 ;[6] - lpm ;[7] 3 cycle NOP, modifies r0 - out USBOUT, x1 ;[10] <-- out - rjmp didStuffN ;[0] - -#define bitStatus x3 - -sendNakAndReti: - ldi cnt, USBPID_NAK ;[-19] - rjmp sendCntAndReti ;[-18] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov r0, cnt ;[-16] - ldi YL, 0 ;[-15] R0 address is 0 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-7] <- acquire bus -; need not init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-6] exor mask - ldi shift, 0x80 ;[-5] sync byte is first byte sent - ldi bitStatus, 0xff ;[-4] init bit loop counter, works for up to 12 bytes -byteloop: -bitloop: - sbrs shift, 0 ;[8] [-3] - eor x1, x4 ;[9] [-2] - out USBOUT, x1 ;[10] [-1] <-- out - ror shift ;[0] - ror x2 ;[1] -didStuffN: - cpi x2, 0xfc ;[2] - brcc bitstuffN ;[3] - nop ;[4] - subi bitStatus, 37 ;[5] 256 / 7 ~=~ 37 - brcc bitloop ;[6] when we leave the loop, bitStatus has almost the initial value - sbrs shift, 0 ;[7] - eor x1, x4 ;[8] - ror shift ;[9] -didStuff7: - out USBOUT, x1 ;[10] <-- out - ror x2 ;[0] - cpi x2, 0xfc ;[1] - brcc bitstuff7 ;[2] - ld shift, y+ ;[3] - dec cnt ;[5] - brne byteloop ;[6] -;make SE0: - cbr x1, USBMASK ;[7] prepare SE0 [spec says EOP may be 21 to 25 cycles] - lds x2, usbNewDeviceAddr;[8] - lsl x2 ;[10] we compare with left shifted address - out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - subi YL, 2 ;[0] Only assign address on data packets, not ACK/NAK in r0 - sbci YH, 0 ;[1] - breq skipAddrAssign ;[2] - sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< 12 cycles per bit -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop to receive the data bytes: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; cnt holds the number of bytes left in the receive buffer -; x3 holds the higher crc byte (see algorithm below) -; x4 is used as temporary register for the crc algorithm -; x5 is used for unstuffing: when unstuffing the last received bit is inverted in shift (to prevent further -; unstuffing calls. In the same time the corresponding bit in x5 is cleared to mark the bit as beening iverted -; zl lower crc value and crc table index -; zh used for crc table accesses - -;-------------------------------------------------------------------------------------------------------------- -; CRC mods: -; table driven crc checker, Z points to table in prog space -; ZL is the lower crc byte, x3 is the higher crc byte -; x4 is used as temp register to store different results -; the initialization of the crc register is not 0xFFFF but 0xFE54. This is because during the receipt of the -; first data byte an virtual zero data byte is added to the crc register, this results in the correct initial -; value of 0xFFFF at beginning of the second data byte before the first data byte is added to the crc. -; The magic number 0xFE54 results form the crc table: At tabH[0x54] = 0xFF = crcH (required) and -; tabL[0x54] = 0x01 -> crcL = 0x01 xor 0xFE = 0xFF -; bitcnt is renamed to x5 and is used for unstuffing purposes, the unstuffing works like in the 12MHz version -;-------------------------------------------------------------------------------------------------------------- -; CRC algorithm: -; The crc register is formed by x3 (higher byte) and ZL (lower byte). The algorithm uses a 'reversed' form -; i.e. that it takes the least significant bit first and shifts to the right. So in fact the highest order -; bit seen from the polynomial devision point of view is the lsb of ZL. (If this sounds strange to you i -; propose a research on CRC :-) ) -; Each data byte received is xored to ZL, the lower crc byte. This byte now builds the crc -; table index. Next the new high byte is loaded from the table and stored in x4 until we have space in x3 -; (its destination). -; Afterwards the lower table is loaded from the table and stored in ZL (the old index is overwritten as -; we don't need it anymore. In fact this is a right shift by 8 bits.) Now the old crc high value is xored -; to ZL, this is the second shift of the old crc value. Now x4 (the temp reg) is moved to x3 and the crc -; calculation is done. -; Prior to the first byte the two CRC register have to be initialized to 0xFFFF (as defined in usb spec) -; however the crc engine also runs during the receipt of the first byte, therefore x3 and zl are initialized -; to a magic number which results in a crc value of 0xFFFF after the first complete byte. -; -; This algorithm is split into the extra cycles of the different bits: -; bit7: XOR the received byte to ZL -; bit5: load the new high byte to x4 -; bit6: load the lower xor byte from the table, xor zl and x3, store result in zl (=the new crc low value) -; move x4 (the new high byte) to x3, the crc value is ready -; - - -macro POP_STANDARD ; 18 cycles - pop ZH - pop ZL - pop cnt - pop x5 - pop x3 - pop x2 - pop x1 - pop shift - pop x4 - endm -macro POP_RETI ; 7 cycles - pop YH - pop YL - out SREG, YL - pop YL - endm - -macro CRC_CLEANUP_AND_CHECK - ; the last byte has already been xored with the lower crc byte, we have to do the table lookup and xor - ; x3 is the higher crc byte, zl the lower one - ldi ZH, hi8(usbCrcTableHigh);[+1] get the new high byte from the table - lpm x2, Z ;[+2][+3][+4] - ldi ZH, hi8(usbCrcTableLow);[+5] get the new low xor byte from the table - lpm ZL, Z ;[+6][+7][+8] - eor ZL, x3 ;[+7] xor the old high byte with the value from the table, x2:ZL now holds the crc value - cpi ZL, 0x01 ;[+8] if the crc is ok we have a fixed remainder value of 0xb001 in x2:ZL (see usb spec) - brne ignorePacket ;[+9] detected a crc fault -> paket is ignored and retransmitted by the host - cpi x2, 0xb0 ;[+10] - brne ignorePacket ;[+11] detected a crc fault -> paket is ignored and retransmitted by the host - endm - - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG, YH, [sofError], x4, shift, x1, x2, x3, x5, cnt, ZL, ZH - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-17] - rjmp foundK ;[-16] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-15] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 30 (2.5 bits) for center sampling. Currently at 4 so 26 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push x4 ;[-14] -; [---] ;[-13] - lds YL, usbInputBufOffset;[-12] used to toggle the two usb receive buffers -; [---] ;[-11] - clr YH ;[-10] - subi YL, lo8(-(usbRxBuf));[-9] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-8] [rx loop init] - push shift ;[-7] -; [---] ;[-6] - ldi shift, 0x80 ;[-5] the last bit is the end of byte marker for the pid receiver loop - clc ;[-4] the carry has to be clear for receipt of pid bit 0 - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop x4 ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 24 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] crc high byte - ldi x2, 1< jump back and store the byte - ori shift, 0x01 ;[11] invert the last received bit to prevent furhter unstuffing - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - andi x5, 0xFE ;[1] mark this bit as inverted (will be corrected before storing shift) - eor x1, x2 ;[2] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[3] mask the interesting bits - breq stuffErr ;[4] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[5] the next bit expects the last state to be in x1 - rjmp didunstuff0 ;[6] - ;[7] jump delay of rjmp didunstuffX - -unstuff1: ;[11] this is the jump delay of breq unstuffX - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - ori shift, 0x02 ;[1] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFD ;[2] mark this bit as inverted (will be corrected before storing shift) - eor x2, x1 ;[3] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[4] mask the interesting bits - breq stuffErr ;[5] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[6] the next bit expects the last state to be in x2 - nop2 ;[7] - ;[8] - rjmp didunstuff1 ;[9] - ;[10] jump delay of rjmp didunstuffX - -unstuff2: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x04 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xFB ;[11] mark this bit as inverted (will be corrected before storing shift) - in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x1, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x1, x2 ;[4] the next bit expects the last state to be in x1 - nop2 ;[5] - ;[6] - rjmp didunstuff2 ;[7] - ;[8] jump delay of rjmp didunstuffX - -unstuff3: ;[9] this is the jump delay of breq unstuffX - ori shift, 0x08 ;[10] invert the last received bit to prevent furhter unstuffing - andi x5, 0xF7 ;[11] mark this bit as inverted (will be corrected before storing shift) - in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors - eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero - andi x2, USBMASK ;[2] mask the interesting bits - breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong - mov x2, x1 ;[4] the next bit expects the last state to be in x2 - nop2 ;[5] - ;[6] - rjmp didunstuff3 ;[7] - ;[8] jump delay of rjmp didunstuffX - - - -; the include has to be here due to branch distance restirctions -#define __USE_CRC__ -#include "asmcommon.inc" - - - -; USB spec says: -; idle = J -; J = (D+ = 0), (D- = 1) -; K = (D+ = 1), (D- = 0) -; Spec allows 7.5 bit times from EOP to SOP for replies -; 7.5 bit times is 90 cycles. ...there is plenty of time - - -sendNakAndReti: - ldi x3, USBPID_NAK ;[-18] - rjmp sendX3AndReti ;[-17] -sendAckAndReti: - ldi cnt, USBPID_ACK ;[-17] -sendCntAndReti: - mov x3, cnt ;[-16] -sendX3AndReti: - ldi YL, 20 ;[-15] x3==r20 address is 20 - ldi YH, 0 ;[-14] - ldi cnt, 2 ;[-13] -; rjmp usbSendAndReti fallthrough - -;usbSend: -;pointer to data in 'Y' -;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] -;uses: x1...x4, btcnt, shift, cnt, Y -;Numbers in brackets are time since first bit of sync pattern is sent - -usbSendAndReti: ; 12 cycles until SOP - in x2, USBDDR ;[-12] - ori x2, USBMASK ;[-11] - sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) - in x1, USBOUT ;[-8] port mirror for tx loop - out USBDDR, x2 ;[-6] <- acquire bus - ldi x2, 0 ;[-6] init x2 (bitstuff history) because sync starts with 0 - ldi x4, USBMASK ;[-5] exor mask - ldi shift, 0x80 ;[-4] sync byte is first byte sent -txByteLoop: - ldi bitcnt, 0x40 ;[-3]=[9] binary 01000000 -txBitLoop: ; the loop sends the first 7 bits of the byte - sbrs shift, 0 ;[-2]=[10] if we have to send a 1 don't change the line state - eor x1, x4 ;[-1]=[11] - out USBOUT, x1 ;[0] - ror shift ;[1] - ror x2 ;[2] transfers the last sent bit to the stuffing history -didStuffN: - nop ;[3] - nop ;[4] - cpi x2, 0xfc ;[5] if we sent six consecutive ones - brcc bitstuffN ;[6] - lsr bitcnt ;[7] - brne txBitLoop ;[8] restart the loop while the 1 is still in the bitcount - -; transmit bit 7 - sbrs shift, 0 ;[9] - eor x1, x4 ;[10] -didStuff7: - ror shift ;[11] - out USBOUT, x1 ;[0] transfer bit 7 to the pins - ror x2 ;[1] move the bit into the stuffing history - cpi x2, 0xfc ;[2] - brcc bitstuff7 ;[3] - ld shift, y+ ;[4] get next byte to transmit - dec cnt ;[5] decrement byte counter - brne txByteLoop ;[7] if we have more bytes start next one - ;[8] branch delay - -;make SE0: - cbr x1, USBMASK ;[8] prepare SE0 [spec says EOP may be 25 to 30 cycles] - lds x2, usbNewDeviceAddr;[9] - lsl x2 ;[11] we compare with left shifted address - out USBOUT, x1 ;[0] <-- out SE0 -- from now 2 bits = 24 cycles until bus idle - subi YL, 20 + 2 ;[1] Only assign address on data packets, not ACK/NAK in x3 - sbci YH, 0 ;[2] -;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: -;set address only after data packet was sent, not after handshake - breq skipAddrAssign ;[3] - sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer -skipAddrAssign: -;end of usbDeviceAddress transfer - ldi x2, 1< -int main (int argc, char **argv) -{ - int i, j; - for (i=0; i<512; i++){ - unsigned short crc = i & 0xff; - for(j=0; j<8; j++) crc = (crc >> 1) ^ ((crc & 1) ? 0xa001 : 0); - if((i & 7) == 0) printf("\n.byte "); - printf("0x%02x, ", (i > 0xff ? (crc >> 8) : crc) & 0xff); - if(i == 255) printf("\n"); - } - return 0; -} - -// Use the following algorithm to compute CRC values: -ushort computeCrc(uchar *msg, uchar msgLen) -{ - uchar i; - ushort crc = 0xffff; - for(i = 0; i < msgLen; i++) - crc = usbCrcTable16[lo8(crc) ^ msg[i]] ^ hi8(crc); - return crc; -} -*/ - -.balign 256 -usbCrcTableLow: -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 -.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 - -; .balign 256 -usbCrcTableHigh: -.byte 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2 -.byte 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04 -.byte 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E -.byte 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8 -.byte 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A -.byte 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC -.byte 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6 -.byte 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10 -.byte 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32 -.byte 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4 -.byte 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE -.byte 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38 -.byte 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA -.byte 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C -.byte 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26 -.byte 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0 -.byte 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62 -.byte 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4 -.byte 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE -.byte 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68 -.byte 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA -.byte 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C -.byte 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76 -.byte 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0 -.byte 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92 -.byte 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54 -.byte 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E -.byte 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98 -.byte 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A -.byte 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C -.byte 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86 -.byte 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 - diff --git a/protocol/vusb/usbdrv/usbdrvasm20.inc b/protocol/vusb/usbdrv/usbdrvasm20.inc deleted file mode 100644 index 303abaf64c..0000000000 --- a/protocol/vusb/usbdrv/usbdrvasm20.inc +++ /dev/null @@ -1,360 +0,0 @@ -/* Name: usbdrvasm20.inc - * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers - * Author: Jeroen Benschop - * Based on usbdrvasm16.inc from Christian Starkjohann - * Creation Date: 2008-03-05 - * 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 $ - */ - -/* Do not link this file! Link usbdrvasm.S instead, which includes the - * appropriate implementation! - */ - -/* -General Description: -This file is the 20 MHz version of the asssembler part of the USB driver. It -requires a 20 MHz crystal (not a ceramic resonator and not a calibrated RC -oscillator). - -See usbdrv.h for a description of the entire driver. - -Since almost all of this code is timing critical, don't change unless you -really know what you are doing! Many parts require not only a maximum number -of CPU cycles, but even an exact number of cycles! -*/ - -#define leap2 x3 -#ifdef __IAR_SYSTEMS_ASM__ -#define nextInst $+2 -#else -#define nextInst .+0 -#endif - -;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes -;nominal frequency: 20 MHz -> 13.333333 cycles per bit, 106.666667 cycles per byte -; Numbers in brackets are clocks counted from center of last sync bit -; when instruction starts -;register use in receive loop: -; shift assembles the byte currently being received -; x1 holds the D+ and D- line state -; x2 holds the previous line state -; x4 (leap) is used to add a leap cycle once every three bytes received -; X3 (leap2) is used to add a leap cycle once every three stuff bits received -; bitcnt is used to determine when a stuff bit is due -; cnt holds the number of bytes left in the receive buffer - -USB_INTR_VECTOR: -;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt - push YL ;[-28] push only what is necessary to sync with edge ASAP - in YL, SREG ;[-26] - push YL ;[-25] - push YH ;[-23] -;---------------------------------------------------------------------------- -; Synchronize with sync pattern: -;---------------------------------------------------------------------------- -;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] -;sync up with J to K edge during sync pattern -- use fastest possible loops -;The first part waits at most 1 bit long since we must be in sync pattern. -;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to -;waitForJ, ensure that this prerequisite is met. -waitForJ: - inc YL - sbis USBIN, USBMINUS - brne waitForJ ; just make sure we have ANY timeout -waitForK: -;The following code results in a sampling window of < 1/4 bit which meets the spec. - sbis USBIN, USBMINUS ;[-19] - rjmp foundK ;[-18] - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK - sbis USBIN, USBMINUS - rjmp foundK -#if USB_COUNT_SOF - lds YL, usbSofCount - inc YL - sts usbSofCount, YL -#endif /* USB_COUNT_SOF */ -#ifdef USB_SOF_HOOK - USB_SOF_HOOK -#endif - rjmp sofError -foundK: ;[-16] -;{3, 5} after falling D- edge, average delay: 4 cycles -;bit0 should be at 34 for center sampling. Currently at 4 so 30 cylces till bit 0 sample -;use 1 bit time for setup purposes, then sample again. Numbers in brackets -;are cycles from center of first sync (double K) bit after the instruction - push bitcnt ;[-16] -; [---] ;[-15] - lds YL, usbInputBufOffset;[-14] -; [---] ;[-13] - clr YH ;[-12] - subi YL, lo8(-(usbRxBuf));[-11] [rx loop init] - sbci YH, hi8(-(usbRxBuf));[-10] [rx loop init] - push shift ;[-9] -; [---] ;[-8] - ldi shift,0x40 ;[-7] set msb to "1" so processing bit7 can be detected - nop2 ;[-6] -; [---] ;[-5] - ldi bitcnt, 5 ;[-4] [rx loop init] - sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) - rjmp haveTwoBitsK ;[-2] - pop shift ;[-1] undo the push from before - pop bitcnt ;[1] - rjmp waitForK ;[3] this was not the end of sync, retry -; The entire loop from waitForK until rjmp waitForK above must not exceed two -; bit times (= 27 cycles). - -;---------------------------------------------------------------------------- -; push more registers and initialize values while we sample the first bits: -;---------------------------------------------------------------------------- -haveTwoBitsK: - push x1 ;[0] - push x2 ;[2] - push x3 ;[4] (leap2) - ldi leap2, 0x55 ;[6] add leap cycle on 2nd,5th,8th,... stuff bit - push x4 ;[7] == leap - ldi leap, 0x55 ;[9] skip leap cycle on 2nd,5th,8th,... byte received - push cnt ;[10] - ldi cnt, USB_BUFSIZE ;[12] [rx loop init] - ldi x2, 1< -#ifndef __IAR_SYSTEMS_ASM__ -# include -#endif - -#define __attribute__(arg) /* not supported on IAR */ - -#ifdef __IAR_SYSTEMS_ASM__ -# define __ASSEMBLER__ /* IAR does not define standard macro for asm */ -#endif - -#ifdef __HAS_ELPM__ -# define PROGMEM __farflash -#else -# define PROGMEM __flash -#endif - -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -/* The following definitions are not needed by the driver, but may be of some - * help if you port a gcc based project to IAR. - */ -#define cli() __disable_interrupt() -#define sei() __enable_interrupt() -#define wdt_reset() __watchdog_reset() -#define _BV(x) (1 << (x)) - -/* assembler compatibility macros */ -#define nop2 rjmp $+2 /* jump to next instruction */ -#define XL r26 -#define XH r27 -#define YL r28 -#define YH r29 -#define ZL r30 -#define ZH r31 -#define lo8(x) LOW(x) -#define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ - -/* Depending on the device you use, you may get problems with the way usbdrv.h - * handles the differences between devices. Since IAR does not use #defines - * for MCU registers, we can't check for the existence of a particular - * register with an #ifdef. If the autodetection mechanism fails, include - * definitions for the required USB_INTR_* macros in your usbconfig.h. See - * usbconfig-prototype.h and usbdrv.h for details. - */ - -/* ------------------------------------------------------------------------- */ -#elif __CODEVISIONAVR__ /* check for CodeVision AVR */ -/* ------------------------------------------------------------------------- */ -/* This port is not working (yet) */ - -/* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */ - -#include -#include - -#define __attribute__(arg) /* not supported on IAR */ - -#define PROGMEM __flash -#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) - -#ifndef __ASSEMBLER__ -static inline void cli(void) -{ - #asm("cli"); -} -static inline void sei(void) -{ - #asm("sei"); -} -#endif -#define _delay_ms(t) delay_ms(t) -#define _BV(x) (1 << (x)) -#define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */ - -#define macro .macro -#define endm .endmacro -#define nop2 rjmp .+0 /* jump to next instruction */ - -/* ------------------------------------------------------------------------- */ -#else /* default development environment is avr-gcc/avr-libc */ -/* ------------------------------------------------------------------------- */ - -#include -#ifdef __ASSEMBLER__ -# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ -#else -# include -#endif - -#if USB_CFG_DRIVER_FLASH_PAGE -# define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr)) -#else -# define USB_READ_FLASH(addr) pgm_read_byte(addr) -#endif - -#define macro .macro -#define endm .endm -#define nop2 rjmp .+0 /* jump to next instruction */ - -#endif /* development environment */ - -/* for conveniecne, ensure that PRG_RDB exists */ -#ifndef PRG_RDB -# define PRG_RDB(addr) USB_READ_FLASH(addr) -#endif -#endif /* __usbportability_h_INCLUDED__ */ diff --git a/protocol/vusb/vusb.c b/protocol/vusb/vusb.c deleted file mode 100644 index 7d0292ed17..0000000000 --- a/protocol/vusb/vusb.c +++ /dev/null @@ -1,496 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include -#include "usbdrv.h" -#include "usbconfig.h" -#include "host.h" -#include "report.h" -#include "print.h" -#include "debug.h" -#include "host_driver.h" -#include "vusb.h" - - -static uint8_t vusb_keyboard_leds = 0; -static uint8_t vusb_idle_rate = 0; - -/* Keyboard report send buffer */ -#define KBUF_SIZE 16 -static report_keyboard_t kbuf[KBUF_SIZE]; -static uint8_t kbuf_head = 0; -static uint8_t kbuf_tail = 0; - -typedef struct { - uint8_t modifier; - uint8_t reserved; - uint8_t keycode[6]; -} keyboard_report_t; - -static keyboard_report_t keyboard_report; // sent to PC - -/* transfer keyboard report from buffer */ -void vusb_transfer_keyboard(void) -{ - if (usbInterruptIsReady()) { - if (kbuf_head != kbuf_tail) { - usbSetInterrupt((void *)&kbuf[kbuf_tail], sizeof(report_keyboard_t)); - kbuf_tail = (kbuf_tail + 1) % KBUF_SIZE; - if (debug_keyboard) { - print("V-USB: kbuf["); pdec(kbuf_tail); print("->"); pdec(kbuf_head); print("]("); - phex((kbuf_head < kbuf_tail) ? (KBUF_SIZE - kbuf_tail + kbuf_head) : (kbuf_head - kbuf_tail)); - print(")\n"); - } - } - } -} - - -/*------------------------------------------------------------------* - * Host driver - *------------------------------------------------------------------*/ -static uint8_t keyboard_leds(void); -static void send_keyboard(report_keyboard_t *report); -static void send_mouse(report_mouse_t *report); -static void send_system(uint16_t data); -static void send_consumer(uint16_t data); - -static host_driver_t driver = { - keyboard_leds, - send_keyboard, - send_mouse, - send_system, - send_consumer -}; - -host_driver_t *vusb_driver(void) -{ - return &driver; -} - -static uint8_t keyboard_leds(void) { - return vusb_keyboard_leds; -} - -static void send_keyboard(report_keyboard_t *report) -{ - uint8_t next = (kbuf_head + 1) % KBUF_SIZE; - if (next != kbuf_tail) { - kbuf[kbuf_head] = *report; - kbuf_head = next; - } else { - debug("kbuf: full\n"); - } - - // NOTE: send key strokes of Macro - usbPoll(); - vusb_transfer_keyboard(); -} - - -typedef struct { - uint8_t report_id; - report_mouse_t report; -} __attribute__ ((packed)) vusb_mouse_report_t; - -static void send_mouse(report_mouse_t *report) -{ - vusb_mouse_report_t r = { - .report_id = REPORT_ID_MOUSE, - .report = *report - }; - if (usbInterruptIsReady3()) { - usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); - } -} - - -typedef struct { - uint8_t report_id; - uint16_t usage; -} __attribute__ ((packed)) report_extra_t; - -static void send_system(uint16_t data) -{ - static uint16_t last_data = 0; - if (data == last_data) return; - last_data = data; - - report_extra_t report = { - .report_id = REPORT_ID_SYSTEM, - .usage = data - }; - if (usbInterruptIsReady3()) { - usbSetInterrupt3((void *)&report, sizeof(report)); - } -} - -static void send_consumer(uint16_t data) -{ - static uint16_t last_data = 0; - if (data == last_data) return; - last_data = data; - - report_extra_t report = { - .report_id = REPORT_ID_CONSUMER, - .usage = data - }; - if (usbInterruptIsReady3()) { - usbSetInterrupt3((void *)&report, sizeof(report)); - } -} - - - -/*------------------------------------------------------------------* - * Request from host * - *------------------------------------------------------------------*/ -static struct { - uint16_t len; - enum { - NONE, - SET_LED - } kind; -} last_req; - -usbMsgLen_t usbFunctionSetup(uchar data[8]) -{ -usbRequest_t *rq = (void *)data; - - if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){ /* class request type */ - if(rq->bRequest == USBRQ_HID_GET_REPORT){ - debug("GET_REPORT:"); - /* we only have one report type, so don't look at wValue */ - usbMsgPtr = (void *)&keyboard_report; - return sizeof(keyboard_report); - }else if(rq->bRequest == USBRQ_HID_GET_IDLE){ - debug("GET_IDLE: "); - //debug_hex(vusb_idle_rate); - usbMsgPtr = &vusb_idle_rate; - return 1; - }else if(rq->bRequest == USBRQ_HID_SET_IDLE){ - vusb_idle_rate = rq->wValue.bytes[1]; - debug("SET_IDLE: "); - debug_hex(vusb_idle_rate); - }else if(rq->bRequest == USBRQ_HID_SET_REPORT){ - debug("SET_REPORT: "); - // Report Type: 0x02(Out)/ReportID: 0x00(none) && Interface: 0(keyboard) - if (rq->wValue.word == 0x0200 && rq->wIndex.word == 0) { - debug("SET_LED: "); - last_req.kind = SET_LED; - last_req.len = rq->wLength.word; - } - return USB_NO_MSG; // to get data in usbFunctionWrite - } else { - debug("UNKNOWN:"); - } - }else{ - debug("VENDOR:"); - /* no vendor specific requests implemented */ - } - debug("\n"); - return 0; /* default for not implemented requests: return no data back to host */ -} - -uchar usbFunctionWrite(uchar *data, uchar len) -{ - if (last_req.len == 0) { - return -1; - } - switch (last_req.kind) { - case SET_LED: - debug("SET_LED: "); - debug_hex(data[0]); - debug("\n"); - vusb_keyboard_leds = data[0]; - last_req.len = 0; - return 1; - break; - case NONE: - default: - return -1; - break; - } - return 1; -} - - - -/*------------------------------------------------------------------* - * Descriptors * - *------------------------------------------------------------------*/ - -/* - * Report Descriptor for keyboard - * - * from an example in HID spec appendix - */ -const PROGMEM uchar keyboard_hid_report[] = { - 0x05, 0x01, // Usage Page (Generic Desktop), - 0x09, 0x06, // Usage (Keyboard), - 0xA1, 0x01, // Collection (Application), - 0x75, 0x01, // Report Size (1), - 0x95, 0x08, // Report Count (8), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0xE0, // Usage Minimum (224), - 0x29, 0xE7, // Usage Maximum (231), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0x01, // Logical Maximum (1), - 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte - 0x95, 0x01, // Report Count (1), - 0x75, 0x08, // Report Size (8), - 0x81, 0x03, // Input (Constant), ;Reserved byte - 0x95, 0x05, // Report Count (5), - 0x75, 0x01, // Report Size (1), - 0x05, 0x08, // Usage Page (LEDs), - 0x19, 0x01, // Usage Minimum (1), - 0x29, 0x05, // Usage Maximum (5), - 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report - 0x95, 0x01, // Report Count (1), - 0x75, 0x03, // Report Size (3), - 0x91, 0x03, // Output (Constant), ;LED report padding - 0x95, 0x06, // Report Count (6), - 0x75, 0x08, // Report Size (8), - 0x15, 0x00, // Logical Minimum (0), - 0x25, 0xFF, // Logical Maximum(255), - 0x05, 0x07, // Usage Page (Key Codes), - 0x19, 0x00, // Usage Minimum (0), - 0x29, 0xFF, // Usage Maximum (255), - 0x81, 0x00, // Input (Data, Array), - 0xc0 // End Collection -}; - -/* - * Report Descriptor for mouse - * - * Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension - * http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 - * http://www.keil.com/forum/15671/ - * http://www.microsoft.com/whdc/device/input/wheel.mspx - */ -const PROGMEM uchar mouse_hid_report[] = { - /* mouse */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_MOUSE, // REPORT_ID (1) - 0x09, 0x01, // USAGE (Pointer) - 0xa1, 0x00, // COLLECTION (Physical) - // ---------------------------- Buttons - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x05, // USAGE_MAXIMUM (Button 5) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x05, // REPORT_COUNT (5) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x75, 0x03, // REPORT_SIZE (3) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - // ---------------------------- X,Y position - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x02, // REPORT_COUNT (2) - 0x81, 0x06, // INPUT (Data,Var,Rel) - // ---------------------------- Vertical wheel - 0x09, 0x38, // USAGE (Wheel) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x35, 0x00, // PHYSICAL_MINIMUM (0) - reset physical - 0x45, 0x00, // PHYSICAL_MAXIMUM (0) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x06, // INPUT (Data,Var,Rel) - // ---------------------------- Horizontal wheel - 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) - 0x0a, 0x38, 0x02, // USAGE (AC Pan) - 0x15, 0x81, // LOGICAL_MINIMUM (-127) - 0x25, 0x7f, // LOGICAL_MAXIMUM (127) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x06, // INPUT (Data,Var,Rel) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION - /* system control */ - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x80, // USAGE (System Control) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_SYSTEM, // REPORT_ID (2) - 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x25, 0xb7, // LOGICAL_MAXIMUM (0xb7) - 0x19, 0x01, // USAGE_MINIMUM (0x1) - 0x29, 0xb7, // USAGE_MAXIMUM (0xb7) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x00, // INPUT (Data,Array,Abs) - 0xc0, // END_COLLECTION - /* consumer */ - 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) - 0x09, 0x01, // USAGE (Consumer Control) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORT_ID_CONSUMER, // REPORT_ID (3) - 0x15, 0x01, // LOGICAL_MINIMUM (0x1) - 0x26, 0x9c, 0x02, // LOGICAL_MAXIMUM (0x29c) - 0x19, 0x01, // USAGE_MINIMUM (0x1) - 0x2a, 0x9c, 0x02, // USAGE_MAXIMUM (0x29c) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x00, // INPUT (Data,Array,Abs) - 0xc0, // END_COLLECTION -}; - - -/* - * Descriptor for compite device: Keyboard + Mouse - * - * contains: device, interface, HID and endpoint descriptors - */ -#if USB_CFG_DESCR_PROPS_CONFIGURATION -const PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ - 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ - USBDESCR_CONFIG, /* descriptor type */ - 9 + (9 + 9 + 7) + (9 + 9 + 7), 0, - //18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + 9, 0, - /* total length of data returned (including inlined descriptors) */ - 2, /* number of interfaces in this configuration */ - 1, /* index of this configuration */ - 0, /* configuration name string index */ -#if USB_CFG_IS_SELF_POWERED - (1 << 7) | USBATTR_SELFPOWER, /* attributes */ -#else - (1 << 7), /* attributes */ -#endif - USB_CFG_MAX_BUS_POWER/2, /* max USB current in 2mA units */ - - /* - * Keyboard interface - */ - /* Interface descriptor */ - 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ - USBDESCR_INTERFACE, /* descriptor type */ - 0, /* index of this interface */ - 0, /* alternate setting for this interface */ - USB_CFG_HAVE_INTRIN_ENDPOINT, /* endpoints excl 0: number of endpoint descriptors to follow */ - USB_CFG_INTERFACE_CLASS, - USB_CFG_INTERFACE_SUBCLASS, - USB_CFG_INTERFACE_PROTOCOL, - 0, /* string index for interface */ - /* HID descriptor */ - 9, /* sizeof(usbDescrHID): length of descriptor in bytes */ - USBDESCR_HID, /* descriptor type: HID */ - 0x01, 0x01, /* BCD representation of HID version */ - 0x00, /* target country code */ - 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */ - 0x22, /* descriptor type: report */ - sizeof(keyboard_hid_report), 0, /* total length of report descriptor */ - /* Endpoint descriptor */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT /* endpoint descriptor for endpoint 1 */ - 7, /* sizeof(usbDescrEndpoint) */ - USBDESCR_ENDPOINT, /* descriptor type = endpoint */ - (char)0x81, /* IN endpoint number 1 */ - 0x03, /* attrib: Interrupt endpoint */ - 8, 0, /* maximum packet size */ - USB_CFG_INTR_POLL_INTERVAL, /* in ms */ -#endif - - /* - * Mouse interface - */ - /* Interface descriptor */ - 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ - USBDESCR_INTERFACE, /* descriptor type */ - 1, /* index of this interface */ - 0, /* alternate setting for this interface */ - USB_CFG_HAVE_INTRIN_ENDPOINT3, /* endpoints excl 0: number of endpoint descriptors to follow */ - 0x03, /* CLASS: HID */ - 0, /* SUBCLASS: none */ - 0, /* PROTOCOL: none */ - 0, /* string index for interface */ - /* HID descriptor */ - 9, /* sizeof(usbDescrHID): length of descriptor in bytes */ - USBDESCR_HID, /* descriptor type: HID */ - 0x01, 0x01, /* BCD representation of HID version */ - 0x00, /* target country code */ - 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */ - 0x22, /* descriptor type: report */ - sizeof(mouse_hid_report), 0, /* total length of report descriptor */ -#if USB_CFG_HAVE_INTRIN_ENDPOINT3 /* endpoint descriptor for endpoint 3 */ - /* Endpoint descriptor */ - 7, /* sizeof(usbDescrEndpoint) */ - USBDESCR_ENDPOINT, /* descriptor type = endpoint */ - (char)(0x80 | USB_CFG_EP3_NUMBER), /* IN endpoint number 3 */ - 0x03, /* attrib: Interrupt endpoint */ - 8, 0, /* maximum packet size */ - USB_CFG_INTR_POLL_INTERVAL, /* in ms */ -#endif -}; -#endif - - -USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) -{ - usbMsgLen_t len = 0; - -/* - debug("usbFunctionDescriptor: "); - debug_hex(rq->bmRequestType); debug(" "); - debug_hex(rq->bRequest); debug(" "); - debug_hex16(rq->wValue.word); debug(" "); - debug_hex16(rq->wIndex.word); debug(" "); - debug_hex16(rq->wLength.word); debug("\n"); -*/ - switch (rq->wValue.bytes[1]) { -#if USB_CFG_DESCR_PROPS_CONFIGURATION - case USBDESCR_CONFIG: - usbMsgPtr = (unsigned char *)usbDescriptorConfiguration; - len = sizeof(usbDescriptorConfiguration); - break; -#endif - case USBDESCR_HID: - switch (rq->wValue.bytes[0]) { - case 0: - usbMsgPtr = (unsigned char *)(usbDescriptorConfiguration + 9 + 9); - len = 9; - break; - case 1: - usbMsgPtr = (unsigned char *)(usbDescriptorConfiguration + 9 + (9 + 9 + 7) + 9); - len = 9; - break; - } - break; - case USBDESCR_HID_REPORT: - /* interface index */ - switch (rq->wIndex.word) { - case 0: - usbMsgPtr = keyboard_hid_report; - len = sizeof(keyboard_hid_report); - break; - case 1: - usbMsgPtr = mouse_hid_report; - len = sizeof(mouse_hid_report); - break; - } - break; - } - //debug("desc len: "); debug_hex(len); debug("\n"); - return len; -} diff --git a/protocol/vusb/vusb.h b/protocol/vusb/vusb.h deleted file mode 100644 index 5accf233be..0000000000 --- a/protocol/vusb/vusb.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef VUSB_H -#define VUSB_H - -#include "host_driver.h" - - -host_driver_t *vusb_driver(void); -void vusb_transfer_keyboard(void); - -#endif -- cgit v1.2.3