From 60b30c036397cb5627fa374bb930794b225daa29 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 7 Jul 2017 11:55:23 -0400 Subject: Squashed 'lib/lufa/' content from commit 385d40300 git-subtree-dir: lib/lufa git-subtree-split: 385d4030035dbaf41591309dbde47653bd03841b --- Demos/Device/ClassDriver/AudioInput/AudioInput.c | 274 +++ Demos/Device/ClassDriver/AudioInput/AudioInput.h | 94 + Demos/Device/ClassDriver/AudioInput/AudioInput.txt | 92 + .../ClassDriver/AudioInput/Config/AppConfig.h | 51 + .../ClassDriver/AudioInput/Config/LUFAConfig.h | 93 + Demos/Device/ClassDriver/AudioInput/Descriptors.c | 312 +++ Demos/Device/ClassDriver/AudioInput/Descriptors.h | 106 + Demos/Device/ClassDriver/AudioInput/asf.xml | 52 + Demos/Device/ClassDriver/AudioInput/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/AudioInput/makefile | 43 + Demos/Device/ClassDriver/AudioOutput/AudioOutput.c | 311 +++ Demos/Device/ClassDriver/AudioOutput/AudioOutput.h | 87 + .../Device/ClassDriver/AudioOutput/AudioOutput.txt | 92 + .../ClassDriver/AudioOutput/Config/AppConfig.h | 50 + .../ClassDriver/AudioOutput/Config/LUFAConfig.h | 93 + Demos/Device/ClassDriver/AudioOutput/Descriptors.c | 312 +++ Demos/Device/ClassDriver/AudioOutput/Descriptors.h | 106 + Demos/Device/ClassDriver/AudioOutput/asf.xml | 50 + Demos/Device/ClassDriver/AudioOutput/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/AudioOutput/makefile | 43 + .../ClassDriver/DualMIDI/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/DualMIDI/Descriptors.c | 366 +++ Demos/Device/ClassDriver/DualMIDI/Descriptors.h | 124 + Demos/Device/ClassDriver/DualMIDI/DualMIDI.c | 211 ++ Demos/Device/ClassDriver/DualMIDI/DualMIDI.h | 78 + Demos/Device/ClassDriver/DualMIDI/DualMIDI.txt | 78 + Demos/Device/ClassDriver/DualMIDI/asf.xml | 62 + Demos/Device/ClassDriver/DualMIDI/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/DualMIDI/makefile | 43 + .../DualVirtualSerial/Config/LUFAConfig.h | 126 + .../ClassDriver/DualVirtualSerial/Descriptors.c | 360 +++ .../ClassDriver/DualVirtualSerial/Descriptors.h | 135 ++ .../DualVirtualSerial/DualVirtualSerial.c | 242 ++ .../DualVirtualSerial/DualVirtualSerial.h | 76 + .../DualVirtualSerial/DualVirtualSerial.txt | 89 + .../DualVirtualSerial/LUFA DualVirtualSerial.inf | 66 + Demos/Device/ClassDriver/DualVirtualSerial/asf.xml | 62 + .../Device/ClassDriver/DualVirtualSerial/doxyfile | 2395 +++++++++++++++++++ .../Device/ClassDriver/DualVirtualSerial/makefile | 43 + .../ClassDriver/GenericHID/Config/AppConfig.h | 48 + .../ClassDriver/GenericHID/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/GenericHID/Descriptors.c | 220 ++ Demos/Device/ClassDriver/GenericHID/Descriptors.h | 95 + Demos/Device/ClassDriver/GenericHID/GenericHID.c | 202 ++ Demos/Device/ClassDriver/GenericHID/GenericHID.h | 87 + Demos/Device/ClassDriver/GenericHID/GenericHID.txt | 79 + .../HostTestApp/test_generic_hid_libusb.js | 143 ++ .../HostTestApp/test_generic_hid_libusb.py | 98 + .../HostTestApp/test_generic_hid_winusb.py | 96 + Demos/Device/ClassDriver/GenericHID/asf.xml | 63 + Demos/Device/ClassDriver/GenericHID/doxyfile | 2396 ++++++++++++++++++++ Demos/Device/ClassDriver/GenericHID/makefile | 43 + .../ClassDriver/Joystick/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/Joystick/Descriptors.c | 220 ++ Demos/Device/ClassDriver/Joystick/Descriptors.h | 93 + Demos/Device/ClassDriver/Joystick/Joystick.c | 202 ++ Demos/Device/ClassDriver/Joystick/Joystick.h | 100 + Demos/Device/ClassDriver/Joystick/Joystick.txt | 77 + Demos/Device/ClassDriver/Joystick/asf.xml | 62 + Demos/Device/ClassDriver/Joystick/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/Joystick/makefile | 43 + .../ClassDriver/Keyboard/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/Keyboard/Descriptors.c | 216 ++ Demos/Device/ClassDriver/Keyboard/Descriptors.h | 93 + Demos/Device/ClassDriver/Keyboard/Keyboard.c | 219 ++ Demos/Device/ClassDriver/Keyboard/Keyboard.h | 89 + Demos/Device/ClassDriver/Keyboard/Keyboard.txt | 76 + Demos/Device/ClassDriver/Keyboard/asf.xml | 62 + Demos/Device/ClassDriver/Keyboard/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/Keyboard/makefile | 43 + .../ClassDriver/KeyboardMouse/Config/LUFAConfig.h | 126 + .../Device/ClassDriver/KeyboardMouse/Descriptors.c | 289 +++ .../Device/ClassDriver/KeyboardMouse/Descriptors.h | 102 + .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 276 +++ .../ClassDriver/KeyboardMouse/KeyboardMouse.h | 84 + .../ClassDriver/KeyboardMouse/KeyboardMouse.txt | 81 + Demos/Device/ClassDriver/KeyboardMouse/asf.xml | 62 + Demos/Device/ClassDriver/KeyboardMouse/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/KeyboardMouse/makefile | 43 + .../KeyboardMouseMultiReport/Config/LUFAConfig.h | 126 + .../KeyboardMouseMultiReport/Descriptors.c | 279 +++ .../KeyboardMouseMultiReport/Descriptors.h | 101 + .../KeyboardMouseMultiReport.c | 237 ++ .../KeyboardMouseMultiReport.h | 84 + .../KeyboardMouseMultiReport.txt | 78 + .../ClassDriver/KeyboardMouseMultiReport/asf.xml | 61 + .../ClassDriver/KeyboardMouseMultiReport/doxyfile | 2395 +++++++++++++++++++ .../ClassDriver/KeyboardMouseMultiReport/makefile | 43 + Demos/Device/ClassDriver/MIDI/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/MIDI/Descriptors.c | 314 +++ Demos/Device/ClassDriver/MIDI/Descriptors.h | 108 + Demos/Device/ClassDriver/MIDI/MIDI.c | 211 ++ Demos/Device/ClassDriver/MIDI/MIDI.h | 78 + Demos/Device/ClassDriver/MIDI/MIDI.txt | 78 + Demos/Device/ClassDriver/MIDI/asf.xml | 62 + Demos/Device/ClassDriver/MIDI/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/MIDI/makefile | 43 + .../ClassDriver/MassStorage/Config/AppConfig.h | 50 + .../ClassDriver/MassStorage/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/MassStorage/Descriptors.c | 194 ++ Demos/Device/ClassDriver/MassStorage/Descriptors.h | 98 + .../ClassDriver/MassStorage/Lib/DataflashManager.c | 534 +++++ .../ClassDriver/MassStorage/Lib/DataflashManager.h | 89 + Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c | 349 +++ Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h | 89 + Demos/Device/ClassDriver/MassStorage/MassStorage.c | 162 ++ Demos/Device/ClassDriver/MassStorage/MassStorage.h | 83 + .../Device/ClassDriver/MassStorage/MassStorage.txt | 100 + Demos/Device/ClassDriver/MassStorage/asf.xml | 67 + Demos/Device/ClassDriver/MassStorage/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/MassStorage/makefile | 43 + .../MassStorageKeyboard/Config/AppConfig.h | 50 + .../MassStorageKeyboard/Config/LUFAConfig.h | 126 + .../ClassDriver/MassStorageKeyboard/Descriptors.c | 254 +++ .../ClassDriver/MassStorageKeyboard/Descriptors.h | 111 + .../MassStorageKeyboard/Lib/DataflashManager.c | 534 +++++ .../MassStorageKeyboard/Lib/DataflashManager.h | 87 + .../ClassDriver/MassStorageKeyboard/Lib/SCSI.c | 349 +++ .../ClassDriver/MassStorageKeyboard/Lib/SCSI.h | 89 + .../MassStorageKeyboard/MassStorageKeyboard.c | 270 +++ .../MassStorageKeyboard/MassStorageKeyboard.h | 100 + .../MassStorageKeyboard/MassStorageKeyboard.txt | 100 + .../Device/ClassDriver/MassStorageKeyboard/asf.xml | 70 + .../ClassDriver/MassStorageKeyboard/doxyfile | 2395 +++++++++++++++++++ .../ClassDriver/MassStorageKeyboard/makefile | 43 + Demos/Device/ClassDriver/Mouse/Config/LUFAConfig.h | 126 + Demos/Device/ClassDriver/Mouse/Descriptors.c | 221 ++ Demos/Device/ClassDriver/Mouse/Descriptors.h | 93 + Demos/Device/ClassDriver/Mouse/Mouse.c | 202 ++ Demos/Device/ClassDriver/Mouse/Mouse.h | 90 + Demos/Device/ClassDriver/Mouse/Mouse.txt | 76 + Demos/Device/ClassDriver/Mouse/asf.xml | 62 + Demos/Device/ClassDriver/Mouse/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/Mouse/makefile | 43 + .../ClassDriver/RNDISEthernet/Config/AppConfig.h | 60 + .../ClassDriver/RNDISEthernet/Config/LUFAConfig.h | 126 + .../Device/ClassDriver/RNDISEthernet/Descriptors.c | 244 ++ .../Device/ClassDriver/RNDISEthernet/Descriptors.h | 112 + .../ClassDriver/RNDISEthernet/LUFA RNDIS.inf | 59 + Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c | 87 + Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h | 76 + Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c | 129 ++ Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h | 131 ++ .../ClassDriver/RNDISEthernet/Lib/Ethernet.c | 132 ++ .../ClassDriver/RNDISEthernet/Lib/Ethernet.h | 101 + .../RNDISEthernet/Lib/EthernetProtocols.h | 92 + Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c | 83 + Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h | 83 + Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c | 116 + Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h | 93 + .../RNDISEthernet/Lib/ProtocolDecoders.c | 277 +++ .../RNDISEthernet/Lib/ProtocolDecoders.h | 60 + Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c | 632 ++++++ Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h | 260 +++ Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c | 84 + Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h | 70 + .../ClassDriver/RNDISEthernet/Lib/Webserver.c | 203 ++ .../ClassDriver/RNDISEthernet/Lib/Webserver.h | 57 + .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 179 ++ .../ClassDriver/RNDISEthernet/RNDISEthernet.h | 84 + .../ClassDriver/RNDISEthernet/RNDISEthernet.txt | 146 ++ Demos/Device/ClassDriver/RNDISEthernet/asf.xml | 84 + Demos/Device/ClassDriver/RNDISEthernet/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/RNDISEthernet/makefile | 44 + .../ClassDriver/VirtualSerial/Config/LUFAConfig.h | 126 + .../Device/ClassDriver/VirtualSerial/Descriptors.c | 245 ++ .../Device/ClassDriver/VirtualSerial/Descriptors.h | 110 + .../VirtualSerial/LUFA VirtualSerial.inf | 66 + .../ClassDriver/VirtualSerial/VirtualSerial.c | 202 ++ .../ClassDriver/VirtualSerial/VirtualSerial.h | 77 + .../ClassDriver/VirtualSerial/VirtualSerial.txt | 76 + Demos/Device/ClassDriver/VirtualSerial/asf.xml | 62 + Demos/Device/ClassDriver/VirtualSerial/doxyfile | 2395 +++++++++++++++++++ Demos/Device/ClassDriver/VirtualSerial/makefile | 43 + .../VirtualSerialMassStorage/Config/AppConfig.h | 50 + .../VirtualSerialMassStorage/Config/LUFAConfig.h | 126 + .../VirtualSerialMassStorage/Descriptors.c | 295 +++ .../VirtualSerialMassStorage/Descriptors.h | 128 ++ .../LUFA VirtualSerialMassStorage.inf | 66 + .../Lib/DataflashManager.c | 534 +++++ .../Lib/DataflashManager.h | 89 + .../VirtualSerialMassStorage/Lib/SCSI.c | 349 +++ .../VirtualSerialMassStorage/Lib/SCSI.h | 89 + .../VirtualSerialMassStorage.c | 257 +++ .../VirtualSerialMassStorage.h | 83 + .../VirtualSerialMassStorage.txt | 93 + .../ClassDriver/VirtualSerialMassStorage/asf.xml | 70 + .../ClassDriver/VirtualSerialMassStorage/doxyfile | 2395 +++++++++++++++++++ .../ClassDriver/VirtualSerialMassStorage/makefile | 43 + .../VirtualSerialMouse/Config/LUFAConfig.h | 126 + .../ClassDriver/VirtualSerialMouse/Descriptors.c | 323 +++ .../ClassDriver/VirtualSerialMouse/Descriptors.h | 123 + .../VirtualSerialMouse/LUFA VirtualSerialMouse.inf | 66 + .../VirtualSerialMouse/VirtualSerialMouse.c | 282 +++ .../VirtualSerialMouse/VirtualSerialMouse.h | 88 + .../VirtualSerialMouse/VirtualSerialMouse.txt | 79 + .../Device/ClassDriver/VirtualSerialMouse/asf.xml | 64 + .../Device/ClassDriver/VirtualSerialMouse/doxyfile | 2395 +++++++++++++++++++ .../Device/ClassDriver/VirtualSerialMouse/makefile | 43 + Demos/Device/ClassDriver/makefile | 46 + 200 files changed, 65006 insertions(+) create mode 100644 Demos/Device/ClassDriver/AudioInput/AudioInput.c create mode 100644 Demos/Device/ClassDriver/AudioInput/AudioInput.h create mode 100644 Demos/Device/ClassDriver/AudioInput/AudioInput.txt create mode 100644 Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/AudioInput/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/AudioInput/Descriptors.c create mode 100644 Demos/Device/ClassDriver/AudioInput/Descriptors.h create mode 100644 Demos/Device/ClassDriver/AudioInput/asf.xml create mode 100644 Demos/Device/ClassDriver/AudioInput/doxyfile create mode 100644 Demos/Device/ClassDriver/AudioInput/makefile create mode 100644 Demos/Device/ClassDriver/AudioOutput/AudioOutput.c create mode 100644 Demos/Device/ClassDriver/AudioOutput/AudioOutput.h create mode 100644 Demos/Device/ClassDriver/AudioOutput/AudioOutput.txt create mode 100644 Demos/Device/ClassDriver/AudioOutput/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/AudioOutput/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/AudioOutput/Descriptors.c create mode 100644 Demos/Device/ClassDriver/AudioOutput/Descriptors.h create mode 100644 Demos/Device/ClassDriver/AudioOutput/asf.xml create mode 100644 Demos/Device/ClassDriver/AudioOutput/doxyfile create mode 100644 Demos/Device/ClassDriver/AudioOutput/makefile create mode 100644 Demos/Device/ClassDriver/DualMIDI/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/DualMIDI/Descriptors.c create mode 100644 Demos/Device/ClassDriver/DualMIDI/Descriptors.h create mode 100644 Demos/Device/ClassDriver/DualMIDI/DualMIDI.c create mode 100644 Demos/Device/ClassDriver/DualMIDI/DualMIDI.h create mode 100644 Demos/Device/ClassDriver/DualMIDI/DualMIDI.txt create mode 100644 Demos/Device/ClassDriver/DualMIDI/asf.xml create mode 100644 Demos/Device/ClassDriver/DualMIDI/doxyfile create mode 100644 Demos/Device/ClassDriver/DualMIDI/makefile create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/LUFA DualVirtualSerial.inf create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/asf.xml create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/doxyfile create mode 100644 Demos/Device/ClassDriver/DualVirtualSerial/makefile create mode 100644 Demos/Device/ClassDriver/GenericHID/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/GenericHID/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/GenericHID/Descriptors.c create mode 100644 Demos/Device/ClassDriver/GenericHID/Descriptors.h create mode 100644 Demos/Device/ClassDriver/GenericHID/GenericHID.c create mode 100644 Demos/Device/ClassDriver/GenericHID/GenericHID.h create mode 100644 Demos/Device/ClassDriver/GenericHID/GenericHID.txt create mode 100755 Demos/Device/ClassDriver/GenericHID/HostTestApp/test_generic_hid_libusb.js create mode 100755 Demos/Device/ClassDriver/GenericHID/HostTestApp/test_generic_hid_libusb.py create mode 100644 Demos/Device/ClassDriver/GenericHID/HostTestApp/test_generic_hid_winusb.py create mode 100644 Demos/Device/ClassDriver/GenericHID/asf.xml create mode 100644 Demos/Device/ClassDriver/GenericHID/doxyfile create mode 100644 Demos/Device/ClassDriver/GenericHID/makefile create mode 100644 Demos/Device/ClassDriver/Joystick/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/Joystick/Descriptors.c create mode 100644 Demos/Device/ClassDriver/Joystick/Descriptors.h create mode 100644 Demos/Device/ClassDriver/Joystick/Joystick.c create mode 100644 Demos/Device/ClassDriver/Joystick/Joystick.h create mode 100644 Demos/Device/ClassDriver/Joystick/Joystick.txt create mode 100644 Demos/Device/ClassDriver/Joystick/asf.xml create mode 100644 Demos/Device/ClassDriver/Joystick/doxyfile create mode 100644 Demos/Device/ClassDriver/Joystick/makefile create mode 100644 Demos/Device/ClassDriver/Keyboard/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/Keyboard/Descriptors.c create mode 100644 Demos/Device/ClassDriver/Keyboard/Descriptors.h create mode 100644 Demos/Device/ClassDriver/Keyboard/Keyboard.c create mode 100644 Demos/Device/ClassDriver/Keyboard/Keyboard.h create mode 100644 Demos/Device/ClassDriver/Keyboard/Keyboard.txt create mode 100644 Demos/Device/ClassDriver/Keyboard/asf.xml create mode 100644 Demos/Device/ClassDriver/Keyboard/doxyfile create mode 100644 Demos/Device/ClassDriver/Keyboard/makefile create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/asf.xml create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/doxyfile create mode 100644 Demos/Device/ClassDriver/KeyboardMouse/makefile create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.h create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.txt create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/asf.xml create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/doxyfile create mode 100644 Demos/Device/ClassDriver/KeyboardMouseMultiReport/makefile create mode 100644 Demos/Device/ClassDriver/MIDI/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/MIDI/Descriptors.c create mode 100644 Demos/Device/ClassDriver/MIDI/Descriptors.h create mode 100644 Demos/Device/ClassDriver/MIDI/MIDI.c create mode 100644 Demos/Device/ClassDriver/MIDI/MIDI.h create mode 100644 Demos/Device/ClassDriver/MIDI/MIDI.txt create mode 100644 Demos/Device/ClassDriver/MIDI/asf.xml create mode 100644 Demos/Device/ClassDriver/MIDI/doxyfile create mode 100644 Demos/Device/ClassDriver/MIDI/makefile create mode 100644 Demos/Device/ClassDriver/MassStorage/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/MassStorage/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/MassStorage/Descriptors.c create mode 100644 Demos/Device/ClassDriver/MassStorage/Descriptors.h create mode 100644 Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c create mode 100644 Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h create mode 100644 Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c create mode 100644 Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h create mode 100644 Demos/Device/ClassDriver/MassStorage/MassStorage.c create mode 100644 Demos/Device/ClassDriver/MassStorage/MassStorage.h create mode 100644 Demos/Device/ClassDriver/MassStorage/MassStorage.txt create mode 100644 Demos/Device/ClassDriver/MassStorage/asf.xml create mode 100644 Demos/Device/ClassDriver/MassStorage/doxyfile create mode 100644 Demos/Device/ClassDriver/MassStorage/makefile create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.c create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/asf.xml create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/doxyfile create mode 100644 Demos/Device/ClassDriver/MassStorageKeyboard/makefile create mode 100644 Demos/Device/ClassDriver/Mouse/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/Mouse/Descriptors.c create mode 100644 Demos/Device/ClassDriver/Mouse/Descriptors.h create mode 100644 Demos/Device/ClassDriver/Mouse/Mouse.c create mode 100644 Demos/Device/ClassDriver/Mouse/Mouse.h create mode 100644 Demos/Device/ClassDriver/Mouse/Mouse.txt create mode 100644 Demos/Device/ClassDriver/Mouse/asf.xml create mode 100644 Demos/Device/ClassDriver/Mouse/doxyfile create mode 100644 Demos/Device/ClassDriver/Mouse/makefile create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/LUFA RNDIS.inf create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/asf.xml create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/doxyfile create mode 100644 Demos/Device/ClassDriver/RNDISEthernet/makefile create mode 100644 Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/VirtualSerial/Descriptors.c create mode 100644 Demos/Device/ClassDriver/VirtualSerial/Descriptors.h create mode 100644 Demos/Device/ClassDriver/VirtualSerial/LUFA VirtualSerial.inf create mode 100644 Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c create mode 100644 Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h create mode 100644 Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt create mode 100644 Demos/Device/ClassDriver/VirtualSerial/asf.xml create mode 100644 Demos/Device/ClassDriver/VirtualSerial/doxyfile create mode 100644 Demos/Device/ClassDriver/VirtualSerial/makefile create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/AppConfig.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/LUFA VirtualSerialMassStorage.inf create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/DataflashManager.c create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/DataflashManager.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/SCSI.c create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/Lib/SCSI.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/asf.xml create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/doxyfile create mode 100644 Demos/Device/ClassDriver/VirtualSerialMassStorage/makefile create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/Config/LUFAConfig.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/LUFA VirtualSerialMouse.inf create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/asf.xml create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/doxyfile create mode 100644 Demos/Device/ClassDriver/VirtualSerialMouse/makefile create mode 100644 Demos/Device/ClassDriver/makefile (limited to 'Demos/Device/ClassDriver') diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c new file mode 100644 index 0000000000..2870bcd6f7 --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -0,0 +1,274 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 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, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + 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 + * + * Main source file for the AudioInput demo. This file contains the main tasks of + * the demo and is responsible for the initial application hardware configuration. + */ + +#include "AudioInput.h" + +/** LUFA Audio Class driver interface configuration and state information. This structure is + * passed to all Audio Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. + */ +USB_ClassInfo_Audio_Device_t Microphone_Audio_Interface = + { + .Config = + { + .ControlInterfaceNumber = INTERFACE_ID_AudioControl, + .StreamingInterfaceNumber = INTERFACE_ID_AudioStream, + .DataINEndpoint = + { + .Address = AUDIO_STREAM_EPADDR, + .Size = AUDIO_STREAM_EPSIZE, + .Banks = 2, + }, + }, + }; + +/** Current audio sampling frequency of the streaming audio endpoint. */ +static uint32_t CurrentAudioSampleFrequency = 48000; + + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + SetupHardware(); + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + GlobalInterruptEnable(); + + for (;;) + { + Audio_Device_USBTask(&Microphone_Audio_Interface); + USB_USBTask(); + } +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ +#if (ARCH == ARCH_AVR8) + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); +#endif + + /* Hardware Initialization */ + LEDs_Init(); + Buttons_Init(); + ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32); + ADC_SetupChannel(MIC_IN_ADC_CHANNEL); + USB_Init(); + + /* Start the ADC conversion in free running mode */ + ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | ADC_GET_CHANNEL_MASK(MIC_IN_ADC_CHANNEL)); +} + +/** ISR to handle the reloading of the data endpoint with the next sample. */ +ISR(TIMER0_COMPA_vect, ISR_BLOCK) +{ + uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); + + /* Check that the USB bus is ready for the next sample to write */ + if (Audio_Device_IsReadyForNextSample(&Microphone_Audio_Interface)) + { + int16_t AudioSample; + + #if defined(USE_TEST_TONE) + static uint8_t SquareWaveSampleCount; + static int16_t CurrentWaveValue; + + /* In test tone mode, generate a square wave at 1/256 of the sample rate */ + if (SquareWaveSampleCount++ == 0xFF) + CurrentWaveValue ^= 0x8000; + + /* Only generate audio if the board button is being pressed */ + AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0; + #else + /* Audio sample is ADC value scaled to fit the entire range */ + AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult()); + + #if defined(MICROPHONE_BIASED_TO_HALF_RAIL) + /* Microphone is biased to half rail voltage, subtract the bias from the sample value */ + AudioSample -= (SAMPLE_MAX_RANGE / 2); + #endif + #endif + + Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample); + } + + Endpoint_SelectEndpoint(PrevEndpoint); +} + +/** Event handler for the library USB Connection event. */ +void EVENT_USB_Device_Connect(void) +{ + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); + + /* Sample reload timer initialization */ + TIMSK0 = (1 << OCIE0A); + OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); + TCCR0A = (1 << WGM01); // CTC mode + TCCR0B = (1 << CS01); // Fcpu/8 speed +} + +/** Event handler for the library USB Disconnection event. */ +void EVENT_USB_Device_Disconnect(void) +{ + /* Stop the sample reload timer */ + TCCR0B = 0; + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +} + +/** Event handler for the library USB Configuration Changed event. */ +void EVENT_USB_Device_ConfigurationChanged(void) +{ + bool ConfigSuccess = true; + + ConfigSuccess &= Audio_Device_ConfigureEndpoints(&Microphone_Audio_Interface); + + LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); +} + +/** Event handler for the library USB Control Request reception event. */ +void EVENT_USB_Device_ControlRequest(void) +{ + Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface); +} + +/** 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 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 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) +{ + /* Check the requested endpoint to see if a supported endpoint is being manipulated */ + if (EndpointAddress == Microphone_Audio_Interface.Config.DataINEndpoint.Address) + { + /* Check the requested control to see if a supported control is being manipulated */ + if (EndpointControl == AUDIO_EPCONTROL_SamplingFreq) + { + switch (EndpointProperty) + { + case AUDIO_REQ_SetCurrent: + /* Check if we are just testing for a valid property, or actually adjusting it */ + if (DataLength != NULL) + { + /* Set the new sampling frequency to the value given by the host */ + CurrentAudioSampleFrequency = (((uint32_t)Data[2] << 16) | ((uint32_t)Data[1] << 8) | (uint32_t)Data[0]); + + /* Adjust sample reload timer to the new frequency */ + OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); + } + + return true; + case AUDIO_REQ_GetCurrent: + /* Check if we are just testing for a valid property, or actually reading it */ + if (DataLength != NULL) + { + *DataLength = 3; + + Data[2] = (CurrentAudioSampleFrequency >> 16); + Data[1] = (CurrentAudioSampleFrequency >> 8); + Data[0] = (CurrentAudioSampleFrequency & 0xFF); + } + + return true; + } + } + } + + return false; +} + +/** 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 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) +{ + /* No audio interface entities in the device descriptor, thus no properties to get or set. */ + return false; +} diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h new file mode 100644 index 0000000000..1deaa76885 --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h @@ -0,0 +1,94 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 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, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + 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 AudioInput.c. + */ + +#ifndef _AUDIO_INPUT_H_ +#define _AUDIO_INPUT_H_ + + /* Includes: */ + #include + #include + #include + #include + + #include + #include + #include + #include + #include + + #include "Descriptors.h" + #include "Config/AppConfig.h" + + /* Macros: */ + /** Maximum audio sample value for the microphone input. */ + #define SAMPLE_MAX_RANGE 0xFFFF + + /** Maximum ADC range for the microphone input. */ + #define ADC_MAX_RANGE 0x3FF + + /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ + #define LEDMASK_USB_NOTREADY LEDS_LED1 + + /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */ + #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) + + /** LED mask for the library LED driver, to indicate that the USB interface is ready. */ + #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) + + /* Function Prototypes: */ + void SetupHardware(void); + + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_ControlRequest(void); + + 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); + 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); +#endif + diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.txt b/Demos/Device/ClassDriver/AudioInput/AudioInput.txt new file mode 100644 index 0000000000..4b0594244d --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.txt @@ -0,0 +1,92 @@ +/** \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 Audio Input Device Demo + * + * \section Sec_Compat Demo Compatibility: + * + * The following list indicates what microcontrollers are compatible with this demo. + * + * \li Series 7 USB AVRs (AT90USBxxx7) + * \li Series 6 USB AVRs (AT90USBxxx6) + * \li Series 4 USB AVRs (ATMEGAxxU4) + * + * \section Sec_Info USB Information: + * + * The following table gives a rundown of the USB utilization of this demo. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
USB Mode:Device
USB Class:Audio Class
USB Subclass:Standard Audio Device
Relevant Standards:USBIF Audio 1.0 Class Specification \n + * USBIF Audio 1.0 Class Terminal Types Specification \n + * USBIF Audio 1.0 Data Formats Specification
Supported USB Speeds:Full Speed Mode
+ * + * \section Sec_Description Project Description: + * + * Audio demonstration application. This gives a simple reference + * application for implementing a USB Audio Input device using the + * basic USB Audio 1.0 drivers in all modern OSes (i.e. no special drivers + * required). + * + * On start-up the system will automatically enumerate and function as a + * USB microphone. By default, the demo will produce a square wave test tone + * when the board button is pressed. If USE_TEST_TONE is not defined in the + * project makefile, incoming audio from the ADC channel 1 will be sampled + * and sent to the host computer instead. + * + * When in microphone mode, connect a microphone to the ADC channel 2. + * + * Under Windows, if a driver request dialogue pops up, select the option + * to automatically install the appropriate drivers. + * + * \section Sec_Options Project Options + * + * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Define Name:Location:Description:
MIC_IN_ADC_CHANNELAppConfig.hSets the ADC channel used by the demo for the input audio samples from an attached microphone.
USE_TEST_TONEAppConfig.hWhen defined, this alters the demo to produce a square wave test tone when the first board button is pressed + * instead of sampling the board microphone.
MICROPHONE_BIASED_TO_HALF_RAILAppConfig.hWhen defined, this alters the demo so that the half VCC bias of the microphone input is subtracted.
+ */ + diff --git a/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h b/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h new file mode 100644 index 0000000000..ff8ed270de --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/Config/AppConfig.h @@ -0,0 +1,51 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 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, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + 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 Application Configuration Header File + * + * This is a header file which is be used to configure some of + * the application's compile time options, as an alternative to + * specifying the compile time constants supplied through a + * makefile or build system. + * + * For information on what each token does, refer to the + * \ref Sec_Options section of the application documentation. + */ + +#ifndef _APP_CONFIG_H_ +#define _APP_CONFIG_H_ + + #define MIC_IN_ADC_CHANNEL 2 + + #define MICROPHONE_BIASED_TO_HALF_RAIL + #define USE_TEST_TONE + +#endif diff --git a/Demos/Device/ClassDriver/AudioInput/Config/LUFAConfig.h b/Demos/Device/ClassDriver/AudioInput/Config/LUFAConfig.h new file mode 100644 index 0000000000..6048c1d809 --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/Config/LUFAConfig.h @@ -0,0 +1,93 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 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, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + 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 + * + * This header file is used to configure LUFA's compile time options, + * as an alternative to the compile time constants supplied through + * a makefile. + * + * 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 (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) + #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 8 +// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} + #define FIXED_NUM_CONFIGURATIONS 1 +// #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 + + #else + + #error Unsupported architecture for this LUFA configuration file. + + #endif +#endif diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.c b/Demos/Device/ClassDriver/AudioInput/Descriptors.c new file mode 100644 index 0000000000..82cb337da6 --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.c @@ -0,0 +1,312 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 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 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, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + 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 + * + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine + * the device's capabilities and functions. + */ + +#include "Descriptors.h" + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(2,0,0), + .Class = USB_CSCP_NoDeviceClass, + .SubClass = USB_CSCP_NoDeviceSubclass, + .Protocol = USB_CSCP_NoDeviceProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, + .ProductID = 0x2047, + .ReleaseNumber = VERSION_BCD(0,0,2), + + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, + .SerialNumStrIndex = NO_DESCRIPTOR, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +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 = 2, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .Audio_ControlInterface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_AudioControl, + .AlternateSetting = 0, + + .TotalEndpoints = 0, + + .Class = AUDIO_CSCP_AudioClass, + .SubClass = AUDIO_CSCP_ControlSubclass, + .Protocol = AUDIO_CSCP_ControlProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .Audio_ControlInterface_SPC = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface}, + .Subtype = AUDIO_DSUBTYPE_CSInterface_Header, + + .ACSpecification = VERSION_BCD(1,0,0), + .TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) + + sizeof(USB_Audio_Descriptor_InputTerminal_t) + + sizeof(USB_Audio_Descriptor_OutputTerminal_t)), + + .InCollection = 1, + .InterfaceNumber = INTERFACE_ID_AudioStream, + }, + + .Audio_InputTerminal = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface}, + .Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal, + + .TerminalID = 0x01, + .TerminalType = AUDIO_TERMINAL_IN_MIC, + .AssociatedOutputTerminal = 0x00, + + .TotalChannels = 1, + .ChannelConfig = 0, + + .ChannelStrIndex = NO_DESCRIPTOR, + .TerminalStrIndex = NO_DESCRIPTOR + }, + + .Audio_OutputTerminal = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface}, + .Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal, + + .TerminalID = 0x02, + .TerminalType = AUDIO_TERMINAL_STREAMING, + .AssociatedInputTerminal = 0x00, + + .SourceID = 0x01, + + .TerminalStrIndex = NO_DESCRIPTOR + }, + + .Audio_StreamInterface_Alt0 = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_AudioStream, + .AlternateSetting = 0, + + .TotalEndpoints = 0, + + .Class = AUDIO_CSCP_AudioClass, + .SubClass = AUDIO_CSCP_AudioStreamingSubclass, + .Protocol = AUDIO_CSCP_StreamingProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .Audio_StreamInterface_Alt1 = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_AudioStream, + .AlternateSetting = 1, + + .TotalEndpoints = 1, + + .Class = AUDIO_CSCP_AudioClass, + .SubClass = AUDIO_CSCP_AudioStreamingSubclass, + .Protocol = AUDIO_CSCP_StreamingProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .Audio_StreamInterface_SPC = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface}, + .Subtype = AUDIO_DSUBTYPE_CSInterface_General, + + .TerminalLink = 0x02, + + .FrameDelay = 1, + .AudioFormat = 0x0001 + }, + + .Audio_AudioFormat = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t) + + sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates), + .Type = DTYPE_CSInterface}, + .Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType, + + .FormatType = 0x01, + .Channels = 0x01, + + .SubFrameSize = 0x02, + .BitResolution = 16, + + .TotalDiscreteSampleRates = (sizeof(ConfigurationDescriptor.Audio_AudioFormatSampleRates) / sizeof(USB_Audio_SampleFreq_t)) + }, + + .Audio_AudioFormatSampleRates = + { + AUDIO_SAMPLE_FREQ(8000), + AUDIO_SAMPLE_FREQ(11025), + AUDIO_SAMPLE_FREQ(22050), + AUDIO_SAMPLE_FREQ(44100), + AUDIO_SAMPLE_FREQ(48000), + }, + + .Audio_StreamEndpoint = + { + .Endpoint = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = AUDIO_STREAM_EPADDR, + .Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = AUDIO_STREAM_EPSIZE, + .PollingIntervalMS = 0x01 + }, + + .Refresh = 0, + .SyncEndpointNumber = 0 + }, + + .Audio_StreamEndpoint_SPC = + { + .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint}, + .Subtype = AUDIO_DSUBTYPE_CSEndpoint_General, + + .Attributes = (AUDIO_EP_ACCEPTS_SMALL_PACKETS | AUDIO_EP_SAMPLE_FREQ_CONTROL), + + .LockDelayUnits = 0x00, + .LockDelay = 0x0000 + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests + * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate + * via the language ID table available at USB.org what languages the device supports for its string descriptors. + */ +const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LUFA Audio In Demo"); + +/** 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 uint16_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (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 (DescriptorNumber) + { + case STRING_ID_Language: + Address = &LanguageString; + Size = pgm_read_byte(&LanguageString.Header.Size); + break; + case STRING_ID_Manufacturer: + Address = &ManufacturerString; + Size = pgm_read_byte(&ManufacturerString.Header.Size); + break; + case STRING_ID_Product: + Address = &ProductString; + Size = pgm_read_byte(&ProductString.Header.Size); + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +} + diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.h b/Demos/Device/ClassDriver/AudioInput/Descriptors.h new file mode 100644 index 0000000000..bb73220a27 --- /dev/null +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.h @@ -0,0 +1,106 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 201