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 --- .../AndroidAccessoryHost/AndroidAccessoryHost.c | 263 +++ .../AndroidAccessoryHost/AndroidAccessoryHost.h | 86 + .../AndroidAccessoryHost/AndroidAccessoryHost.txt | 62 + .../AndroidAccessoryHost/Config/LUFAConfig.h | 93 + .../AndroidAccessoryHost/ConfigDescriptor.c | 164 ++ .../AndroidAccessoryHost/ConfigDescriptor.h | 67 + .../AndroidAccessoryHost/DeviceDescriptor.c | 67 + .../AndroidAccessoryHost/DeviceDescriptor.h | 60 + .../Lib/AndroidAccessoryCommands.c | 84 + .../Lib/AndroidAccessoryCommands.h | 52 + Demos/Host/LowLevel/AndroidAccessoryHost/asf.xml | 55 + Demos/Host/LowLevel/AndroidAccessoryHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/AndroidAccessoryHost/makefile | 43 + .../Host/LowLevel/AudioInputHost/AudioInputHost.c | 250 ++ .../Host/LowLevel/AudioInputHost/AudioInputHost.h | 79 + .../LowLevel/AudioInputHost/AudioInputHost.txt | 66 + .../LowLevel/AudioInputHost/Config/LUFAConfig.h | 93 + .../LowLevel/AudioInputHost/ConfigDescriptor.c | 220 ++ .../LowLevel/AudioInputHost/ConfigDescriptor.h | 72 + Demos/Host/LowLevel/AudioInputHost/asf.xml | 50 + Demos/Host/LowLevel/AudioInputHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/AudioInputHost/makefile | 43 + .../LowLevel/AudioOutputHost/AudioOutputHost.c | 250 ++ .../LowLevel/AudioOutputHost/AudioOutputHost.h | 88 + .../LowLevel/AudioOutputHost/AudioOutputHost.txt | 83 + .../LowLevel/AudioOutputHost/Config/AppConfig.h | 51 + .../LowLevel/AudioOutputHost/Config/LUFAConfig.h | 93 + .../LowLevel/AudioOutputHost/ConfigDescriptor.c | 220 ++ .../LowLevel/AudioOutputHost/ConfigDescriptor.h | 73 + Demos/Host/LowLevel/AudioOutputHost/asf.xml | 54 + Demos/Host/LowLevel/AudioOutputHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/AudioOutputHost/makefile | 43 + .../LowLevel/GenericHIDHost/Config/LUFAConfig.h | 93 + .../LowLevel/GenericHIDHost/ConfigDescriptor.c | 183 ++ .../LowLevel/GenericHIDHost/ConfigDescriptor.h | 69 + .../Host/LowLevel/GenericHIDHost/GenericHIDHost.c | 269 +++ .../Host/LowLevel/GenericHIDHost/GenericHIDHost.h | 93 + .../LowLevel/GenericHIDHost/GenericHIDHost.txt | 64 + Demos/Host/LowLevel/GenericHIDHost/asf.xml | 50 + Demos/Host/LowLevel/GenericHIDHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/GenericHIDHost/makefile | 43 + .../JoystickHostWithParser/Config/LUFAConfig.h | 93 + .../JoystickHostWithParser/ConfigDescriptor.c | 187 ++ .../JoystickHostWithParser/ConfigDescriptor.h | 69 + .../LowLevel/JoystickHostWithParser/HIDReport.c | 111 + .../LowLevel/JoystickHostWithParser/HIDReport.h | 79 + .../JoystickHostWithParser.c | 273 +++ .../JoystickHostWithParser.h | 83 + .../JoystickHostWithParser.txt | 71 + Demos/Host/LowLevel/JoystickHostWithParser/asf.xml | 52 + .../Host/LowLevel/JoystickHostWithParser/doxyfile | 2395 ++++++++++++++++++++ .../Host/LowLevel/JoystickHostWithParser/makefile | 43 + .../Host/LowLevel/KeyboardHost/Config/LUFAConfig.h | 93 + .../Host/LowLevel/KeyboardHost/ConfigDescriptor.c | 155 ++ .../Host/LowLevel/KeyboardHost/ConfigDescriptor.h | 66 + Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c | 264 +++ Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h | 80 + Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt | 73 + Demos/Host/LowLevel/KeyboardHost/asf.xml | 50 + Demos/Host/LowLevel/KeyboardHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/KeyboardHost/makefile | 43 + .../KeyboardHostWithParser/Config/LUFAConfig.h | 93 + .../KeyboardHostWithParser/ConfigDescriptor.c | 189 ++ .../KeyboardHostWithParser/ConfigDescriptor.h | 67 + .../LowLevel/KeyboardHostWithParser/HIDReport.c | 90 + .../LowLevel/KeyboardHostWithParser/HIDReport.h | 67 + .../KeyboardHostWithParser.c | 285 +++ .../KeyboardHostWithParser.h | 78 + .../KeyboardHostWithParser.txt | 71 + Demos/Host/LowLevel/KeyboardHostWithParser/asf.xml | 52 + .../Host/LowLevel/KeyboardHostWithParser/doxyfile | 2395 ++++++++++++++++++++ .../Host/LowLevel/KeyboardHostWithParser/makefile | 43 + Demos/Host/LowLevel/MIDIHost/Config/LUFAConfig.h | 93 + Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c | 173 ++ Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h | 69 + Demos/Host/LowLevel/MIDIHost/MIDIHost.c | 266 +++ Demos/Host/LowLevel/MIDIHost/MIDIHost.h | 82 + Demos/Host/LowLevel/MIDIHost/MIDIHost.txt | 60 + Demos/Host/LowLevel/MIDIHost/asf.xml | 52 + Demos/Host/LowLevel/MIDIHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/MIDIHost/makefile | 43 + .../LowLevel/MassStorageHost/Config/LUFAConfig.h | 93 + .../LowLevel/MassStorageHost/ConfigDescriptor.c | 173 ++ .../LowLevel/MassStorageHost/ConfigDescriptor.h | 78 + .../MassStorageHost/Lib/MassStoreCommands.c | 635 ++++++ .../MassStorageHost/Lib/MassStoreCommands.h | 86 + .../LowLevel/MassStorageHost/MassStorageHost.c | 373 +++ .../LowLevel/MassStorageHost/MassStorageHost.h | 91 + .../LowLevel/MassStorageHost/MassStorageHost.txt | 68 + Demos/Host/LowLevel/MassStorageHost/asf.xml | 53 + Demos/Host/LowLevel/MassStorageHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/MassStorageHost/makefile | 43 + Demos/Host/LowLevel/MouseHost/Config/LUFAConfig.h | 93 + Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c | 159 ++ Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h | 66 + Demos/Host/LowLevel/MouseHost/MouseHost.c | 250 ++ Demos/Host/LowLevel/MouseHost/MouseHost.h | 82 + Demos/Host/LowLevel/MouseHost/MouseHost.txt | 74 + Demos/Host/LowLevel/MouseHost/asf.xml | 50 + Demos/Host/LowLevel/MouseHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/MouseHost/makefile | 43 + .../MouseHostWithParser/Config/LUFAConfig.h | 93 + .../MouseHostWithParser/ConfigDescriptor.c | 187 ++ .../MouseHostWithParser/ConfigDescriptor.h | 67 + .../Host/LowLevel/MouseHostWithParser/HIDReport.c | 111 + .../Host/LowLevel/MouseHostWithParser/HIDReport.h | 82 + .../MouseHostWithParser/MouseHostWithParser.c | 289 +++ .../MouseHostWithParser/MouseHostWithParser.h | 83 + .../MouseHostWithParser/MouseHostWithParser.txt | 71 + Demos/Host/LowLevel/MouseHostWithParser/asf.xml | 52 + Demos/Host/LowLevel/MouseHostWithParser/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/MouseHostWithParser/makefile | 43 + .../Host/LowLevel/PrinterHost/Config/LUFAConfig.h | 93 + Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c | 177 ++ Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h | 76 + .../LowLevel/PrinterHost/Lib/PrinterCommands.c | 162 ++ .../LowLevel/PrinterHost/Lib/PrinterCommands.h | 56 + Demos/Host/LowLevel/PrinterHost/PrinterHost.c | 226 ++ Demos/Host/LowLevel/PrinterHost/PrinterHost.h | 88 + Demos/Host/LowLevel/PrinterHost/PrinterHost.txt | 66 + Demos/Host/LowLevel/PrinterHost/asf.xml | 53 + Demos/Host/LowLevel/PrinterHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/PrinterHost/makefile | 43 + .../LowLevel/RNDISEthernetHost/Config/LUFAConfig.h | 93 + .../LowLevel/RNDISEthernetHost/ConfigDescriptor.c | 235 ++ .../LowLevel/RNDISEthernetHost/ConfigDescriptor.h | 73 + .../LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c | 311 +++ .../LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h | 70 + .../LowLevel/RNDISEthernetHost/RNDISEthernetHost.c | 249 ++ .../LowLevel/RNDISEthernetHost/RNDISEthernetHost.h | 85 + .../Host/LowLevel/RNDISEthernetHost/RNDISHost.txt | 63 + Demos/Host/LowLevel/RNDISEthernetHost/asf.xml | 53 + Demos/Host/LowLevel/RNDISEthernetHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/RNDISEthernetHost/makefile | 43 + .../LowLevel/StillImageHost/Config/LUFAConfig.h | 93 + .../LowLevel/StillImageHost/ConfigDescriptor.c | 190 ++ .../LowLevel/StillImageHost/ConfigDescriptor.h | 72 + Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h | 45 + .../StillImageHost/Lib/StillImageCommands.c | 268 +++ .../StillImageHost/Lib/StillImageCommands.h | 65 + .../Host/LowLevel/StillImageHost/StillImageHost.c | 365 +++ .../Host/LowLevel/StillImageHost/StillImageHost.h | 89 + .../LowLevel/StillImageHost/StillImageHost.txt | 65 + Demos/Host/LowLevel/StillImageHost/asf.xml | 54 + Demos/Host/LowLevel/StillImageHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/StillImageHost/makefile | 43 + .../LowLevel/VirtualSerialHost/Config/LUFAConfig.h | 93 + .../LowLevel/VirtualSerialHost/ConfigDescriptor.c | 234 ++ .../LowLevel/VirtualSerialHost/ConfigDescriptor.h | 73 + .../LowLevel/VirtualSerialHost/VirtualSerialHost.c | 239 ++ .../LowLevel/VirtualSerialHost/VirtualSerialHost.h | 80 + .../VirtualSerialHost/VirtualSerialHost.txt | 66 + Demos/Host/LowLevel/VirtualSerialHost/asf.xml | 50 + Demos/Host/LowLevel/VirtualSerialHost/doxyfile | 2395 ++++++++++++++++++++ Demos/Host/LowLevel/VirtualSerialHost/makefile | 43 + Demos/Host/LowLevel/makefile | 46 + 156 files changed, 51647 insertions(+) create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.h create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.txt create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.c create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/asf.xml create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/doxyfile create mode 100644 Demos/Host/LowLevel/AndroidAccessoryHost/makefile create mode 100644 Demos/Host/LowLevel/AudioInputHost/AudioInputHost.c create mode 100644 Demos/Host/LowLevel/AudioInputHost/AudioInputHost.h create mode 100644 Demos/Host/LowLevel/AudioInputHost/AudioInputHost.txt create mode 100644 Demos/Host/LowLevel/AudioInputHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/AudioInputHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/AudioInputHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/AudioInputHost/asf.xml create mode 100644 Demos/Host/LowLevel/AudioInputHost/doxyfile create mode 100644 Demos/Host/LowLevel/AudioInputHost/makefile create mode 100644 Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.c create mode 100644 Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.h create mode 100644 Demos/Host/LowLevel/AudioOutputHost/AudioOutputHost.txt create mode 100644 Demos/Host/LowLevel/AudioOutputHost/Config/AppConfig.h create mode 100644 Demos/Host/LowLevel/AudioOutputHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/AudioOutputHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/AudioOutputHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/AudioOutputHost/asf.xml create mode 100644 Demos/Host/LowLevel/AudioOutputHost/doxyfile create mode 100644 Demos/Host/LowLevel/AudioOutputHost/makefile create mode 100644 Demos/Host/LowLevel/GenericHIDHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c create mode 100644 Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h create mode 100644 Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt create mode 100644 Demos/Host/LowLevel/GenericHIDHost/asf.xml create mode 100644 Demos/Host/LowLevel/GenericHIDHost/doxyfile create mode 100644 Demos/Host/LowLevel/GenericHIDHost/makefile create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/asf.xml create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/doxyfile create mode 100644 Demos/Host/LowLevel/JoystickHostWithParser/makefile create mode 100644 Demos/Host/LowLevel/KeyboardHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c create mode 100644 Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h create mode 100644 Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt create mode 100644 Demos/Host/LowLevel/KeyboardHost/asf.xml create mode 100644 Demos/Host/LowLevel/KeyboardHost/doxyfile create mode 100644 Demos/Host/LowLevel/KeyboardHost/makefile create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/asf.xml create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/doxyfile create mode 100644 Demos/Host/LowLevel/KeyboardHostWithParser/makefile create mode 100644 Demos/Host/LowLevel/MIDIHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/MIDIHost/MIDIHost.c create mode 100644 Demos/Host/LowLevel/MIDIHost/MIDIHost.h create mode 100644 Demos/Host/LowLevel/MIDIHost/MIDIHost.txt create mode 100644 Demos/Host/LowLevel/MIDIHost/asf.xml create mode 100644 Demos/Host/LowLevel/MIDIHost/doxyfile create mode 100644 Demos/Host/LowLevel/MIDIHost/makefile create mode 100644 Demos/Host/LowLevel/MassStorageHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c create mode 100644 Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h create mode 100644 Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c create mode 100644 Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h create mode 100644 Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt create mode 100644 Demos/Host/LowLevel/MassStorageHost/asf.xml create mode 100644 Demos/Host/LowLevel/MassStorageHost/doxyfile create mode 100644 Demos/Host/LowLevel/MassStorageHost/makefile create mode 100644 Demos/Host/LowLevel/MouseHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/MouseHost/MouseHost.c create mode 100644 Demos/Host/LowLevel/MouseHost/MouseHost.h create mode 100644 Demos/Host/LowLevel/MouseHost/MouseHost.txt create mode 100644 Demos/Host/LowLevel/MouseHost/asf.xml create mode 100644 Demos/Host/LowLevel/MouseHost/doxyfile create mode 100644 Demos/Host/LowLevel/MouseHost/makefile create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/asf.xml create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/doxyfile create mode 100644 Demos/Host/LowLevel/MouseHostWithParser/makefile create mode 100644 Demos/Host/LowLevel/PrinterHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c create mode 100644 Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h create mode 100644 Demos/Host/LowLevel/PrinterHost/PrinterHost.c create mode 100644 Demos/Host/LowLevel/PrinterHost/PrinterHost.h create mode 100644 Demos/Host/LowLevel/PrinterHost/PrinterHost.txt create mode 100644 Demos/Host/LowLevel/PrinterHost/asf.xml create mode 100644 Demos/Host/LowLevel/PrinterHost/doxyfile create mode 100644 Demos/Host/LowLevel/PrinterHost/makefile create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/asf.xml create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/doxyfile create mode 100644 Demos/Host/LowLevel/RNDISEthernetHost/makefile create mode 100644 Demos/Host/LowLevel/StillImageHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h create mode 100644 Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c create mode 100644 Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h create mode 100644 Demos/Host/LowLevel/StillImageHost/StillImageHost.c create mode 100644 Demos/Host/LowLevel/StillImageHost/StillImageHost.h create mode 100644 Demos/Host/LowLevel/StillImageHost/StillImageHost.txt create mode 100644 Demos/Host/LowLevel/StillImageHost/asf.xml create mode 100644 Demos/Host/LowLevel/StillImageHost/doxyfile create mode 100644 Demos/Host/LowLevel/StillImageHost/makefile create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/Config/LUFAConfig.h create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/asf.xml create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/doxyfile create mode 100644 Demos/Host/LowLevel/VirtualSerialHost/makefile create mode 100644 Demos/Host/LowLevel/makefile (limited to 'Demos/Host/LowLevel') diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c new file mode 100644 index 0000000000..63d94f78ca --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c @@ -0,0 +1,263 @@ +/* + 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 AndroidAccessoryHost demo. This file contains the main tasks + * of the demo and is responsible for the initial application hardware configuration. + */ + +#include "AndroidAccessoryHost.h" + +/** Main program entry point. This routine configures the hardware required by the application, then + * enters a loop to run the application tasks in sequence. + */ +int main(void) +{ + SetupHardware(); + + puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE)); + + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + GlobalInterruptEnable(); + + for (;;) + { + AndroidHost_Task(); + 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 */ + Serial_Init(9600, false); + LEDs_Init(); + USB_Init(); + + /* Create a stdio stream for the serial port for stdin and stdout */ + Serial_CreateStream(NULL); +} + +/** Task to set the configuration of the attached device after it has been enumerated. */ +void AndroidHost_Task(void) +{ + if (USB_HostState != HOST_STATE_Configured) + return; + + /* Select the data IN pipe */ + Pipe_SelectPipe(ANDROID_DATA_IN_PIPE); + Pipe_Unfreeze(); + + /* Check to see if a packet has been received */ + if (Pipe_IsINReceived()) + { + /* Re-freeze IN pipe after the packet has been received */ + Pipe_Freeze(); + + /* Check if data is in the pipe */ + if (Pipe_IsReadWriteAllowed()) + { + uint8_t NextReceivedByte = Pipe_Read_8(); + uint8_t LEDMask = LEDS_NO_LEDS; + + if (NextReceivedByte & 0x01) + LEDMask |= LEDS_LED1; + + if (NextReceivedByte & 0x02) + LEDMask |= LEDS_LED2; + + if (NextReceivedByte & 0x04) + LEDMask |= LEDS_LED3; + + if (NextReceivedByte & 0x08) + LEDMask |= LEDS_LED4; + + LEDs_SetAllLEDs(LEDMask); + } + else + { + /* Clear the pipe after all data in the packet has been read, ready for the next packet */ + Pipe_ClearIN(); + } + } + + /* Re-freeze IN pipe after use */ + Pipe_Freeze(); +} + +/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and + * starts the library USB task to begin the enumeration and USB management process. + */ +void EVENT_USB_Host_DeviceAttached(void) +{ + puts_P(PSTR(ESC_FG_GREEN "Device Attached.\r\n" ESC_FG_WHITE)); + LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); +} + +/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and + * stops the library USB task management process. + */ +void EVENT_USB_Host_DeviceUnattached(void) +{ + puts_P(PSTR(ESC_FG_GREEN "\r\nDevice Unattached.\r\n" ESC_FG_WHITE)); + LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); +} + +/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully + * enumerated by the host and is now ready to be used by the application. + */ +void EVENT_USB_Host_DeviceEnumerationComplete(void) +{ + puts_P(PSTR("Getting Device Data.\r\n")); + + /* Get and process the configuration descriptor data */ + uint8_t ErrorCode = ProcessDeviceDescriptor(); + + bool RequiresModeSwitch = (ErrorCode == NonAccessoryModeAndroidDevice); + + /* Error out if the device is not an Android device or an error occurred */ + if ((ErrorCode != AccessoryModeAndroidDevice) && (ErrorCode != NonAccessoryModeAndroidDevice)) + { + if (ErrorCode == ControlError) + puts_P(PSTR(ESC_FG_RED "Control Error (Get Device).\r\n")); + else + puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n")); + + printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + printf_P(PSTR("Android Device Detected - %sAccessory mode.\r\n"), (RequiresModeSwitch ? "Non-" : "")); + + /* Check if a valid Android device was attached, but it is not current in Accessory mode */ + if (RequiresModeSwitch) + { + uint16_t AndroidProtocol; + + /* Fetch the version of the Android Accessory Protocol supported by the device */ + if ((ErrorCode = Android_GetAccessoryProtocol(&AndroidProtocol)) != HOST_SENDCONTROL_Successful) + { + printf_P(PSTR(ESC_FG_RED "Control Error (Get Protocol).\r\n" + " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + /* Validate the returned protocol version */ + if (AndroidProtocol != AOA_PROTOCOL_AccessoryV1) + { + puts_P(PSTR(ESC_FG_RED "Accessory Mode Not Supported.")); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + /* Send the device strings and start the Android Accessory Mode */ + Android_SendString(AOA_STRING_Manufacturer, "Dean Camera"); + Android_SendString(AOA_STRING_Model, "LUFA Android Demo"); + Android_SendString(AOA_STRING_Description, "LUFA Android Demo"); + Android_SendString(AOA_STRING_Version, "1.0"); + Android_SendString(AOA_STRING_URI, "http://www.lufa-lib.org"); + Android_SendString(AOA_STRING_Serial, "0000000012345678"); + + Android_StartAccessoryMode(); + return; + } + + puts_P(PSTR("Getting Config Data.\r\n")); + + /* Get and process the configuration descriptor data */ + if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead) + { + if (ErrorCode == ControlError) + puts_P(PSTR(ESC_FG_RED "Control Error (Get Configuration).\r\n")); + else + puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n")); + + printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */ + if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful) + { + printf_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n" + " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + return; + } + + puts_P(PSTR("Accessory Mode Android Enumerated.\r\n")); + LEDs_SetAllLEDs(LEDMASK_USB_READY); +} + +/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) +{ + USB_Disable(); + + printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n" + " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + for(;;); +} + +/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while + * enumerating an attached USB device. + */ +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode) +{ + printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n" + " -- Error Code %d\r\n" + " -- Sub Error Code %d\r\n" + " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState); + + LEDs_SetAllLEDs(LEDMASK_USB_ERROR); +} + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.h b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.h new file mode 100644 index 0000000000..36b2bf91e1 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.h @@ -0,0 +1,86 @@ +/* + 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 AndroidAccessoryHost.c. + */ + +#ifndef _ANDROID_ACCESSORY_HOST_H_ +#define _ANDROID_ACCESSORY_HOST_H_ + + /* Includes: */ + #include + #include + #include + #include + #include + #include + + #include "DeviceDescriptor.h" + #include "ConfigDescriptor.h" + #include "Lib/AndroidAccessoryCommands.h" + + #include + #include + #include + #include + #include + + /* Macros: */ + /** 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) + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_USB_BUSY LEDS_LED2 + + /* Function Prototypes: */ + void SetupHardware(void); + void AndroidHost_Task(void); + + /* Event Handlers: */ + void EVENT_USB_Host_DeviceAttached(void); + void EVENT_USB_Host_DeviceUnattached(void); + void EVENT_USB_Host_DeviceEnumerationComplete(void); + void EVENT_USB_Host_HostError(const uint8_t ErrorCode); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode); + +#endif + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.txt b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.txt new file mode 100644 index 0000000000..70e0935c9f --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.txt @@ -0,0 +1,62 @@ +/** \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 Android Accessory Host Demo + * + * \section Sec_Compat Demo Compatibility: + * + * The following list indicates what microcontrollers are compatible with this demo. + * + * \li Series 7 USB AVRs (AT90USBxxx7) + * + * \section Sec_Info USB Information: + * + * The following table gives a rundown of the USB utilization of this demo. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
USB Mode:Host
USB Class:Android Accessory Host Class
USB Subclass:N/A
Relevant Standards:Android Accessory Host Specification
Supported USB Speeds:Full Speed Mode
+ * + * \section Sec_Description Project Description: + * + * Android Accessory Host demonstration application. This gives a simple reference + * application for implementing an Android Accessory Host device capable of hosting + * Android powered mobile devices to send and receive data. + * + * Sent data from the Android device will be indicated onto the board's LEDs. + * + * \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. + * + * + * + * + * + *
+ * None + *
+ */ + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/Config/LUFAConfig.h b/Demos/Host/LowLevel/AndroidAccessoryHost/Config/LUFAConfig.h new file mode 100644 index 0000000000..1d840f618c --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/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_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 {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 0 +// #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/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c new file mode 100644 index 0000000000..d4aa877620 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c @@ -0,0 +1,164 @@ +/* + 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 Configuration Descriptor processing routines, to determine the correct pipe configurations + * needed to communication with an attached USB device. Descriptors are special computer-readable structures + * which the host requests upon device enumeration, to determine the device's capabilities and functions. + */ + +#include "ConfigDescriptor.h" + +/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This + * routine will read in the entire configuration descriptor, and configure the hosts pipes to correctly communicate + * with compatible devices. + * + * This routine searches for the first interface containing bulk IN and OUT data endpoints. + * + * \return An error code from the \ref AndroidHost_GetConfigDescriptorDataCodes_t enum. + */ +uint8_t ProcessConfigurationDescriptor(void) +{ + uint8_t ConfigDescriptorData[512]; + void* CurrConfigLocation = ConfigDescriptorData; + uint16_t CurrConfigBytesRem; + + USB_Descriptor_Endpoint_t* DataINEndpoint = NULL; + USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL; + + /* Retrieve the entire configuration descriptor into the allocated buffer */ + switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData))) + { + case HOST_GETCONFIG_Successful: + break; + case HOST_GETCONFIG_InvalidData: + return InvalidConfigDataReturned; + case HOST_GETCONFIG_BuffOverflow: + return DescriptorTooLarge; + default: + return DevControlError; + } + + /* There should be only one compatible Android Accessory Mode interface in the device, attempt to find it */ + if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, + DCOMP_NextAndroidAccessoryInterface) != DESCRIPTOR_SEARCH_COMP_Found) + { + return NoCompatibleInterfaceFound; + } + + while (!(DataINEndpoint) || !(DataOUTEndpoint)) + { + /* Get the next Android Accessory Mode interface's data endpoint descriptor */ + if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation, + DCOMP_NextInterfaceBulkEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + { + /* Data endpoints not found within the first Android Accessory device interface, error out */ + return NoCompatibleInterfaceFound; + } + + /* Retrieve the endpoint address from the endpoint descriptor */ + USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t); + + /* If the endpoint is a IN type endpoint */ + if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN) + DataINEndpoint = EndpointData; + else + DataOUTEndpoint = EndpointData; + } + + /* Configure the Android Accessory data IN pipe */ + Pipe_ConfigurePipe(ANDROID_DATA_IN_PIPE, EP_TYPE_BULK, DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, 1); + + /* Configure the Android Accessory data OUT pipe */ + Pipe_ConfigurePipe(ANDROID_DATA_OUT_PIPE, EP_TYPE_BULK, DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, 1); + + /* Valid data found, return success */ + return SuccessfulConfigRead; +} + +/** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's + * configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration + * descriptor processing if an incompatible descriptor configuration is found. + * + * This comparator searches for the next Interface descriptor containing the correct Android Accessory Mode Class, Subclass + * and Protocol values. + * + * \return A value from the DSEARCH_Return_ErrorCodes_t enum + */ +uint8_t DCOMP_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; +} + +/** Descriptor comparator function. This comparator function is can be called while processing an attached USB device's + * configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration + * descriptor processing if an incompatible descriptor configuration is found. + * + * This comparator searches for the next bulk Endpoint descriptor inside the current interface descriptor, aborting the + * search if another interface descriptor is found before the required endpoint. + * + * \return A value from the DSEARCH_Return_ErrorCodes_t enum + */ +uint8_t DCOMP_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; +} + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h new file mode 100644 index 0000000000..f422f8c2e2 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h @@ -0,0 +1,67 @@ +/* + 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 ConfigDescriptor.c. + */ + +#ifndef _CONFIGDESCRIPTOR_H_ +#define _CONFIGDESCRIPTOR_H_ + + /* Includes: */ + #include + + /* Macros: */ + /** Pipe address of the Android Accessory data IN pipe. */ + #define ANDROID_DATA_IN_PIPE (PIPE_DIR_IN | 1) + + /** Pipe address of the Android Accessory data OUT pipe. */ + #define ANDROID_DATA_OUT_PIPE (PIPE_DIR_OUT | 2) + + /* Enums: */ + /** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */ + enum AndroidHost_GetConfigDescriptorDataCodes_t + { + SuccessfulConfigRead = 0, /**< Configuration Descriptor was processed successfully */ + DevControlError = 1, /**< A control request to the device failed to complete successfully */ + DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */ + InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */ + NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */ + }; + + /* Function Prototypes: */ + uint8_t ProcessConfigurationDescriptor(void); + + uint8_t DCOMP_NextAndroidAccessoryInterface(void* const CurrentDescriptor); + uint8_t DCOMP_NextInterfaceBulkEndpoint(void* CurrentDescriptor); + +#endif + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.c b/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.c new file mode 100644 index 0000000000..03841a9903 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.c @@ -0,0 +1,67 @@ +/* + 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 Descriptor processing routines, to determine the overall device parameters. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine information about + * the attached device. + */ + +#include "DeviceDescriptor.h" + +/** Reads and processes an attached device's Device Descriptor, to determine compatibility + * + * This routine checks to ensure that the attached device's VID and PID matches Google's for Android devices. + * + * \return An error code from the \ref AndroidHost_GetDeviceDescriptorDataCodes_t enum. + */ +uint8_t ProcessDeviceDescriptor(void) +{ + USB_Descriptor_Device_t DeviceDescriptor; + + /* Send the request to retrieve the device descriptor */ + if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful) + return DevControlError; + + /* Validate returned data - ensure the returned data is a device descriptor */ + if (DeviceDescriptor.Header.Type != DTYPE_Device) + return InvalidDeviceDataReturned; + + /* Check the product ID to determine if the Android device is in accessory mode */ + if ((DeviceDescriptor.ProductID != ANDROID_ACCESSORY_PRODUCT_ID) && + (DeviceDescriptor.ProductID != ANDROID_ACCESSORY_ADB_PRODUCT_ID)) + { + return NonAccessoryModeAndroidDevice; + } + + return AccessoryModeAndroidDevice; +} + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h b/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h new file mode 100644 index 0000000000..3324b2a551 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h @@ -0,0 +1,60 @@ +/* + 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 DeviceDescriptor.c. + */ + +#ifndef _DEVICEDESCRIPTOR_H_ +#define _DEVICEDESCRIPTOR_H_ + + /* Includes: */ + #include + + #include "AndroidAccessoryHost.h" + + /* Enums: */ + /** Enum for the possible return codes of the \ref ProcessDeviceDescriptor() function. */ + enum AndroidHost_GetDeviceDescriptorDataCodes_t + { + SuccessfulDeviceRead = 0, /**< Device Descriptor was processed successfully */ + ControlError = 1, /**< A control request to the device failed to complete successfully */ + InvalidDeviceDataReturned = 2, /**< The device returned an invalid Device Descriptor */ + IncorrectAndroidDevice = 3, /**< The attached device is not an Android device */ + NonAccessoryModeAndroidDevice = 4, /**< The attached device is an Android device in non-accessory mode */ + AccessoryModeAndroidDevice = 5, /**< The attached device is an Android device in accessory mode */ + }; + + /* Function Prototypes: */ + uint8_t ProcessDeviceDescriptor(void); + +#endif + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c new file mode 100644 index 0000000000..7446e073a3 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c @@ -0,0 +1,84 @@ +/* + 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 + * + * Android Accessory Mode utility functions, for the configuration of an attached + * Android device into Android Accessory Mode ready for general communication. + */ + +#include "AndroidAccessoryCommands.h" + +uint8_t Android_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); +} + +uint8_t Android_SendString(const uint8_t StringIndex, + const char* const 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 Android_StartAccessoryMode(void) +{ + 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); +} + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h new file mode 100644 index 0000000000..98fb0365df --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h @@ -0,0 +1,52 @@ +/* + 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 AndroidAccessoryCommands.c. + */ + +#ifndef _ANDROID_ACCESSORY_COMMANDS_H_ +#define _ANDROID_ACCESSORY_COMMANDS_H_ + + /* Includes: */ + #include + #include + + #include + + /* Function Prototypes: */ + uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol); + uint8_t Android_SendString(const uint8_t StringIndex, + const char* const String); + uint8_t Android_StartAccessoryMode(void); + +#endif + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/asf.xml b/Demos/Host/LowLevel/AndroidAccessoryHost/asf.xml new file mode 100644 index 0000000000..25b47661b5 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/asf.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + Android Accessory Host demo, implementing a basic USB device whose LEDs can be controlled via an Android device. This demo uses the Low Level LUFA APIs to manually implement a USB Class for demonstration purposes without using the simpler in-built LUFA Class Driver APIs. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/doxyfile b/Demos/Host/LowLevel/AndroidAccessoryHost/doxyfile new file mode 100644 index 0000000000..6fd6211d32 --- /dev/null +++ b/Demos/Host/LowLevel/AndroidAccessoryHost/doxyfile @@ -0,0 +1,2395 @@ +# Doxyfile 1.8.9 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single 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. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "LUFA Library - Android Accessory Mode Host Demo" + +# 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 = + +# 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 a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum w